Skip to content

Legend: improve support for labels with line breaks #3649

@aespitia

Description

@aespitia

Issue: If you make a chart with a line break in the label, the legend renders it as an unknown character

ScottPlot Version: 5.0.25

ScottPlot.Plot myPlot = new();

List<PieSlice> slices = new()
{
	new PieSlice() { Value = 5, FillColor = Colors.Red, Label = "Red has long\ntitle here" },
	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" },
	new PieSlice() { Value = 8, FillColor = Colors.Blue, Label = "Blue" },
};

var pie = myPlot.Add.Pie(slices);
pie.ExplodeFraction = .1;

myPlot.ShowLegend();

myPlot.SavePng("demo.png", 400, 300);

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions