Example usage for org.jfree.chart.fx ChartViewer snapshot

List of usage examples for org.jfree.chart.fx ChartViewer snapshot

Introduction

In this page you can find the example usage for org.jfree.chart.fx ChartViewer snapshot.

Prototype

public WritableImage snapshot(SnapshotParameters params, WritableImage image) 

Source Link

Document

Takes a snapshot of this node and returns the rendered image when it is ready.

Usage

From source file:io.github.mzmine.util.jfreechart.JFreeChartUtils.java

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);/*from w w  w.j  av  a  2s.c  o  m*/
    clipboard.setContent(content);
}