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] BarChart is not rendering well in integration with QuestPDF in asp.net #323

Open
ibrahimkais opened this issue Dec 1, 2022 · 2 comments
Labels

Comments

@ibrahimkais
Copy link

Describe the bug

I'm using microcharts with QuestPdf to generate PDF reports. I have a report that has a bar chart which doesn't reflect the entries with the value had been given and as you see in the attached screenshots it randomly renders the chart and it doesn't accurately reflects the bar value.

Which platform and version is this for?
aspnet webapi .net 6
Azure Kubernetes container

To Reproduce
the following is the BarChart object created

BarChart chart = new() { Entries = _model .GroupBy(item => item.ExpiryDate?.ToString("yyyy-MM") ?? default) .OrderBy(group => group.Key) .Select(group => new ChartEntry((group.Count() / _model.Count) * 100f) { Label = group.Key, ValueLabel = group.Count().ToString(), ValueLabelColor = SKColor.Parse("#000000"), TextColor = SKColor.Parse("#000000"), Color = SKColor.Parse($"#{rnd.Next(0x1000000):X6}") }), LabelColor = SKColor.Parse("#000000"), LabelTextSize = 10, LabelOrientation = Orientation.Vertical, ValueLabelOrientation = Orientation.Horizontal, BarAreaAlpha = 60, MaxValue = 100, IsAnimated = false, Typeface = SKTypeface.FromFamilyName("Arial"), Margin = 10, };

Steps to reproduce the behavior:

  1. create an aspnet webapi .net 6 application
  2. install the following references
    • HarfBuzzSharp.NativeAssets.Linux Version="2.8.2.3"
    • Microcharts Version="0.9.5.9"
    • QuestPDF Version="2022.11.0"
    • SkiaSharp Version="2.88.3"
    • SkiaSharp.NativeAssets.Linux.NoDependencies Version="2.88.3"
  3. try to create the invoice sample from QuestPDF
  4. as in QuestPDF documentation, try to use the above BarChart object with the invoice sample
  5. Run the application and view the report

Expected behavior
Of course the expected behavior is finding the BarChart reflects the appropriate bar heights based on the given values.

Screenshots
First Example
image
image

image
image

** Device**
OS:
Edition Windows 11 Pro
Version 22H2
OS build 22621.900
Experience Windows Feature Experience Pack 1000.22638.1000.0

I'm using Adobe Acrobat to view the generated PDF files

@shelbaz

@ibrahimkais ibrahimkais added the bug label Dec 1, 2022
@ibrahimkais ibrahimkais changed the title [Bug] [Bug] BarChart is not rendering well in integration with QuestPDF in asp.net Dec 1, 2022
@TheObliterator
Copy link

Did you find any resolution to this?
I think I have a similar problem using the radial gauge in QuestPDF in a linux docker container.
For me the very first render is incorrect, but subsequent renders seem ok. I suspect the bars are being animated despite animation being disabled. I'll update if I find anything further.

@TheObliterator
Copy link

I found a fix relating to animation in microcharts which I suspect will resolve my issue.
Could it be relevant to your scenario?
#300

Note: That fix is only in the v1.x branch so for now I'm adding a short delay in my render to workaround the animation issue.

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