views:

603

answers:

3

I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page.

Is there a way to get and save this chart as an image output on runtime?

+1  A: 

Sure. Ultimately the image comes from a URL of some sort. Do a view-source on the web page and see what that URL looks like. With a certain amount of reverse-engineering, usage of System.Web.UI.HtmlTextWriter, perhaps an HttpHandler, etc. you should be able to get what you want.

xanadont
A: 

Use the ExportToImage method of the ChartControl object .. This is WinForm code, but the same concept should hold true for WebChartControl:

    Dim chart As ChartControl = ChartControl1.Clone()
    chart.Size = New Size(800, 600)
    chart.ExportToImage("file.png", System.Drawing.Imaging.ImageFormat.Png)
A: 

The best solution for exporting an image from a Developer Express chart control (web) is:

((IChartContainer)[Your web chart control]).Chart.ExportToImage([Your file name], ImageFormat.Png);

Martin Bell