As part of my application I am storing some meta-data on the server. That meta-data needs to contain a chart.
I have a user control that contains all of the logic of the chart, which the user can see at any time just by clicking a button.
I'm trying to generate the same chart and export it to a PNG even if the chart isn't visible
/// Send a chart image when asked
public byte MakeChartImage()
chart.Arrange(new Rect(new Point(0, 0), new Size(1024, 768)));
var stream = new MemoryStream();
chart.ExportToImage(stream, new PngBitmapEncoder());
I'm using MEF and MVVM, so the cart gets a message that there is new chart data, does a Rebind, then
raises an event to let the calling app know its safe to call the above method.
The chart I get is devoid of all bound data (see attachment).
How do you force the chart to render despite it not being visible?
I've also included a chart as it looks when the user views it.