Skip to content

Commit

Permalink
Adrresses review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh authored and imaNNeo committed Mar 28, 2024
1 parent cdfdb66 commit 0d486c8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 47 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
## newVersion
* **FEATURE** (by @julien4215) Add direction property to the [HorizontalLineLabel](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/base_chart.md#horizontallinelabel) and [VerticalLineLabel](https://github.com/imaNNeo/fl_chart/blob/main/repo_files/documentations/base_chart.md#verticallinelabel), #1574

## 0.67.0
* **FEATURE** (by @apekshamehta) Added new method called getTooltipColor for axis charts (bar,line,scatter) to change backgroud color of tooltip dynamically.[issue](https://github.com/imaNNeo/fl_chart/issues/1279).
* **BREAKING** (by @apekshamehta) Removed tooltipBgColor property from Bar, Line and Scatter Charts.

Expand Down
14 changes: 1 addition & 13 deletions example/lib/presentation/samples/bar/bar_chart_sample1.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,7 @@ class BarChartSample1State extends State<BarChartSample1> {
return BarChartData(
barTouchData: BarTouchData(
touchTooltipData: BarTouchTooltipData(
getTooltipColor: (group) {
Color bgColor = switch (group.x) {
0 => AppColors.contentColorPurple.withAlpha(100),
1 => AppColors.contentColorYellow.withAlpha(100),
2 => AppColors.contentColorBlue.withAlpha(100),
3 => AppColors.contentColorOrange.withAlpha(100),
4 => AppColors.contentColorPink.withAlpha(100),
5 => AppColors.contentColorRed.withAlpha(100),
6 => AppColors.contentColorPurple.withAlpha(150),
_ => throw Error(),
};
return bgColor;
},
getTooltipColor: (_) => Colors.blueGrey,
tooltipHorizontalAlignment: FLHorizontalAlignment.right,
tooltipMargin: -10,
getTooltipItem: (group, groupIndex, rod, rodIndex) {
Expand Down
17 changes: 1 addition & 16 deletions example/lib/presentation/samples/line/line_chart_sample3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,7 @@ class _LineChartSample3State extends State<LineChartSample3> {
}).toList();
},
touchTooltipData: LineTouchTooltipData(
getTooltipColor: (touchedSpot) {
Color bgColor = switch ((
touchedSpot.x.toInt(),
touchedSpot.y.toDouble()
)) {
(0, 1.3) => AppColors.contentColorPurple.withAlpha(100),
(1, 1) => AppColors.contentColorYellow.withAlpha(100),
(2, 1.8) => AppColors.contentColorBlue.withAlpha(100),
(3, 1.5) => AppColors.contentColorOrange.withAlpha(100),
(4, 2.2) => AppColors.contentColorPink.withAlpha(100),
(5, 1.8) => AppColors.contentColorRed.withAlpha(100),
(6, 3) => AppColors.contentColorPurple.withAlpha(150),
_ => throw Error(),
};
return bgColor;
},
getTooltipColor: (touchedSpot) => widget.tooltipBgColor,
getTooltipItems: (List<LineBarSpot> touchedBarSpots) {
return touchedBarSpots.map((barSpot) {
final flSpot = barSpot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,7 @@ class _ScatterChartSample2State extends State {
},
touchTooltipData: ScatterTouchTooltipData(
getTooltipColor: (ScatterSpot touchedBarSpot) {
Color bgColor = switch ((
touchedBarSpot.x.toInt(),
touchedBarSpot.y.toInt()
)) {
(4, 4) => AppColors.contentColorPurple.withAlpha(100),
(2, 5) => AppColors.contentColorYellow.withAlpha(100),
(4, 5) => AppColors.contentColorBlue.withAlpha(100),
(8, 6) => AppColors.contentColorOrange.withAlpha(100),
(5, 7) => AppColors.contentColorPink.withAlpha(100),
(7, 2) => AppColors.contentColorRed.withAlpha(100),
(3, 2) => AppColors.contentColorPurple.withAlpha(150),
(2, 8) => AppColors.contentColorYellow.withAlpha(100),
_ => throw Error(),
};
return bgColor;
return touchedBarSpot.dotPainter.mainColor;
},
getTooltipItems: (ScatterSpot touchedBarSpot) {
return ScatterTooltipItem(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fl_chart
description: A highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
version: 0.67.0
version: 0.66.2
homepage: https://flchart.dev/
repository: https://github.com/imaNNeo/fl_chart
issue_tracker: https://github.com/imaNNeo/fl_chart/issues
Expand Down

0 comments on commit 0d486c8

Please sign in to comment.