Page 1 of 1

Multiple Chart printing

Posted: Thu Mar 15, 2007 5:45 pm
by 9532498
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

Posted: Mon Mar 19, 2007 11:37 am
by Pep
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());

Posted: Mon Mar 19, 2007 6:01 pm
by 9532498
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.

Posted: Mon Mar 26, 2007 8:00 am
by Pep
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.

Posted: Thu Mar 29, 2007 4:17 am
by 9532498
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.

Posted: Mon Apr 02, 2007 11:19 am
by Pep
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.

Posted: Wed May 16, 2007 4:29 pm
by 9532498
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?

Posted: Mon May 21, 2007 8:37 am
by Pep
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.

Re: Multiple Chart printing

Posted: Mon Jun 17, 2013 8:30 pm
by 6926758
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.

Re: Multiple Chart printing

Posted: Mon Jun 17, 2013 9:02 pm
by 6926758
I do not know how I missed finding the teepreviewpanel.* and the teepanelslist.* earlier, but I have found them now.

Thanks