-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Issue: There seems to be a difference in the way legend size was calculated between 5.0.43 and 5.0.44 (onward) for pie charts at least. Some of the legend is getting cut off, where it used to not be cut off. Previously, the pie chart would shrink in size to accomodate all of the legend text, now the pie chart is bigger, but losing part of the legend. Screen shots below to show the difference, the sample code is from LinqPad


ScottPlot Version: 5.0.47
ScottPlot.Plot myPlot = new();
List<PieSlice> slices =
[
new PieSlice() { Value = 32, Label = "Category 1", LegendText = "Category 1: 32%"},
new PieSlice() { Value = 27, Label = "Category 2", LegendText = "Category 2: 27%"},
new PieSlice() { Value = 16, Label = "Category 3", LegendText = "Category 3: 16%"},
new PieSlice() { Value = 15, Label = "Category 4", LegendText = "Category 4: 15%"},
new PieSlice() { Value = 4, Label = "Category 5", LegendText = "Category 5: 4%"},
new PieSlice() { Value = 3, Label = "Category 6", LegendText = "Category 6: 3%"},
new PieSlice() { Value = 1, Label = "Category 7", LegendText = "Category 7: 1%"},
new PieSlice() { Value = 1, Label = "Category 8", LegendText = "Category 8: 1%"},
new PieSlice() { Value = 100, Label = "Category 9", LegendText = "Category 9: 100%"},
];
var pie = myPlot.Add.Pie(slices);
foreach (var s in pie.Slices)
{
s.LabelFontSize = 0;
}
pie.LineStyle.Width =1;
pie.LineStyle.Color = Color.FromHex("#000000");
myPlot.ScaleFactor=1;
pie.SliceLabelDistance = 1.2;
pie.ExplodeFraction = 0;
myPlot.Legend.Orientation = Orientation.Vertical;
myPlot.Legend.FontSize = Convert.ToSingle(10.667);
myPlot.Legend.Alignment = Alignment.UpperLeft;
myPlot.Legend.FontColor = Color.FromHex("#000000");
myPlot.Axes.Frameless();
myPlot.Layout.Frameless();
ScottPlot.Panels.LegendPanel pan = new(myPlot.Legend);
pan.Padding = new(0);
pan.Alignment = Alignment.MiddleCenter;
pan.Edge = Edge.Bottom;
myPlot.HideGrid();
myPlot.ShowLegend(pan.Edge);
var bitmap = myPlot.GetImageBytes(348, 300, ScottPlot.ImageFormat.Bmp);
Util.Image(bitmap).Dump();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels