Acces to chart Image without previously saving it RRS feed

  • Question

  • Hello,

    I need to operate with some chart images several times and I am trying to speed up the process. Now I use .saveImage method and then call it again to, for example, a picture box. Is there any way to acces to displayed image directly without saving it? like an internal path??

    now I use,


    , ChartImageFormat.Gif)

    PictureBox1.Image = Image.FromFile(imagePath


    and should be done directly, like

    PictureBox1.Image = Image.FromFile(*Chart1.CurrentImage*)


    Thursday, October 21, 2010 6:29 PM

All replies

  • Hi,

    Try something like this:

    	' Create a memory stream to save the chart image
    	Dim stream As New System.IO.MemoryStream()
    	' Save the chart image to the stream
    	Chart1.SaveImage(stream, System.Drawing.Imaging.ImageFormat.Bmp)
    	' Create a bitmap using the stream
    	Dim bmp As New Bitmap(stream)
    	PictureBox1.Image = bmp

    This is straight from the Samples Environment, under Contents > Chart Features > Serialization > Saving and Copying Images

    Friday, October 22, 2010 9:23 AM
  • Hi Sipla,

    Thank you for your answer, I really thought that was the solution but I said picturebox as an example and works with it but once I tried to use it in my third party libraries, required method only accept image file as input parameter, not a memory stream :(

    Is chart displayed image saved somewhere on the hard disk?

    Saturday, October 23, 2010 4:14 PM
  • Windows Forms Charting does not automatically save the charts on the hard disk. You'll have to call Chart.SaveImage for that. (In Web Charting, you can specify how the images are handled in the Web.config file for example.)

    Monday, October 25, 2010 9:08 AM