Version

Saving a Chart to an Image

Topic Overview

Purpose

This topic demonstrates the usage of the SaveTo method of the UltraDataChart.

Required Background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic provides a general overview of the UltraDataChart control

This topic provides information on how to get started with the UltraDataChart control.

This topic provides information on requirements of Series objects in the UltraDataChart control.

In this topic

This topic contains the following sections:

Configuring Feature

Overview

The SaveTo method of the UltraDataChart can be used to render the chart’s image to a file or a stream.

Code Example

The following are code snippets demonstrating how to use the SaveTo functionality of the UltraDataChart.

To save to a file, a path and an image format need to be specified. The following line of code saves the chart to a JPEG image file:

In C#:

this.ultraDataChart1.SaveTo("chart.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);

In Visual Basic:

Me.UltraDataChart1.SaveTo("chart.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)

The chart’s binary image data can also be saved to a stream. In this case, the stream and the image format must be specified:

In C#:

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

In Visual Basic:

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

Related Content

The following topics provide additional information related to this topic:

Topic Purpose

This topic provides a general overview of the UltraDataChart .

This topic provides information on how to get started with the UltraDataChart .

This topic provides information on requirements of Series objects in the UltraDataChart .