SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and iOS Chart & Android Chart Components



I’m trying to export my graphs using the XamlRenderSurface and the ExportToXPS extension function.

I can export a BitmapImage from it fine but the xps image only has the Axis lines and a vertical annotation on it. See images for comparison.

Also, it outright crashes in some other graphs I have on Get MinorDelta because of a null reference exception, no additional info is given out by DebugWhySciCharDoesntRender = true. Likewise in this case, I can export to bitmap just fine. I am using custom tick providers.

I should also note that I’m rendering the charts from memory they’re not visually displayed when export them.

  • You must to post comments

Hi Kewur,

SciChartSurface.ExportToXps(string filePath) internally calls SciChartSurface.ExportToFile(filePath, ExportType.Xps, true).

The signature for ExportToFile is

    /// <summary>
    /// Saves snapshot of current <see cref="SciChartSurfaceBase"/> to file
    /// </summary>
    /// <param name="fileName">The Filename to save to</param>
    /// <param name="exportType">Defines format of file to export</param>
    /// <param name="useXamlRenderSurface">Defines better quality of export output</param>
    public virtual void ExportToFile(string fileName, ExportType exportType, bool useXamlRenderSurface) { } 

If the parameter useXamlRenderSurface is TRUE (it is, from ExportToXps) then SciChart uses the XamlRenderSurface intenrally.

I checked and your license type (SciChart WPF 2D Pro) does not include a license for this feature. The XamlRenderSurface is only available in SciChart WPF 2D Enterprise or SciChart WPF SDK Professional.

Can you try this code instead?

 string fileName;
 sciChartSurface.ExportToFile(filename, ExportType.Xps, false);

If you still experience problems, please submit a support ticket including code to reproduce the issue. We will investigate.

Best regards,

  • kewur
    Hi Andrew, I requested an extension to my trial for enterprise to test the xps exports. I tried with the alternative but it produces the same result as before. I will try to make a project reproducing the issue.
  • Andrew
    You can check trial is applied correctly by setting SciChartSurface.RenderSurface = new XamlRenderSurface(). If the chart in your app goes blank, then its not applied.
  • kewur
    Yes it is applied, just tested it.
  • Andrew
    Thanks for checking! Please send some code over, we will investigate asap.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

SciChart WPF v6 BETA released! Note pricing/licensing changes are coming. Contact us to beat the rise!Read more