We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Any way to get a chart showing in an HTML document?

I am using the Webbrowser control to render an HTML document. I want to have a chart to be shown in the document. Anyone have any suggestions? TIA

2 Replies

Daniel Jebaraj September 7, 2004 05:57 PM UTC

Hi, You can save the chart to a temp file on disk (using Draw(Image img))and use the file:/// URL format to display the file. Sample code to save a chart to image is given below.
private void btnSaveToImage_Click(object sender, System.EventArgs e)
		{
			Image bitmap = new Bitmap(this.chartControl1.Width, this.chartControl1.Height);
			this.chartControl1.Draw(bitmap);
			bitmap.Save(@"c:\temp\chart_image.png", ImageFormat.Png);
			bitmap.Dispose();
		}
Best regards, Daniel >I am using the Webbrowser control to render an HTML document. I want to have a chart to be shown in the document. > >Anyone have any suggestions? > >TIA

Administrator September 7, 2004 07:14 PM UTC

Thanks Daniel, I''ll give it a try. >Hi, > >You can save the chart to a temp file on disk (using Draw(Image img))and use the file:/// URL format to display the file. > >Sample code to save a chart to image is given below. > >
>private void btnSaveToImage_Click(object sender, System.EventArgs e)
>		{
>			Image bitmap = new Bitmap(this.chartControl1.Width, this.chartControl1.Height);
>			this.chartControl1.Draw(bitmap);
>			bitmap.Save(@"c:\temp\chart_image.png", ImageFormat.Png);
>			bitmap.Dispose();
>		}
>
> > >Best regards, >Daniel > >>I am using the Webbrowser control to render an HTML document. I want to have a chart to be shown in the document. >> >>Anyone have any suggestions? >> >>TIA
Loader.
Live Chat Icon For mobile
Up arrow icon