Skip to content

pie chart problem with overlapping labels #2151

@RorellanaR

Description

@RorellanaR

I'm creating a pie chart for a document using QuestPDF. The problem is that I'm displaying percentages in this chart, and the issue arises when there's a very high percentage; the other percentages get grouped together and overlap each other. I've tried separating them by adding or removing lines, but the small values ​​aren't displayed correctly.

`private static PlotModel CreatePieChart(string titulo, PieSlice[] data)
{
var model = new PlotModel
{
Title = titulo,
DefaultFont = "SourceSansPro",
TitleFont = "SourceSansPro",
SubtitleFont = "SourceSansPro",
DefaultFontSize = 8,
TitleFontSize = 8,
SubtitleFontSize = 8,
TextColor = OxyColor.Parse("#231f20"),
};

PieSeries? ps = new()
{
    StrokeThickness = .25,
    InsideLabelPosition = .25,
    AngleSpan = 360,
    StartAngle = 20,
    Font = "SourceSansPro",
    FontSize = 8,
    TextColor = OxyColor.Parse("#231f20"),
    TickRadialLength = 10,
    TickHorizontalLength = 15,
    InsideLabelFormat = "",
    OutsideLabelFormat = "{2:#0.00}%",
    TickLabelDistance = 5,
    InnerDiameter = 0.6,
};

foreach (var item in data)
{
    ps.Slices.Add(item);
}
model.Series.Add(ps);
return model;

}`

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions