.netCHARTING v10.5 Documentation
Example 


dotnetCHARTING Namespace > Chart Class : GetChartBitmap Method
GetChartBitmap Method
Obtains a System.Drawing.Bitmap of the generated chart.
Syntax
'Declaration
 
Public Function GetChartBitmap() As Bitmap
'Usage
 
Dim instance As Chart
Dim value As Bitmap
 
value = instance.GetChartBitmap()
public Bitmap GetChartBitmap()

Return Value

A System.Drawing.Bitmap of the chart.
Remarks
When invoked, the Element.Point properties of all elements drawn on the chart will be populated.
Example
//Get the bitmap and add a line to the image
Bitmap bmp = Chart.GetChartBitmap();
Graphics g = Graphics.FromImage(bmp);
g.DrawLine(Pens.Red,36,150,480,150);
g.DrawString("This is my line",new Font("Arial",12,FontStyle.Bold),new SolidBrush(Color.Black),new Point(40,150));
g.Dispose();
 
//Save the image and set the image path to ImageUrl.
string ImagePath = Chart.FileManager.SaveImage(bmp);
Image1.ImageUrl = ImagePath;
 
//For complete code see PostRenderDrawing.aspx sample
'Get the bitmap and add a line to the image
Dim bmp As Bitmap = Chart.GetChartBitmap()
Dim g As Graphics = Graphics.FromImage(bmp)
g.DrawLine(Pens.Red, 36, 150, 480, 150)
g.DrawString("This is my line", new Font("Arial", 12, FontStyle.Bold), new SolidBrush(Color.Black), new PointF(40F, 150F))
g.Dispose()
 
'Save the image and set the image path to ImageUrl.
Dim ImagePath As String = Chart.FileManager.SaveImage(bmp)
Image1.ImageUrl = ImagePath
 
'For complete code see PostRenderDrawing.aspx sample
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also