Version

Save a Chart Image

This topic describes how to use the SaveTo method of the element to save an image of the chart in its current state.

  1. The SaveTo method can be used to save the chart’s image to a file or to a stream. To save to a file, a path and an image format needs to be specified. The following line of code saves the cart to a JPEG image file:

In Visual Basic:

Me.UltraChart1.SaveTo("chart.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

In C#:

this.UltraChart1.SaveTo("chart.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
  1. The chart’s binary image data can also be saved to stream. In this case, the stream and the image format will need to be specified.

In Visual Basic:

Me.UltraChart1.SaveTo(stream, System.Drawing.Imaging.ImageFormat.Jpeg)

In C#:

this.UltraChart1.SaveTo(stream, System.Drawing.Imaging.ImageFormat.Jpeg);