3D Graph Draw to Bitmap

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Aaron_Peronto
Newbie
Newbie
Posts: 8
Joined: Wed Oct 21, 2009 12:00 am
Contact:

3D Graph Draw to Bitmap

Post by Aaron_Peronto » Thu Apr 21, 2011 3:32 pm

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.

Aaron_Peronto
Newbie
Newbie
Posts: 8
Joined: Wed Oct 21, 2009 12:00 am
Contact:

Re: 3D Graph Draw to Bitmap

Post by Aaron_Peronto » Thu Apr 21, 2011 3:56 pm

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.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: 3D Graph Draw to Bitmap

Post by Sandra » Tue Apr 26, 2011 8:58 am

Hello Aaron_Peronto,
Is there another way to save a 3D chart to an image file?
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.
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).
I couldn't reproduce your problem using next code and last version of TeeChart.Net:

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;

        }
Please, could you modify previous code because we can reproduce exactly you problem?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply