Skip to content

Conversation

@glemartret
Copy link

Updated code from #1424

The implementation of the gauge chart (discussed here #199)

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 21, 2025

Can you please rebase the branch?

@glemartret glemartret reopened this Aug 21, 2025
@glemartret
Copy link
Author

It should be OK, I also removed files not concerned by this PR

@codecov
Copy link

codecov bot commented Aug 24, 2025

Codecov Report

❌ Patch coverage is 99.63235% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.99%. Comparing base (9e51b11) to head (701d369).
⚠️ 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 ⚠️
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%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 31, 2025

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)

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 31, 2025

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.

image

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 31, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants