Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] - PieChart not centered #348

Open
elenaaralla opened this issue Dec 14, 2023 · 1 comment
Open

[Bug] - PieChart not centered #348

elenaaralla opened this issue Dec 14, 2023 · 1 comment
Labels

Comments

@elenaaralla
Copy link

elenaaralla commented Dec 14, 2023

I'm trying to generate a PieChart on a pdf (ped generated with QuestPDF) , but the pie is not centered in canvas.
I expected that the pie was positioned at the center of canvas and that the color of label was the same color used for Pie, not black

I'm using
Microchart 0.9.5.9
OS: Windows 10 Pro

this is the code:

var pieEntries = new[]
{
    new ChartEntry(80000)
    {
        Label = "Costi",
        ValueLabel = "80.660,72",
        Color = SKColor.Parse("#f67019")
    },
    new ChartEntry(208000)
    {
        Label = "Ricavi",
        ValueLabel = "208.372,83",
        Color = SKColor.Parse("#4dc9f6")
    }
};

...

  .Item()
  .Border(1)
  .ExtendHorizontal()
  .Height(300)
  .Canvas((canvas, size) =>
  {
      var chart = new PieChart
      {
          Entries = pieEntries,
          IsAnimated = false,
      };
      chart.DrawContent(canvas, (int)size.Width, (int)size.Height);
  });

and this is a screenshot:

Schermata 2023-12-14 alle 12 50 57

Thank you,
Elena

@csgsoftwaredev
Copy link

Looking through the other questions, I found that .Draw() works instead of .DrawContent(). I used QuestPdf for instruction and they use the .DrawContent() so I didn't think to use .Draw()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants