QUESTION
Can a chart image file be created without rendering the chart in the calling ASP.NET page?
ANSWER
Yes, you can even have .netCHARTING save and manage the removal of the files on your server. The easiest way to do this is shown below and works with all formats.
[C#]
Chart chart = new Chart(); [ .. set chart properties .. ] chart.ImageFormat = dotnetCHARTING.ImageFormat.Jpg;
string fileName = chart.FileManager.SaveImage(); |
[Visual Basic]
Dim chart As New Chart() [ .. set chart properties .. ] chart.ImageFormat = dotnetCHARTING.ImageFormat.Jpg;
Dim fileName As New String fileName = chart.FileManager.SaveImage() |
Getting Image Objects
Alternatively, if access to a bitmap or metafile object is required the following methods can be used to achieve the same.
ONLY FORMATS: Jpg, Png, Bmp, Tif
[C#]
Chart chart = new Chart(); [ .. set chart properties .. ] Bitmap bmp = chart.GetChartBitmap();
// Now the chart can be saved as a file on the server as well. string fileName = chart.FileManager.SaveImage(bmp); |
[Visual Basic]
Dim chart As New Chart() [ .. set chart properties .. ] Dim bmp As New Bitmap() bmp = chart.GetChartBitmap()
// Now the chart can be saved as a file on the server as well. Dim fileName As New String fileName = chart.FileManager.SaveImage(bmp) |
FORMATS: Emf, Swf, Pdf, Svg, Xaml
For these formats you can have .netCHARTING save and manage the files on your server.
[C#]
Chart chart = new Chart(); [ .. set chart properties .. ] chart.ImageFormat = ImageFormat.Swf; MemoryStream ms = chart.GetChartStream(); |
[Visual Basic]
Dim chart As New Chart() [ .. set chart properties .. ] chart.ImageFormat = ImageFormat.Swf; Dim ms As New MemoryStream() ms = chart.GetChartStream() |