翻譯|使用教程|編輯:王香|2018-09-25 16:41:09.000|閱讀 368 次
概述:本文詳細介紹了在TeeChart for Java中打印圖表的標準打印和擴展打印方法。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
【下載TeeChart for Java最新版本】
TeeChart Pro提供標準打印方法,可將“屏幕圖表”按原樣打印到打印機。
要打印圖表,請使用Print方法。這將打印出屏幕上顯示的圖表,例:
tChart1.getPrinter().print();
Print方法允許您通過使用布爾橫向參數來打印橫向和縱向方向,即使它們未被定義為默認方向。打印完成后,默認方向將再次生效。可以使用Landscape屬性更改默認方向(對于Landscape,設置為true,對于Portrait,設置為false),例:
tChart1.getPrinter().setLandscape(true); tChart1.getPrinter().print();
PrintPreview窗口將顯示圖表在打印時的顯示方式。您可以在“Print Preview”窗口中修改打印參數。要調用PrintPreview運行:
tChart1.getPrinter().preview();
打印到Greyscale打印機時,您應該注意,當轉換為灰色陰影時,圖表的顏色很容易區分。為了提供幫助,您可以在圖表系列中添加畫筆樣式,以便在打印時更輕松地區分系列。您還可以使用灰度屬性將彩色圖表打印到彩色打印機:
tChart1.getPrinter().setGrayscale(true); tChart1.getPrinter().print(true);
使用beginPrint()和endPrint()將圖表發送到打印機而不彈出頁面; BeginPrint()和EndPrint()開始和結束打印機作業。可以將多個圖表發送到同一頁面/打印機作業,也可以包含用戶自定義輸入。示例(將2個圖表打印到頁面):
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(); }
打印預覽器現在接受多個圖表。控制圖表位置設置Print方法的Rectangle,示例(在打印預覽器中顯示2個圖表):
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(); }
使用ChartPrint()事件將TeeChart打印輸出與非Chart打印機輸出混合。以下示例從TeeChart標題中獲取文本,并在具有兩個TChart對象的頁面上打印它們:
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); }
購買TeeChart for Java正版授權,請點擊“”喲!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn