Printing Multiple Charts

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Casper JH Erasmus
Newbie
Newbie
Posts: 17
Joined: Wed Oct 13, 2004 4:00 am
Location: South Africa

Printing Multiple Charts

Post by Casper JH Erasmus » Wed Jan 31, 2007 11:24 am

Hi Everyone,

How do I print multiple charts on 1 page extending over more than one page?

I have a radial/pie chart that represents a set of values. The requirement is to display a series of radial/pie chart on screen each with their own set of values. The second requirement is to print the series of charts.

I have successfully manage to draw a series of charts on a panel in my application in runtime, but can't print them in equal fashion. Any ideas?

Regards,
Casper JH Erasmus

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 Jan 31, 2007 1:02 pm

Hi Casper,

Have you tried doing something as in the All Features\Welcome !\Chart styles\Standard\Pie\Multiple Pies example in the features demo? You'll find the demo at TeeChart's program group.
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

Casper JH Erasmus
Newbie
Newbie
Posts: 17
Joined: Wed Oct 13, 2004 4:00 am
Location: South Africa

Post by Casper JH Erasmus » Fri Feb 02, 2007 6:34 am

Narcis,

I've studied the example, but this is not what I have to do. My charts are drawn at runtime since do not know beforehand how many charts has to be drawn. How would I draw e.g. 50 pies and be able to view all of them on screen. How would I print them since it looks like whatever is drawn on screen is printed the same way, like WYSIWYG.

Regards,
Casper

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

Post by Narcís » Fri Feb 02, 2007 11:27 am

Hi Casper,

Could you please send us a simple example project (e.g.: two pies) we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at the upload page.

Thanks in advance.
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

Casper JH Erasmus
Newbie
Newbie
Posts: 17
Joined: Wed Oct 13, 2004 4:00 am
Location: South Africa

Post by Casper JH Erasmus » Mon Feb 05, 2007 8:51 am

Narcis,

I've uploaded a simple projecton the upload page. Try the following:

1. Run the project.
2. Resize the form so that only two pies are shown, then click the print button.
3. Two piese will be shown in print preview.
4. Resize the form so that 3 pies are shown.
5. Click print button, 3 pies are shown in print preview.
This to me means that whatever isshown on screen is printed, i.e. WYSIWIG.

My problem is that is I were to print 50 pies, not all of them will show on screen, so how would I make sure that I print all 50 pies. I cannot make the pies too small, cause I need to have the detail be clear enough.

Thanks

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

Post by Narcís » Mon Feb 05, 2007 4:39 pm

Hi Casper,

Thanks for the example.

TeeChart prints only what is within the TeeChart object when the print dialog is launched. To print what's in the chart but not displayed all you have to do is to export the chart at the size (or with the settings) at which everything is displayed. To do this you will have to create your own PrintDocument and not use the one that TeeChart creates. This applied to your example is this:

Code: Select all

		private void button1_Click(object sender, System.EventArgs e)
		{
			System.Drawing.Printing.PrintDocument document = new System.Drawing.Printing.PrintDocument();

			document.PrintController=new System.Drawing.Printing.StandardPrintController();
			document.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(document_PrintPage);
			
			document.Print();
		}

		void document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
		{
			Rectangle r = new Rectangle(10, 10, 700, 200);
			System.Drawing.Imaging.Metafile m = tChart1.Chart.Metafile(tChart1.Chart, r.Width, r.Height);
			
			e.Graphics.DrawImage(m, r, tChart1.Chart.ChartBounds, GraphicsUnit.Pixel);
		}
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

Casper JH Erasmus
Newbie
Newbie
Posts: 17
Joined: Wed Oct 13, 2004 4:00 am
Location: South Africa

Post by Casper JH Erasmus » Mon Feb 12, 2007 7:01 am

Narcis,

tahnks very much for the solution. I've uploaded "pietest2.zip" where I'm trying to plot multiple pies during run time. When the chart is displayed the first time a couple of pies is shown, but when I want to resize the form to see more pies, all my pies disappear. Am I doing it wrong or is there a way to scroll the chart to be able to see all the pies?

Thanks
Regards,

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

Post by Narcís » Mon Feb 12, 2007 8:48 am

Hi Casper,

The problem is that xpos and ypos are not reseted after each time the chart is drawn. You can solve this changing your BeforeDrawValues to something like this:

Code: Select all

		private void pie_BeforeDrawValues(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			xpos = 10+100*tChart1.Series.IndexOf((Steema.TeeChart.Styles.Series)sender);
			ypos = 10+200*tChart1.Series.IndexOf((Steema.TeeChart.Styles.Series)sender);
			this.tChart1.Chart.ChartRect = new Rectangle(xpos,ypos,200, 100);
		}
Or reset xpos and ypos in the AfterDraw event:

Code: Select all

		private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			xpos=10;
			ypos=10;
		}
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

Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

Similar needs

Post by Mike Jones » Wed May 02, 2007 9:35 pm

I have a similar need to print multiple charts. Mine need is going to be a list a different types of charts.

I tried to find the example that Narcis said he uploaded. I cannot find this file. Can someone point me to this example?

Mike

Beige
Newbie
Newbie
Posts: 25
Joined: Wed Jun 28, 2006 12:00 am

Re: Printing Multiple Charts

Post by Beige » Fri Feb 19, 2010 9:54 am

I have same question as Mike. How do I get the pietest2.zip file. One more point I want to ask, how do I attach multiple chart in document_PrintPage function deescribed by Narcis.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Printing Multiple Charts

Post by Yeray » Fri Feb 19, 2010 3:37 pm

Hi Mike and Biege,

Note that Casper was trying to print different pie series but all them from the same chart. If I'm not wrong, what you are trying to do is to print multiple independent charts into the same page.
Please, take a look at my response here where printing different charts is being discussed.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply