Skip to content

Commit 47e5dbc

Browse files
update documents
1 parent febbcf2 commit 47e5dbc

File tree

2 files changed

+63
-5
lines changed

2 files changed

+63
-5
lines changed

CHANGELOG.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
1-
## newVersion
1+
## 1.2.0
22
* **BUGFIX** (by @imaNNeo) Consider the `enabled` property in [LineTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/line_chart.md#linetouchdata-read-about-touch-handling), [BarTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/bar_chart.md#bartouchdata-read-about-touch-handling), [PieTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/pie_chart.md#pietouchdata-read-about-touch-handling), [ScatterTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/scatter_chart.md#scattertouchdata-read-about-touch-handling), [RadarTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/radar_chart.md#radartouchdata-read-about-touch-handling) and [CandlestickTouchData](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/candlestick_chart.md#candlesticktouchdata-read-about-touch-handling), #1676
3+
* **BREAKING** ⚠️ (by @huanghui1998hhh) Enhanced line chart curve function with a new extensible curve system. Introduced `LineChartCurve` abstract class. You can implement your own curve or use built-in curve: `LineChartCubicTensionCurve`(old curve implementation), and `LineChartCubicMonotoneCurve`.
4+
**Migration Guide:**
5+
6+
Old API (deprecated):
7+
```dart
8+
LineChartBarData(
9+
spots: spots,
10+
isCurved: true,
11+
curveSmoothness: 0.35,
12+
preventCurveOverShooting: true,
13+
preventCurveOvershootingThreshold: 10.0,
14+
)
15+
```
16+
17+
New API:
18+
```dart
19+
LineChartBarData(
20+
spots: spots,
21+
curve: LineChartCurve.cubicTension( // or use LineChartCubicTensionCurve()
22+
smoothness: 0.35,
23+
preventCurveOverShooting: true,
24+
preventCurveOvershootingThreshold: 10.0,
25+
),
26+
)
27+
```
28+
29+
Or use the new monotone curve:
30+
```dart
31+
LineChartBarData(
32+
spots: spots,
33+
curve: LineChartCurve.cubicMonotone( // or use LineChartCubicMonotoneCurve()
34+
smooth: 0.5,
35+
monotone: SmoothMonotone.x, // Prevents overshooting along X-axis
36+
),
37+
)
38+
```
39+
40+
For straight lines (isCurved: false):
41+
```dart
42+
LineChartBarData(
43+
spots: spots,
44+
curve: LineChartCurve.noCurve, // or omit the curve parameter (default)
45+
)
46+
```
47+
48+
Check the updated [LineChart documentation](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/line_chart.md#linechartcurve) for more details.
349

450
## 1.1.1
551
* **IMPROVEMENT** (by @imaNNeo) Upgrade `vector_math` dependency to `2.2.0`, #1985

repo_files/documentations/line_chart.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ When you change the chart's state, it animates to the new state internally (usin
4747
|gradient| You can use any [Gradient](https://api.flutter.dev/flutter/dart-ui/Gradient-class.html) here. such as [LinearGradient](https://api.flutter.dev/flutter/painting/LinearGradient-class.html) or [RadialGradient](https://api.flutter.dev/flutter/painting/RadialGradient-class.html)|null|
4848
|gradientArea| determines the area where the gradient is applied |null|
4949
|barWidth| gets the stroke width of the line bar|2.0|
50-
|isCurved| curves the corners of the line on the spot's positions| false|
51-
|curveSmoothness| smoothness radius of the curve corners (works when isCurved is true) | 0.35|
52-
|preventCurveOverShooting|prevent overshooting when draw curve line on linear sequence spots, check this [issue](https://github.com/imaNNeo/fl_chart/issues/25)| false|
53-
|preventCurveOvershootingThreshold|threshold for applying prevent overshooting algorithm | 10.0|
50+
|curve| determines the curve style for drawing segments between spots (use [LineChartCurve](#LineChartCurve) types)| LineChartCurve.noCurve (straight lines)|
5451
|isStrokeCapRound| determines whether start and end of the bar line is Qubic or Round | false|
5552
|isStrokeJoinRound| determines whether stroke joins have a round shape or a sharp edge | false|
5653
|belowBarData| check the [BarAreaData](#BarAreaData) |BarAreaData|
@@ -63,6 +60,21 @@ When you change the chart's state, it animates to the new state internally (usin
6360
|lineChartStepData|Holds data for representing a Step Line Chart, and works only if [isStepChart] is true.|[LineChartStepData](#LineChartStepData)()|
6461
|errorIndicatorData|Holds data for representing an error indicator (you see the error indicators if you provide the `xError` or `yError` in the [FlSpot](base_chart.md#FlSpot)).|[ErrorIndicatorData()](base_chart.md#FlErrorIndicatorData)|
6562

63+
### LineChartCurve
64+
#### LineChartCubicTensionCurve
65+
|PropName|Description|default value|
66+
|:-------|:----------|:------------|
67+
|smoothness| smoothness radius of the curve corners | 0.35|
68+
|preventCurveOverShooting|prevent overshooting when draw curve line on linear sequence spots, check this [issue](https://github.com/imaNNeo/fl_chart/issues/25)| false|
69+
|preventCurveOvershootingThreshold|threshold for applying prevent overshooting algorithm | 10.0|
70+
71+
#### LineChartCubicMonotoneCurve
72+
|PropName|Description|default value|
73+
|:-------|:----------|:------------|
74+
|smooth| determines smoothness of the curve (0.0 = straight, 1.0 = roundest) | 0.5|
75+
|monotone| monotonicity constraint (none, x, or y) to prevent overshooting along the specified axis | SmoothMonotone.none|
76+
|tinyThresholdSquared| squared distance threshold to draw straight line when points are too close (avoids jitter) | 0.5|
77+
6678
### LineChartStepData
6779
|PropName|Description|default value|
6880
|:-------|:----------|:------------|

0 commit comments

Comments
 (0)