microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.02k stars 361 forks source link

Donut chart lables behind Donut #162

Closed edamreed closed 4 years ago

edamreed commented 4 years ago

If the labels are long enough, the text goes behind the Donut. image Is it possible for the text to be in front of the Donut?

eman1986 commented 4 years ago

I believe this bug was resolved with 0.9.0, please give that version a try and see if it resolves your issue.

blogcraft commented 2 years ago

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);
});