Skip to content

coxcomb positon of inital slice moves depending on total number of slices #4304

@johndoh

Description

@johndoh

Issue:

The position of the first slice on a coxcomb chart moves depending on the number of slices in the chart. Even if the Rotation property is set to 0. This is different to the pie chart where the first slice is always in the same place.

# Pie Coxcomb
3 pie3 coxcomb3
4 pie4 coxcomb4
5 pie5 coxcomb5

Expected behavior: the position of the first slice is always in the same page.

ScottPlot Version: 5.0.39

Code Sample:

double[] values = { 5, 2, 8, 4, 8 };
for (int j = 3; j <= 5; j++)
{
    ScottPlot.Plot myPlot1 = new();
    myPlot1.Add.Pie(values.Take(j));
    myPlot1.SavePng("pie" + j + ".png", 400, 300);

    ScottPlot.Plot myPlot2 = new();
    myPlot2.Add.Coxcomb(values.Take(j));
    myPlot2.SavePng("coxcomb" + j + ".png", 400, 300);
}

I think the problem might be the first canvas rotation is done twice:

rp.Canvas.RotateDegrees(startAngle);
for (int i = 0; i < Slices.Count; i++)
{
rp.Canvas.RotateDegrees(rotationPerSlice);

so moving line 55 to the end of the for block might fix it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions