Skip to content

Commit

Permalink
Merge pull request #132 from imaNNeoFighT/hotfix/titles-target-data
Browse files Browse the repository at this point in the history
use targetData to draw the titles, fixed #130.
  • Loading branch information
imaNNeo authored Dec 10, 2019
2 parents a507a62 + af6c15b commit fd7a79d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.5.2
* drawing titles using targetData instead of animating data, fixed issue #130.

## 0.5.1
* prevent to show touch indicators if barData.show is false in LineChart, [#125](https://github.com/imaNNeoFighT/fl_chart/issues/125).

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Thank you all!

```kotlin
dependencies:
fl_chart: ^0.5.1
fl_chart: ^0.5.2
```


Expand Down
8 changes: 4 additions & 4 deletions lib/src/chart/bar_chart/bar_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,13 @@ class BarChartPainter extends AxisChartPainter<BarChartData> with TouchHandler<B
}

void drawTitles(Canvas canvas, Size viewSize, List<GroupBarsPosition> groupBarsPosition) {
if (!data.titlesData.show) {
if (!targetData.titlesData.show) {
return;
}
final Size drawSize = getChartUsableDrawSize(viewSize);

// Left Titles
final leftTitles = data.titlesData.leftTitles;
final leftTitles = targetData.titlesData.leftTitles;
if (leftTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -295,7 +295,7 @@ class BarChartPainter extends AxisChartPainter<BarChartData> with TouchHandler<B
}

// Right Titles
final rightTitles = data.titlesData.rightTitles;
final rightTitles = targetData.titlesData.rightTitles;
if (rightTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -317,7 +317,7 @@ class BarChartPainter extends AxisChartPainter<BarChartData> with TouchHandler<B
}

// Bottom titles
final bottomTitles = data.titlesData.bottomTitles;
final bottomTitles = targetData.titlesData.bottomTitles;
if (bottomTitles.showTitles) {
for (int index = 0; index < groupBarsPosition.length; index++) {
final GroupBarsPosition groupBarPos = groupBarsPosition[index];
Expand Down
10 changes: 5 additions & 5 deletions lib/src/chart/line_chart/line_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,13 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler
}

void drawTitles(Canvas canvas, Size viewSize) {
if (!data.titlesData.show) {
if (!targetData.titlesData.show) {
return;
}
viewSize = getChartUsableDrawSize(viewSize);

// Left Titles
final leftTitles = data.titlesData.leftTitles;
final leftTitles = targetData.titlesData.leftTitles;
if (leftTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -590,7 +590,7 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler
}

// Top titles
final topTitles = data.titlesData.topTitles;
final topTitles = targetData.titlesData.topTitles;
if (topTitles.showTitles) {
double horizontalSeek = data.minX;
while (horizontalSeek <= data.maxX) {
Expand All @@ -614,7 +614,7 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler
}

// Right Titles
final rightTitles = data.titlesData.rightTitles;
final rightTitles = targetData.titlesData.rightTitles;
if (rightTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -636,7 +636,7 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler
}

// Bottom titles
final bottomTitles = data.titlesData.bottomTitles;
final bottomTitles = targetData.titlesData.bottomTitles;
if (bottomTitles.showTitles) {
double horizontalSeek = data.minX;
while (horizontalSeek <= data.maxX) {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/chart/scatter_chart/scatter_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class ScatterChartPainter extends AxisChartPainter<ScatterChartData> with TouchH
}

void drawTitles(Canvas canvas, Size viewSize) {
if (!data.titlesData.show) {
if (!targetData.titlesData.show) {
return;
}
viewSize = getChartUsableDrawSize(viewSize);

// Left Titles
final leftTitles = data.titlesData.leftTitles;
final leftTitles = targetData.titlesData.leftTitles;
if (leftTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -73,7 +73,7 @@ class ScatterChartPainter extends AxisChartPainter<ScatterChartData> with TouchH
}

// Top titles
final topTitles = data.titlesData.topTitles;
final topTitles = targetData.titlesData.topTitles;
if (topTitles.showTitles) {
double horizontalSeek = data.minX;
while (horizontalSeek <= data.maxX) {
Expand All @@ -97,7 +97,7 @@ class ScatterChartPainter extends AxisChartPainter<ScatterChartData> with TouchH
}

// Right Titles
final rightTitles = data.titlesData.rightTitles;
final rightTitles = targetData.titlesData.rightTitles;
if (rightTitles.showTitles) {
double verticalSeek = data.minY;
while (verticalSeek <= data.maxY) {
Expand All @@ -119,7 +119,7 @@ class ScatterChartPainter extends AxisChartPainter<ScatterChartData> with TouchH
}

// Bottom titles
final bottomTitles = data.titlesData.bottomTitles;
final bottomTitles = targetData.titlesData.bottomTitles;
if (bottomTitles.showTitles) {
double horizontalSeek = data.minX;
while (horizontalSeek <= data.maxX) {
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 powerful Flutter chart library, currently supporting Line Chart, Bar Chart and Pie Chart.
version: 0.5.1
version: 0.5.2
author: Iman Khoshabi <[email protected]>
homepage: https://github.com/imaNNeoFighT/fl_chart

Expand Down

0 comments on commit fd7a79d

Please sign in to comment.