Skip to content

feat: Add Gauge Chart#1933

Merged
imaNNeo merged 25 commits into
imaNNeo:mainfrom
glemartret:main
Apr 29, 2026
Merged

feat: Add Gauge Chart#1933
imaNNeo merged 25 commits into
imaNNeo:mainfrom
glemartret:main

Conversation

@glemartret

@glemartret glemartret commented May 15, 2025

Copy link
Copy Markdown
Contributor

Updated code from #1424 (credits to @FlorianArnould)

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

@imaNNeo

imaNNeo commented Aug 21, 2025

Copy link
Copy Markdown
Owner

Can you please rebase the branch?

@glemartret

Copy link
Copy Markdown
Contributor Author

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

@codecov

codecov Bot commented Aug 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.98%. Comparing base (15562ee) to head (5db8e81).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1933      +/-   ##
==========================================
+ Coverage   93.07%   93.98%   +0.90%     
==========================================
  Files          50       54       +4     
  Lines        3956     4553     +597     
==========================================
+ Hits         3682     4279     +597     
  Misses        274      274              
Flag Coverage Δ
flutter 93.98% <100.00%> (+0.90%) ⬆️

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

imaNNeo commented Aug 31, 2025

Copy link
Copy Markdown
Owner

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

imaNNeo commented Aug 31, 2025

Copy link
Copy Markdown
Owner

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

imaNNeo commented Aug 31, 2025

Copy link
Copy Markdown
Owner

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

@rsnider19

Copy link
Copy Markdown

any updates on this? I'd love to move off of syncfusion

@glemartret

Copy link
Copy Markdown
Contributor Author

@imaNNeo I’ve rebased and updated the PR following your feedback.

Comment thread example/lib/presentation/samples/gauge/gauge_chart_sample3.dart Outdated
Comment thread lib/src/chart/gauge_chart/gauge_chart_painter.dart Outdated
Comment thread lib/src/chart/gauge_chart/gauge_chart_data.dart Outdated
Comment thread lib/src/chart/gauge_chart/gauge_chart_data.dart Outdated
Comment thread lib/src/chart/gauge_chart/gauge_chart_data.dart Outdated
@imaNNeo

imaNNeo commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Hi there, I just wrote some comments.
Please have a look.

As it is a new chart type, I would like to put more time/effort into it to ensure it is future-compatible and that we won't have breaking changes. That's why I'm a bit strict about it.
And just to mention that I have some free time these days. If you think you don't have enough time to put this effort, I can take over and continue your branch. (You already did a lot of things).

Just let me know what works better for you.

@glemartret

Copy link
Copy Markdown
Contributor Author

Hey, no problem, I won't be able to work on it at least today, maybe tomorrow or in the week end.
Feel free to update it if you want, I'm not the original author of this new chart type, I've just updated it to work with new version of your package as the original PR wasn't

@imaNNeo

imaNNeo commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Alright, so I would like to continue your work and do the final improvement.
Because I have a limited free time now, so I can fully focus on it.

@imaNNeo imaNNeo changed the title Gauge Chart feat: Add Gauge Chart Apr 21, 2026
@imaNNeo

imaNNeo commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Alright, we're almost done, here are 4 samples that we have created:

Sample1 Sample2
Screen.Recording.2026-04-21.at.13.51.47.mov
Screen.Recording.2026-04-21.at.13.52.38.mov
Sample3 Sample4
Screen.Recording.2026-04-21.at.13.53.12.mov
Screen.Recording.2026-04-21.at.13.56.06.mov

@imaNNeo imaNNeo merged commit d7bf644 into imaNNeo:main Apr 29, 2026
5 checks passed
@imaNNeo

imaNNeo commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Thanks @glemartret and @FlorianArnould

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.

3 participants