![]() |
Contents page Previous |
TeeChart Pro offers standard print methods to print the Onscreen Chart 'as is' to the Printer.
To print a Chart use the Print method. This will print the chart as it appears onscreen.
Example
tChart1.getPrinter().print();
The Print method allows you to print both Landscape and Portrait orientations, even if they are not defined as the default, by the use of the boolean landscape parameter. The default orientation will take effect again after the print is complete. Default Orientation can be changed using the Landscape property (set to true for Landscape, false for Portrait):
Example
tChart1.getPrinter().setLandscape(true); tChart1.getPrinter().print();
The PrintPreview window will show you how the Chart will appear when printed. You may modify print parameters in the Print Preview window. To call PrintPreview run:
tChart1.getPrinter().preview();
When printing to Greyscale printers you should take care that the colours of
the Chart are easily distinguishable when translated to shades of grey. To help,
you could add Brush styles to the Chart Series to more easily distinguish Series
when printed.
You can also print Grayscale Charts to color printers using the Grayscale
property:
tChart1.getPrinter().setGrayscale(true); tChart1.getPrinter().print(true);
Use beginPrint() and endPrint() to send a Chart to the printer without
ejecting the page; BeginPrint() and EndPrint() start and end the Printer job.
More than one Chart can be sent to the same page/printer job and user custom
input can be included too.
public void button1_actionPerformed(ActionEvent e) { tChart1.getPrinter().beginPrint(); tChart1.getPrinter().print(tChart2.getChart().chart,new com.steema.teechart.Rectangle(100,10,300,200)); tChart1.getPrinter().print(new com.steema.teechart.Rectangle(100,300,300,200)); tChart1.getPrinter().endPrint(); }
The Print Previewer now accepts more than one Chart. Chart positions are
controlled setting the Rectangle of the Print method.
Example (Shows 2 Charts in the Print Previewer):
public void button1_actionPerformed(ActionEvent e) { tChart1.getPrinter().beginPrint(); tChart1.getPrinter().print(tChart2.getChart().chart,new com.steema.teechart.Rectangle(100,10,300,200)); tChart1.getPrinter().print(new com.steema.teechart.Rectangle(100,300,300,200)); tChart1.getPrinter().preview(); }
Use the ChartPrint() event to mix TeeChart print output with non Chart printer
output.
The following example takes the text from the TeeChart Headers and
prints them on a page with two TChart objects:
public void button1_actionPerformed(ActionEvent e) { tChart1.getPrinter().beginPrint(); tChart1.getPrinter().print(tChart2.getChart().chart,new com.steema.teechart.Rectangle(100,10,300,200)); tChart1.getPrinter().print(new com.steema.teechart.Rectangle(100,300,300,200)); tChart1.getPrinter().endPrint(); } public void doChartPrint(Object sender, PrintPageEventArgs e) { e.drawString("Chart: "+((com.steema.teechart.printer.ChartPrintJob)sender).getChart().getHeader().getText(), 100,((com.steema.teechart.printer.ChartPrintJob)sender).getChart().getChartRect().getBottom()+10); }
![]() |