This function accepts a .NET Bitmap object where the chart will render to. The following code will generate a .png file from the current chart displayed by the control:
C# |
Copy Code
|
---|---|
Bitmap bitmap = new Bitmap(200, 200, PixelFormat.Format24bppRgb); chartControl.ImageExporter.RenderToBitmap(bitmap, false); bitmap.Save("c:\\temp\\chartimage.png", ImageFormat.Png); |
Visual Basic |
Copy Code
|
---|---|
Dim bitmap As Bitmap = New Bitmap(200, 200, PixelFormat.Format24bppRgb) chartControl.ImageExporter.RenderToBitmap(bitmap, False) bitmap.Save("c:\temp\chartimage.png", ImageFormat.Png) |
The control will automatically render with proper dimensions (synchronized with the dimensions of the passed bitmap). When you pass true to the second parameter the control will render a grayscale image.