-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!
Description
Thanks daddydavid from the Discord (#1966) for pointing this out!
Reproducing
for (int i = 1; i < 6; i++)
MakeGaugePlot(i);void MakeGaugePlot(int gaugeCount)
{
double[] data = Enumerable.Range(0, gaugeCount)
.Select(x => (double)Random.Shared.Next(10, 100))
.ToArray();
ScottPlot.Plot myPlot = new(200, 200);
myPlot.AddRadialGauge(data);
myPlot.SaveFig($"test-{gaugeCount}.png");
}Relevant Code
I think the problem could be improved by adding some custom logic here to shrink radiusPx for cases with 1, 2, or 3 gauges.
ScottPlot/src/ScottPlot4/ScottPlot/Plottable/RadialGaugePlot.cs
Lines 274 to 311 in 181be95
| int index; | |
| int position; | |
| for (int i = 0; i < GaugeCount; i++) | |
| { | |
| if (GaugeMode == RadialGaugeMode.SingleGauge) | |
| { | |
| index = GaugeCount - i - 1; | |
| position = GaugeCount; | |
| } | |
| else | |
| { | |
| index = i; | |
| position = OrderInsideOut ? i + 1 : (GaugeCount - i); | |
| } | |
| RadialGauge gauge = new() | |
| { | |
| MaximumSizeAngle = MaximumAngle, | |
| StartAngle = startAngles[index], | |
| SweepAngle = sweepAngles[index], | |
| Color = Colors[index], | |
| BackgroundColor = Color.FromArgb(backgroundAlpha, Colors[index]), | |
| Width = gaugeWidthPx, | |
| CircularBackground = CircularBackground, | |
| Clockwise = Clockwise, | |
| BackStartAngle = StartingAngleBackGauges, | |
| StartCap = StartCap, | |
| EndCap = EndCap, | |
| Mode = GaugeMode, | |
| Font = Font, | |
| FontSizeFraction = FontSizeFraction, | |
| Label = Levels[index].ToString(LevelTextFormat), | |
| LabelPositionFraction = LabelPositionFraction, | |
| ShowLabels = ShowLevels, | |
| }; | |
| float radiusPx = position * radiusPixels; | |
| gauge.Render(gfx, dims, centerPixel, radiusPx); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Help WantedScott won't do this soon, but PRs from the community are welcome!Scott won't do this soon, but PRs from the community are welcome!




