Legend loses it's orientation when added as a panel
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- data-visualization
Research direction
Start with the code sample using ScottPlot.Panels.LegendPanel, myPlot.Legend, and myPlot.ShowLegend(pan.Edge), focusing on how the legend is transferred into the panel. Reproduce the sample with ScottPlot 5.1.59 and verify that setting Orientation to Vertical before adding the panel remains effective in the saved PNG.
Written by the indexing model from the issue text.
Description
Issue:
ScottPlot Version: 5.1.59
Code Sample:
ScottPlot.Plot myPlot = new();
PieSlice slice1 = new() { Value = 5, FillColor = Colors.Red, Label = "alpha", LegendText = "alpha" };
PieSlice slice2 = new() { Value = 2, FillColor = Colors.Orange, Label = "beta", LegendText = "beta" };
PieSlice slice3 = new() { Value = 8, FillColor = Colors.Gold, Label = "gamma", LegendText = "gamma" };
PieSlice slice4 = new() { Value = 4, FillColor = Colors.Green, Label = "delta", LegendText = "delta" };
PieSlice slice5 = new() { Value = 8, FillColor = Colors.Blue, Label = "epsilon", LegendText = "epsilon" };
List<PieSlice> slices = new() { slice1, slice2, slice3, slice4, slice5 };
myPlot.ShowLegend();
// setup the pie to display slice labels
var pie = myPlot.Add.Pie(slices);
pie.SliceLabelDistance = 1.3;
// hide unnecessary plot components
myPlot.Axes.Frameless();
myPlot.HideGrid();
myPlot.Legend.OutlineStyle = ScottPlot.LineStyle.None;
myPlot.Legend.ShadowColor = Colors.Transparent;
//if you change orientation before adding to panel, it loses it and defaults to horizontal
myPlot.Legend.Orientation = Orientation.Vertical;
ScottPlot.Panels.LegendPanel pan = new(myPlot.Legend);
pan.Alignment = Alignment.MiddleCenter;
pan.Edge = Edge.Bottom;
myPlot.ShowLegend(pan.Edge);
//if you change it after adding the legend panel, it's ok, but i don't know if there are other settings that get lost too
//myPlot.Legend.Orientation = Orientation.Vertical;
myPlot.SavePng("bug.png");
This shows horizontal legend, even though i defined vertical above
- Dominant language
- C#
- Stars
- 6.8k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ScottPlot/ScottPlot
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
All issues in ScottPlot/ScottPlot
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·