79285099

Date: 2024-12-16 15:04:37
Score: 1
Natty:
Report link

If someone looking for the solution.

You need to wait the chart rendered its elements (like a bar).

I added a Thread.Sleep(1000) after the forced rendered and before to save the visual as png. And it work !

 chart.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
 chart.Arrange(new Rect(userControl.DesiredSize));
 Thread.Sleep(900);
 // and save as png

Many thanks to Gerry in comments !

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Flo