Skip to content

Commit

Permalink
Merge pull request #127 from imaNNeoFighT/hotfix/line-chart-show-bug
Browse files Browse the repository at this point in the history
prevent to show touch indicators if barData.show is false, fixed #125.
  • Loading branch information
imaNNeo authored Dec 5, 2019
2 parents 1dd8446 + 2a222a6 commit bab22e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/src/chart/line_chart/line_chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler
for (int i = 0; i < data.lineBarsData.length; i++) {
final barData = data.lineBarsData[i];

if (!barData.show) {
continue;
}

drawBarLine(canvas, size, barData);
drawDots(canvas, size, barData);
drawTouchedSpotsIndicator(canvas, size, barData);
Expand Down Expand Up @@ -876,6 +880,10 @@ class LineChartPainter extends AxisChartPainter<LineChartData> with TouchHandler

/// find the nearest spot base on the touched offset
LineBarSpot _getNearestTouchedSpot(Size viewSize, Offset touchedPoint, LineChartBarData barData, int barDataPosition) {
if (!barData.show) {
return null;
}

final Size chartViewSize = getChartUsableDrawSize(viewSize);

/// Find the nearest spot (on X axis)
Expand Down

0 comments on commit bab22e1

Please sign in to comment.