From 2b7be70d39d89ca5bb8e92e41acabec0a4c40456 Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Fri, 24 Nov 2023 21:58:56 +0100 Subject: [PATCH] Allow to show single point line in LineChart, #1438 --- CHANGELOG.md | 1 + example/ios/Podfile.lock | 10 ++++++++-- example/macos/Podfile.lock | 2 +- lib/src/chart/line_chart/line_chart_painter.dart | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1d4a0fc9..702c16144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * **BUGFIX** (by @imaNNeo) Fix having negative `toY` (or positive `fromY`) in BarChart's `minY` and `maxY` calculations, #1470 * **BUGFIX** (by @bobatsar) Fix bars drawn outside of diagram * **FEATURE** (by @k0psutin) Add dashed border to BarChartRodData, #1144 +* **FEATURE** (by @imaNNeo) Allow to show single point line in LineChart, #1438 ## 0.64.0 * **BUGFIX** (by @Anas35) Fix Tooltip not displaying when value from BackgroundBarChartRodData is less than zero. #1345. diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index b4b133aee..08e21c21c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,5 +1,7 @@ PODS: - Flutter (1.0.0) + - package_info_plus (0.4.5): + - Flutter - path_provider_foundation (0.0.1): - Flutter - FlutterMacOS @@ -8,12 +10,15 @@ PODS: DEPENDENCIES: - Flutter (from `Flutter`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" url_launcher_ios: @@ -21,9 +26,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 - url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 + url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 36635bacc..42e492b50 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -32,4 +32,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/lib/src/chart/line_chart/line_chart_painter.dart b/lib/src/chart/line_chart/line_chart_painter.dart index 8623e56b4..75b4a60ec 100644 --- a/lib/src/chart/line_chart/line_chart_painter.dart +++ b/lib/src/chart/line_chart/line_chart_painter.dart @@ -489,6 +489,9 @@ class LineChartPainter extends AxisChartPainter { final y = getPixelY(barSpots[0].y, viewSize, holder); if (appendToPath == null) { path.moveTo(x, y); + if (size == 1) { + path.lineTo(x, y); + } } else { path.lineTo(x, y); } @@ -1299,6 +1302,7 @@ class LineIndexDrawingInfo { this.spotIndex, this.indicatorData, ); + final LineChartBarData line; final int lineIndex; final FlSpot spot;