This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to find a good way to export/save the chart in the DB. What I tried to do is to read the chart into a MemoryStream, and then convert it to a Byte[] and save it. However, I'm having a few issues with this. I need to save it in different sizes so that the user can get a small/medium/large image later on.
Using this code:
However, if I set the height and width to something like 4000 px, I still get a stream back with the same size as if it was 400px. This seems very odd to me, as I would have expected it much bigger than before.
Also, when trying to read it back from DB, I'm unable to produce a image of the data I have for some reason.
How can I solve this?
I'm trying to find a good way to export/save the chart in the DB. What I tried to do is to read the chart into a MemoryStream, and then convert it to a Byte[] and save it. However, I'm having a few issues with this. I need to save it in different sizes so that the user can get a small/medium/large image later on.
Using this code:
Canvas c = new Canvas();LayoutRoot.Children.Remove(RadChart1);c.Children.Add(COGSChart);Canvas.SetTop(RadChart1, -1000);LayoutRoot.Children.Add(c);RadChart1.Height = 600;RadChart1.Width = 800;MemoryStream fileStream = new MemoryStream();RadChart1.ExportToImage(fileStream, new Telerik.Windows.Media.Imaging.PngBitmapEncoder());RadChart1.Height = Double.NaN;RadChart1.Width = Double.NaN;fileStream.Close();c.Children.Remove(RadChart1);LayoutRoot.Children.Remove(c);LayoutRoot.Children.Add(RadChart1);However, if I set the height and width to something like 4000 px, I still get a stream back with the same size as if it was 400px. This seems very odd to me, as I would have expected it much bigger than before.
Also, when trying to read it back from DB, I'm unable to produce a image of the data I have for some reason.
How can I solve this?