Multiple Charts

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Multiple Charts

Post by Jeff » Thu Apr 05, 2007 6:33 pm

Dear TeeChart Support:

In my project, I need to plot multiple graphs on the same Form. Each of these graphs should have its own axes and walls and the program should be able to export them to a file (e.g. JPEG) and to print them out WYSIWYG. It seems to me that there are two ways to archieve this, but both have some problems that I need your help with.

A. The first way is to use a single TChart object with one set of customized axes and walls for each sub-graph. Problems are:

1. How do I create customized Walls (Left, Rigth, Bottom, and Back), for each sub-graph in the same TChart object?

2. According to the doc, customized Axes are supported only for Left, Top, Bottom, and Right axes, does this mean that all sub-graphs in the same TChat object have to share the same Depth and DepthTop axes?

B. The second way is to use multiple TChart objects on the same Form. Problems are:

1. How do I export multiple TCharts as shown on the same Form to a file (e.g. JPEG) WYSIWYG?

2. How do I print multiple TCharts as shown on the same windows Form WYSIWYG?

I would also appreciate if you could suggest me a better solution than the two mentioned above. Thank you very much for your help.

Jeff

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Apr 10, 2007 8:43 am

Hi Jeff,

Please find below the answers to your questions:
A. The first way is to use a single TChart object with one set of customized axes and walls for each sub-graph. Problems are:

1. How do I create customized Walls (Left, Rigth, Bottom, and Back), for each sub-graph in the same TChart object?
This is not possible for now. You'll be able to do that using SubChart tool which has been implemented in TeeChart for .NET v3 Beta.
2. According to the doc, customized Axes are supported only for Left, Top, Bottom, and Right axes, does this mean that all sub-graphs in the same TChat object have to share the same Depth and DepthTop axes?
This is not possible for now. I've added your request to our wish-list to be considered for inclusion in future releases.

B. The second way is to use multiple TChart objects on the same Form. Problems are:

1. How do I export multiple TCharts as shown on the same Form to a file (e.g. JPEG) WYSIWYG?
If you are using .NET 2.0 you can add a button to your WinForm and add the following code to it:

Code: Select all

  private void button1_Click(object sender, EventArgs e)
  {
   string fileName = @"C:\temp\allchart.bmp";
   Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
   Bitmap bmp = new Bitmap(rect.Width, rect.Height);
   DrawToBitmap(bmp, rect);
   bmp.Save(fileName);
  }
To obtain a Bitmap from a TChart you can use tChart1.Bitmap method. You can also obtain a chart's rectangle using tChart1.Chart.ChartRect.
2. How do I print multiple TCharts as shown on the same windows Form WYSIWYG?
You could use a PrintDocument as shown in the messages below:

http://www.teechart.net/support/viewtopic.php?t=5490
http://www.teechart.net/support/viewtopic.php?t=5756
Best Regards,
Narcís Calvet / 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

Jeff
Newbie
Newbie
Posts: 22
Joined: Thu Nov 30, 2006 12:00 am

Post by Jeff » Tue Apr 10, 2007 7:03 pm

Thanks Narcís! Could you also supply a sample code that exports multiple TCharts on a Windows Form to a JPEG file?

Jeff

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 11, 2007 8:09 am

Hi Jeff,

In that case you just need to do something like this:

Code: Select all

		private void button1_Click(object sender, EventArgs e)
		{
			//string fileName = @"C:\temp\allchart.bmp";
			string fileName = @"C:\temp\allchart.jpg";
			Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
			Bitmap bmp = new Bitmap(rect.Width, rect.Height);
			DrawToBitmap(bmp, rect);
			//bmp.Save(fileName);
			bmp.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
		}
Best Regards,
Narcís Calvet / 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