How to print child chart for TeeChart.WPF

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Candy
Newbie
Newbie
Posts: 57
Joined: Mon Apr 26, 2010 12:00 am
Contact:

How to print child chart for TeeChart.WPF

Post by Candy » Thu Jun 26, 2014 3:25 am

I create more child chart in tChart1, but how to print child chart, please look at the code:

// init child chart
for (int i = 0; i < 4; i++) {
Steema.TeeChart.WPF.TChart child = new Steema.TeeChart.WPF.TChart();
...
...
tChart1.Children.Add(child);
}

// Referring to the teechart wpf example
documentViewer1.Document = CreateFixedDocumentWithPage();

// Referring to the teechart wpf example
FixedDocument CreateFixedDocument() { ... }
...

private PageContent CreateFirstPageContent() {
PageContent pageContent = new PageContent();
FixedPage fixedPage = new FixedPage();
Canvas canvas1 = new Canvas();

...
Steema.TeeChart.WPF.TChart child = (Steema.TeeChart.WPF.TChart)tChart1.Children[0];
DrawingVisual d = new DrawingVisual();
DrawingContext g = d.RenderOpen();
child.Draw(g);
AdornerLayer parent = AdornerLayer.GetAdornerLayer(child);
if (parent != null)
{
Adorner[] adorners = parent.GetAdorners(child);
if (adorners != null)
{
foreach (TeeAdorner item in adorners)
{
item.Draw(g);
}
}
}
g.Close();
...

fixedPage.Children.Add(canvas1);

....
}

-----------------------------------------------------------------------------------------------------------------------------

why child chart can not print in DocumentViewer? Please taught me how to do, thanks.

I'm working environment is: VS2010(.NET Framework 4.0) / Windows7

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

Re: How to print child chart for TeeChart.WPF

Post by Narcís » Thu Jun 26, 2014 10:28 am

Hi Candy,

You should do something very similar to the demo. Find attached a simple example project showing it. This is a Visual Studio 2013 .NET Framework 4.5.1 project. You just need to change the project TeeChart.WPF.dll reference to the version you use. If you have any problem with the project just use MainWindow.xaml and MainWindow.xaml.cs.
Attachments
WpfApplication1.zip
(9.15 KiB) Downloaded 587 times
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

Candy
Newbie
Newbie
Posts: 57
Joined: Mon Apr 26, 2010 12:00 am
Contact:

Re: How to print child chart for TeeChart.WPF

Post by Candy » Fri Jun 27, 2014 6:23 am

I was successful, thank you very much :D

Post Reply