-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Labels
BUGunexpected behaviorunexpected behavior
Description
Bug Report
Issue: A copy-pasted typo means that the rendering of RadarPlot and CoxcombPlot ignores the vertical space available, scaling only to the width.
Reproducing: Run the Cookbook demo (I used WPF), view a radar chart, and resize the height of window without varying the width. The size of the rendered plot won't change, and if the window becomes too short it will be clipped.
System Details
- ScottPlot Version: master branch
- Operating System: Windows 10
- Application Type: WPF but the bug is engine-independent
- .NET Version: Framework 4.8 but the bug is independent of this
Patch
I was going to make a pull request with the following patch:
diff --git a/src/ScottPlot4/ScottPlot/Plottable/CoxcombPlot.cs b/src/ScottPlot4/ScottPlot/Plottable/CoxcombPlot.cs
index ecd8403b..a381a9a5 100644
--- a/src/ScottPlot4/ScottPlot/Plottable/CoxcombPlot.cs
+++ b/src/ScottPlot4/ScottPlot/Plottable/CoxcombPlot.cs
@@ -96,7 +96,7 @@ namespace ScottPlot.Plottable
int numCategories = Normalized.Length;
PointF origin = new PointF(dims.GetPixelX(0), dims.GetPixelY(0));
double sweepAngle = 360f / numCategories;
- double maxRadiusPixels = new double[] { dims.PxPerUnitX, dims.PxPerUnitX }.Min();
+ double maxRadiusPixels = new double[] { dims.PxPerUnitX, dims.PxPerUnitY }.Min();
double maxDiameterPixels = maxRadiusPixels * 2;
diff --git a/src/ScottPlot4/ScottPlot/Plottable/RadarPlot.cs b/src/ScottPlot4/ScottPlot/Plottable/RadarPlot.cs
index 94a1187e..17b071ae 100644
--- a/src/ScottPlot4/ScottPlot/Plottable/RadarPlot.cs
+++ b/src/ScottPlot4/ScottPlot/Plottable/RadarPlot.cs
@@ -261,7 +261,7 @@ namespace ScottPlot.Plottable
int numGroups = Norm.GetUpperBound(0) + 1;
int numCategories = Norm.GetUpperBound(1) + 1;
double sweepAngle = 2 * Math.PI / numCategories;
- double minScale = new double[] { dims.PxPerUnitX, dims.PxPerUnitX }.Min();
+ double minScale = new double[] { dims.PxPerUnitX, dims.PxPerUnitY }.Min();
PointF origin = new PointF(dims.GetPixelX(0), dims.GetPixelY(0));
using (Graphics gfx = GDI.Graphics(bmp, dims, lowQuality))
diff --git a/src/ScottPlot4/ScottPlot/StarAxis.cs b/src/ScottPlot4/ScottPlot/StarAxis.cs
index 07d2ccd3..ea3a5faa 100644
--- a/src/ScottPlot4/ScottPlot/StarAxis.cs
+++ b/src/ScottPlot4/ScottPlot/StarAxis.cs
@@ -98,7 +98,7 @@ namespace ScottPlot
public void Render(PlotDimensions dims, Bitmap bmp, bool lowQuality = false)
{
double sweepAngle = 2 * Math.PI / NumberOfSpokes;
- double minScale = new double[] { dims.PxPerUnitX, dims.PxPerUnitX }.Min();
+ double minScale = new double[] { dims.PxPerUnitX, dims.PxPerUnitY }.Min();
PointF origin = new(dims.GetPixelX(0), dims.GetPixelY(0));
RenderRings(origin, minScale, sweepAngle);However, when I tested it I discovered that the plots seem rather small. I suspect that further changes are needed to RadarPlot.GetAxisLimits() and CoxcombPlot.GetAxisLimits(), but I'm not sure what the current hard-coded values are based on.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BUGunexpected behaviorunexpected behavior