Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a display exception occurs when the actual Gauge value is greater than the MaxValue #1799

Open
deakintsang opened this issue Feb 8, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@deakintsang
Copy link

Hi,
As shown in the picture, a display exception occurs when the actual Gauge value is greater than the MaxValue.

Image

Nuget: LiveChartsCore.SkiaSharpView.WPF

  • Version [2.0.0-rc5.1]
<lvc:PieChart
    Height="210"
    Grid.Row="1"
    InitialRotation="-90"
    MaxValue="30"
    Series="{Binding YieldRateSeries}" />
YieldRateSeries = GaugeGenerator.BuildSolidGauge(
    new GaugeItem(33, series =>
    {
        series.Fill = new SolidColorPaint(new SKColor(21, 101, 192));
        series.DataLabelsSize = 39;
        series.InnerRadius = 36;
        series.MaxRadialColumnWidth = 50;
    }),
new GaugeItem(GaugeItem.Background, series =>
{
    series.InnerRadius = 36;
    series.Fill = new SolidColorPaint(new SKColor(255, 255, 255, 11));
    series.MaxRadialColumnWidth = 50;
}));

Thanks in advance

@beto-rodriguez
Copy link
Owner

Hi

I am not completely sure if this is a bug, what is the result you expect from this?

@deakintsang
Copy link
Author

Hi

I am not completely sure if this is a bug, what is the result you expect from this?

I think the correct logic would be. If the sum of Values exceeds MaxValue, the Gauge uses MaxValue as the sum and allocates sectors proportionally. If MaxValue is not set, the Gauge is automatically resized based on the sum of Values.

Value is 33
The sum of Values is 33
MaxValue is 30
Value/ Values * MaxValue =Gauge percentage
33/33*30=30
As the picture shows, I think it should be 100%
Image

I give an example
There are 50, 80, and 120 sectors.
The sum of Values is 250, but MaxValue is set to 200.
The pie chart takes MaxValue as the sum and assigns the size of each sector proportionally:
First sector: 50/250 * 200 = 40
Second sector: 80/250 * 200 = 64
Third sector: 120/250 * 200 = 96
Pie charts sum to 200, not 250.

@beto-rodriguez beto-rodriguez added enhancement New feature or request and removed more info required labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants