I'm trying to print/preview two charts, which I placed on a panel. I've read the tutorial 11 "Printing multiple Charts" ff. and converted it to my project. First I got a null-pointer-Exception at the print-method (line 3). Debugging the Printer-Sourcecode showed me that the document-Field was null. I made a work-a-round by calling the method "getPrinterJob" (line 2) before I called the print-method (now the document-object was filled). After all the print only shows the left chart (tchartLeft).
Do you know where my problem is and can you explain me how to print/preview two charts?
thank you for your help,
Code: Select all
tChartLeft.getPrinter().beginPrint(); tChartLeft.getPrinter().getPrinterJob(); // work-a-round for null-pointer-problem tChartLeft.getPrinter().print(tChartRight.getChart().chart, new com.steema.teechart.Rectangle(100,10,300,200)); tChartLeft.getPrinter().print(new com.steema.teechart.Rectangle(100,300,300,200)); tChartLeft.getPrinter().endPrint();