-
Notifications
You must be signed in to change notification settings - Fork 981
Closed
Description
Issue: It looks like looping through legend items to update the marker style from the default to another markerstyle doesn't work. From looking at the code it also looks like some plot types set a default marker to a filled circle, but the current implementation ignores it.
ScottPlot Version: 5.0.55
Code Sample:
ScottPlot.Plot myPlot = new();
List<PieSlice> slices =
[
new PieSlice() { Value = 5, FillColor = Colors.Red, Label = "Red", LegendText = "R" },
new PieSlice() { Value = 2, FillColor = Colors.Orange, Label = "Orange" },
new PieSlice() { Value = 8, FillColor = Colors.Gold, Label = "Yellow" },
new PieSlice() { Value = 4, FillColor = Colors.Green, Label = "Green", LegendText = "G" },
new PieSlice() { Value = 8, FillColor = Colors.Blue, Label = "Blue", LegendText = "B" },
];
var pie = myPlot.Add.Pie(slices);
pie.ExplodeFraction = .1;
pie.SliceLabelDistance = 1.4;
var legitems = myPlot.Legend.GetItems();
foreach (var item in legitems)
{
item.LabelText = item.LabelText + "-modified";
item.MarkerStyle.Shape = MarkerShape.FilledCircle;
item.MarkerShape = MarkerShape.FilledCircle;
item.MarkerColor = item.FillColor;
item.MarkerSize = 20;
/*
myPlot.Legend.ManualItems.Add(new LegendItem()
{
LabelText = item.LabelText,
LabelFontName = item.LabelFontName,
LabelFontSize = item.LabelFontSize,
LabelFontColor = item.LabelFontColor,
MarkerShape = MarkerShape.FilledCircle,
MarkerColor = item.LineColor,
MarkerSize = 10
});
*/
}
myPlot.ShowLegend();
myPlot.Axes.Frameless();
myPlot.HideGrid();
var bitmap = myPlot.GetImageBytes(400, 300);
Util.Image(bitmap).Dump();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels