Profile Picture

Exception while saving chart into stream

Posted By Naveen Anne 11 Years Ago
Author
Message
Naveen Anne
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 10
Hi There,

I'm getting the following exception while converting my graph into stream.

"The Chart document is not connected to a view."

Below is the code I've used to do that
MemoryStream memStream = new MemoryStream();
NChartControl1.ImageExporter.SaveToStream(memStream,new NJpegImageFormat());

Please let me know how to resolve this issue.

Thanks,
Naveen Anne.

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Naveen,

You have to specify size/resolution of the generated image in case the chart document is not connected to a view and cannot obtain those parameters from there - the following code shows how to generate a 300x300 image with screen resolution (96dpi):

MemoryStream memStream = new MemoryStream();

nChartControl.ImageExporter.SaveToStream(memStream, new NSize(300, 300), new NResolution(96, 96), new NJpegImageFormat());



Best Regards,
Nevron Support Team



Naveen Anne
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)Junior Member (12 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 13, Visits: 10
Hi,

That works gr8 thx for that.

Naveen Anne.



Similar Topics


Reading This Topic