本文整理汇总了Java中org.jfree.chart.fx.ChartViewer.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ChartViewer.getHeight方法的具体用法?Java ChartViewer.getHeight怎么用?Java ChartViewer.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.fx.ChartViewer
的用法示例。
在下文中一共展示了ChartViewer.getHeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportToClipboard
import org.jfree.chart.fx.ChartViewer; //导入方法依赖的package包/类
public static void exportToClipboard(ChartViewer chartNode) {
final Clipboard clipboard = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
final int width = (int) chartNode.getWidth();
final int height = (int) chartNode.getHeight();
WritableImage img = new WritableImage(width, height);
SnapshotParameters params = new SnapshotParameters();
chartNode.snapshot(params, img);
content.putImage(img);
clipboard.setContent(content);
}
示例2: exportToImageFile
import org.jfree.chart.fx.ChartViewer; //导入方法依赖的package包/类
public static void exportToImageFile(ChartViewer chartNode, File file, ImgFileType fileType) {
final JFreeChart chart = chartNode.getChart();
final int width = (int) chartNode.getWidth();
final int height = (int) chartNode.getHeight();
try {
switch (fileType) {
case JPG:
ExportUtils.writeAsJPEG(chart, width, height, file);
break;
case PNG:
ExportUtils.writeAsPNG(chart, width, height, file);
break;
case SVG:
setDrawSeriesLineAsPath(chart, true);
ExportUtils.writeAsSVG(chart, width, height, file);
setDrawSeriesLineAsPath(chart, false);
break;
case PDF:
setDrawSeriesLineAsPath(chart, true);
ExportUtils.writeAsPDF(chart, width, height, file);
setDrawSeriesLineAsPath(chart, false);
break;
case EMF:
FileOutputStream out2 = new FileOutputStream(file);
setDrawSeriesLineAsPath(chart, true);
EMFGraphics2D g2d2 = new EMFGraphics2D(out2, new Dimension(width, height));
g2d2.startExport();
chart.draw(g2d2, new Rectangle(width, height));
g2d2.endExport();
setDrawSeriesLineAsPath(chart, false);
break;
case EPS:
FileOutputStream out = new FileOutputStream(file);
setDrawSeriesLineAsPath(chart, true);
EPSDocumentGraphics2D g2d = new EPSDocumentGraphics2D(false);
g2d.setGraphicContext(new GraphicContext());
g2d.setupDocument(out, width, height);
chart.draw(g2d, new Rectangle(width, height));
g2d.finish();
setDrawSeriesLineAsPath(chart, false);
out.close();
break;
}
} catch (IOException e) {
MZmineGUI.displayMessage("Unable to save image: " + e.getMessage());
e.printStackTrace();
}
}