Nevron Open Vision Documentation
Chart / Export / Image Export
In This Topic
    Image Export
    In This Topic

    Nevron NOV Chart for .NET has support for image generation in various raster image formats including PNG, JPEG, Bitmap and GIF. The image export functionality of the control is exposed from the NChartImageExporter class.


     Exporting an Image to a File

    In order to export the chart image as a raster image file you need to create an instance of the NChartImageExporter class and call its SaveToFile method:

    Copy Code

    NChartImageExporter chartImageExporter = new NChartImageExporter(chartView.Document);

    chartImageExporter.SaveToFile("c:\\ChartImage.png", NImageFormat.Png, new NSize(400, 300), 96.0);

    This code will create a PNG file named "ChartImage.png" with dimensions of 400x300 pixels at typical screen resolution.

    If you wish to embed the raster image in a PDF file or use it for printing purposes it is recommended to use higher resolution output - 300dpi and above.
     Exporting an Image to a Stream

    Exporting the chart as an image to a stream is done with the help of the SaveToStream method. This method takes the same number of arguments as SaveToFile except that it renders the chart image to a stream. This feature can be useful when you wish to generate images in memory instead of saving them to the disc. The following code snippet shows how to obtain a byte array holding a png image in memory:

    Copy Code

    MemoryStream stream = new MemoryStream();
    NImageFormat.Png, new NSize(400, 300), 96.0);

    // image bytes holds the raster image
    byte[] imageBytes = stream.ToArray();


    See Also