Microcharts icon indicating copy to clipboard operation
Microcharts copied to clipboard

[Bug] Donut and pie chart renders outside the canvas.

Open blogcraft opened this issue 2 years ago • 1 comments

Describe the bug I am doing a PDF Web API with Quest PDF. When I try to create a Donut (or pie) chart on the canvas it renders bad.

Which platform and version is this for? example: .NET 6 Web API With Quest PDF

image

I am testing with version 0.9.5.9 and this is how it renders: image

(The green Background is to show the canvas)
I'm using QuestPDF to render the canvas.

 var entries = new[]
{
    new ChartEntry(212)
    {
        Label = "UWP",
        ValueLabel = "112",
        Color = SKColor.Parse("#2c3e50")
    },
    new ChartEntry(248)
    {
        Label = "Android",
        ValueLabel = "648",
        Color = SKColor.Parse("#77d065")
    },
    new ChartEntry(128)
    {
        Label = "iOS",
        ValueLabel = "428",
        Color = SKColor.Parse("#b455b6")
    },
    new ChartEntry(514)
    {
        Label = "Forms",
        ValueLabel = "214",
        Color = SKColor.Parse("#3498db")
    }
};

...

.Canvas((canvas, size) =>
{
    var chart = new DonutChart
    {
        Entries = entries,
        IsAnimated = false,
    };

    chart.DrawContent(canvas, (int)size.Width, (int)size.Height);
});

blogcraft avatar Jun 13 '22 02:06 blogcraft

Also, the chart is upside down, its starting to draw the segments at 6 o'clock instead 12.

blogcraft avatar Jun 15 '22 02:06 blogcraft