We have previously only dealt with 2D graphs in our application.
Recently we decided to add the ability to plot 3D graphs.
The feature that we used to use to print the charts to an image file (BMP, JPG, PNG) calls the chart.DrawToBitmap() method.
This does not appear to work when the graph I have in the control is in 3D.
Is there another way to save a 3D chart to an image file?
I am currently using the April 19 2011 release of TeeChart 2010 so it is as up to date as I can get.
Thanks for any information you can provide regarding this subject.
Aaron Peronto
Siemens Energy, Inc.
3D Graph Draw to Bitmap
-
- Newbie
- Posts: 8
- Joined: Wed Oct 21, 2009 12:00 am
- Contact:
-
- Newbie
- Posts: 8
- Joined: Wed Oct 21, 2009 12:00 am
- Contact:
Re: 3D Graph Draw to Bitmap
Answered my own question.
I knew I had run into something like this before but I couldn't remember what it was.
It has to do with the BufferStyle property setting on the tChart.Graphics3D object.
When it is set to OptimizedBuffering, I cannot draw to a bitmap. When I set it to None, it draws just fine.
I had forgotten that I was setting that property differently for the 3D graph (since we allow the user to interact with the 3d graph directly) from how we handle the 2D graphs (we manually buffer them ourselves so the user sees an image of the graph instead so we can more finely control redraws since our graphs get huge and the draw times become long).
Same issue I had seen before with 2D side of things but had forgotten about since then.
I knew I had run into something like this before but I couldn't remember what it was.
It has to do with the BufferStyle property setting on the tChart.Graphics3D object.
When it is set to OptimizedBuffering, I cannot draw to a bitmap. When I set it to None, it draws just fine.
I had forgotten that I was setting that property differently for the 3D graph (since we allow the user to interact with the 3d graph directly) from how we handle the 2D graphs (we manually buffer them ourselves so the user sees an image of the graph instead so we can more finely control redraws since our graphs get huge and the draw times become long).
Same issue I had seen before with 2D side of things but had forgotten about since then.
Re: 3D Graph Draw to Bitmap
Hello Aaron_Peronto,
Please, could you modify previous code because we can reproduce exactly you problem?
Thanks,
You can use property export of Chart to export image,data etc. You can find examples in demo project concretely: All Features\Welcome !\Exporting\Chart Picture. And also I recommend that take a look in Turorial12- Exporting and Importing Charts.Is there another way to save a 3D chart to an image file?
I couldn't reproduce your problem using next code and last version of TeeChart.Net:When it is set to OptimizedBuffering, I cannot draw to a bitmap. When I set it to None, it draws just fine.
I had forgotten that I was setting that property differently for the 3D graph (since we allow the user to interact with the 3d graph directly) from how we handle the 2D graphs (we manually buffer them ourselves so the user sees an image of the graph instead so we can more finely control redraws since our graphs get huge and the draw times become long).
Code: Select all
private void InitializeChart()
{
Steema.TeeChart.Styles.Line series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series1.FillSampleValues();
}
private void button1_Click(object sender, EventArgs e)
{
Steema.TeeChart.Drawing.BufferStyle buffer = tChart1.Graphics3D.BufferStyle;
tChart1.Graphics3D.BufferStyle = Steema.TeeChart.Drawing.BufferStyle.OptimizedBuffer;
tChart1.Export.Image.Bitmap.Save(@"C:\tmp\Images\Chart1.bmp");
tChart1.Export.Image.JPEG.Save(@"C:\tmp\Images\Chart1.jpg");
tChart1.Export.Image.PNG.Save(@"C:\tmp\Images\Chart1.png");
tChart1.Graphics3D.BufferStyle = buffer;
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |