Gauge Chart
Updated code from https://github.com/imaNNeo/fl_chart/pull/1424
The implementation of the gauge chart (discussed here https://github.com/imaNNeo/fl_chart/issues/199)
Can you please rebase the branch?
It should be OK, I also removed files not concerned by this PR
Codecov Report
:x: Patch coverage is 99.63235% with 1 line in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 92.99%. Comparing base (9e51b11) to head (701d369).
:warning: Report is 4 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| lib/src/chart/gauge_chart/gauge_chart_data.dart | 99.03% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1933 +/- ##
==========================================
+ Coverage 92.44% 92.99% +0.54%
==========================================
Files 50 54 +4
Lines 3681 3984 +303
==========================================
+ Hits 3403 3705 +302
- Misses 278 279 +1
| Flag | Coverage Δ | |
|---|---|---|
| flutter | 92.99% <99.63%> (+0.54%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Okay, now I found a little bit of time to take a look at this one. Here I have some concerns, please have a look:
I tried to pass only one color to the VariableGaugeColor, it crashed, and after more investigation, I realized we also have a SimpleGaugeColor
So I think we can just have a single class (no abstraction) for this case and if the colors list has only one color, it's a simple drawing color, but if it has multiple colors, it is a variable color. So we can calculate the limits under the hood by dividing the whole space by the number of colors. Or user can provide a custom limits property with the customized numbers. In this way, we should throw an exception if the limits length is not equals to the colors length. (Just like other places that we have gradients and stops)
valueColor: VariableGaugeColor(
colors: [
AppColors.contentColorYellow,
],
limits: [],
),
Or if you want to keep the abstraction, please let me know what other types of GaugeColor we can have?
(In this case, I still think that our VariableGaugeColor should be able to work with a single color)
As I see, when we have a VariableGaugeColor, it draws the stop points as a circular indicator.
How can I disable/customize them?
Because in the beginning, I found them odd here.
I also have a suggestion for the startAngle and endAngle properties (because they are difficult to set)
I suggest having something like startDegreeOffset (just like what we have in the PieChart that is 0 by default -> start from right center), then we can have direction that can be clockwise and counter-clockwise (I'm not sure if we already have a data structure for this one or not). Then we can have a sweepAngle or sweepDegrees that determines the lengths of the arc. I think it's more similar to how our PieChart works (because of startDegreeOffset) and I think it is easier to work (from the developer's perspective).
Please let me know your thoughts