How to print child chart for TeeChart.WPF
Posted: 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
// 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