Export NChartControl to BitMap or Any Type of Image


Author
Message
Teddy Lambropoulos
Teddy Lambropoulos
Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)Junior Member (20 reputation)
Group: Forum Members
Posts: 20, Visits: 1

Hi,

Is there a way I can take an NChartControl and export it to a BitMap or any sort of image file?

Thank you,

Teddy


Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Teddy,

Yes the both the WinForm and WebForms controls can be used to dynamically generate an image, without being added to a form. The following code shows how to create a simple bar chart and render it as 400x300 png image:

using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.Chart.WinForm;

...

using (NChartControl chartControl = new NChartControl())
{
 // configure chart
 NChart chart = chartControl.Charts[0];

 NBarSeries bar = new NBarSeries();
 bar.Values.Add(10);
 bar.Values.Add(20);
 bar.Values.Add(30);

 chart.Series.Add(bar);
 
 chartControl.ImageExporter.SaveToFile("c:\\temp\\test.png", new NSize(400, 300), NResolution.ScreenResolution, new NPngImageFormat());
}

the control supports JPEG, PNG, BITMAP, TIFF, GIF, Flash, Silverlight and PDF output. You can also save images in memory streams - just use the SaveToStream method of the image exporter.

Hope this helps - questions or comments - please feel free...

 



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search