Multiple Chart printing

TeeChart for ActiveX, COM and ASP
Post Reply
nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Multiple Chart printing

Post by nbp » Thu Mar 15, 2007 5:45 pm

I'm using TChart Pro ActiveX version 7. I've allocated several TChart objects on my dialog box dynamically. I now want to print all the charts to a single page. Can you point me to an example of how to do this? My code is somewhat like this

CTChart* pChart1 = new CTChart();
pChart.Create(.......);
CTChart* pChart2 = new CTChart();
pChart.Create(.......);
CTChart* pChart3 = new CTChart();
pChart.Create(.......);


CTeePrintPreviewPanel *pPanel = new CTeePrintPreviewPanel();
pPanel.AddChart(....);
pPanel.AddChart(pChart2);
pPanel.AddChart(pChart3);

The argument to AddChart has to be of type LPDISPATCH... not sure how to do this

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 19, 2007 11:37 am

Hi,

you should assign the Charts like in the following code :

Code: Select all

	m_chart1.AddSeries(0);
	m_chart1.Series(0).FillSampleValues(5);
	m_chart2.AddSeries(0);
	m_chart2.Series(0).FillSampleValues(5);

	m_chart1.GetPrinter().SetPrintProportional(false);
	m_chart1.GetPrinter().SetMarginLeft(2);
	m_chart1.GetPrinter().SetMarginTop(2);
	m_chart1.GetPrinter().SetMarginRight(60);
	m_chart1.GetPrinter().SetMarginBottom(60);

	m_chart2.GetPrinter().SetPrintProportional(false);
	m_chart2.GetPrinter().SetMarginLeft(60);
	m_chart2.GetPrinter().SetMarginTop(60);
	m_chart2.GetPrinter().SetMarginRight(2);
	m_chart2.GetPrinter().SetMarginBottom(2);

	m_Preview.GetPanels().Clear();
	m_Preview.AddChartLink(m_chart1.GetChartLink());
	m_Preview.AddChartLink(m_chart2.GetChartLink());

nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Post by nbp » Mon Mar 19, 2007 6:01 pm

How did you create m_Preview? Did you add a TeePreviewPanel to the dialog at Design time? Or did you do something like
CTeePreviewPanel* m_Preview = new CTeePreviewPanel();
m_PreviewPanel.Create(....);

Can you give me an example please?
Thanks.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Mar 26, 2007 8:00 am

Hi,

I added the preview at design time, but creating it dinamically should work work in the same manner adding the Charts using the AddChartLink.

nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Post by nbp » Thu Mar 29, 2007 4:17 am

How do I display the Preview Panel? I tried the above code and then used ShowWindow to display the Preview Window:

CTeePreviewPanel* pPreview = new CTreePreviewPanel()...
pPreview->Create(.....);
pPreview->AddChartLink()....

PreviewPanel->ShowWindow(SWSHOW)

but this displayed nothing.

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Apr 02, 2007 11:19 am

Hi,

there's not a way to show the TeePreviewPanel as a dialog, this feature is already down our wish list to be considered for further releases.
In meantime a solution is to do it manually, placing a TeePreviewPanel component on a new form dialog (with other components like buttons to print, setup, etc..) and call this dialog from the parent form app.

nbp
Newbie
Newbie
Posts: 83
Joined: Mon Sep 18, 2006 12:00 am

Post by nbp » Wed May 16, 2007 4:29 pm

I placed the TeePreviewPanel manually on a dialog and this worked fine.

I placed 2 charts on the Panel as described above and they displayed correctly. However, when I move the crosshair (margins) on the preview panel, only the chart in the top left resizes in proportion to the margins - how can I set it up so all charts placed on the preview panel resize accordingly?

Also, can I have multiple charts - say "N" on the preview panel at one time?

Pep
Site Admin
Site Admin
Posts: 3273
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon May 21, 2007 8:37 am

Hi,
I placed 2 charts on the Panel as described above and they displayed correctly. However, when I move the crosshair (margins) on the preview panel, only the chart in the top left resizes in proportion to the margins - how can I set it up so all charts placed on the preview panel resize accordingly?
All the Charts cannot be resized at the same time, but you can resize them individually by selecting to which one must be applied the margins using same code as in the TeeNew Demo : All Features -> Welcome ! -> Printing -> Multiple Charts (it shows how to do it clicking over each Chart).
Also, can I have multiple charts - say "N" on the preview panel at one time?
Yes, you can add multiple charts to the preview panel using the AddChart method, and resize them following the steps as in above answer.

jti
Newbie
Newbie
Posts: 17
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Re: Multiple Chart printing

Post by jti » Mon Jun 17, 2013 8:30 pm

This is excellent discussion, just what I am needing.

I do not have wrapper class for previewpanel. When I create one using the ActiveX Control Wizard in VS2012. I do not get a GetPanels, but a get_Panels. I think I can create GetPanels from this, but then I am missing the Clear method on GetPanels. How do I get these??

I have looked through my installation of TeeChart (v5.0.6.0) and through the 2012 evaluation version and I see no header file that has the PreviewPanel class.

jti
Newbie
Newbie
Posts: 17
Joined: Fri Nov 15, 2002 12:00 am
Contact:

Re: Multiple Chart printing

Post by jti » Mon Jun 17, 2013 9:02 pm

I do not know how I missed finding the teepreviewpanel.* and the teepanelslist.* earlier, but I have found them now.

Thanks

Post Reply