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