org.jfree.chart.fx.interaction.AnchorHandlerFX Java Examples
The following examples show how to use
org.jfree.chart.fx.interaction.AnchorHandlerFX.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartCanvas.java From jfreechart-fx with GNU Lesser General Public License v2.1 | 4 votes |
/** * Creates a new canvas to display the supplied chart in JavaFX. If * {@code chart} is {@code null}, a blank canvas will be displayed. * * @param chart the chart ({@code null} permitted). */ public ChartCanvas(JFreeChart chart) { this.chart = chart; if (this.chart != null) { this.chart.addChangeListener(this); } this.tooltip = null; this.tooltipEnabled = true; this.chartMouseListeners = new ArrayList<>(); widthProperty().addListener(e -> draw()); heightProperty().addListener(e -> draw()); // change the default font smoothing for better results GraphicsContext gc = getGraphicsContext2D(); gc.setFontSmoothingType(FontSmoothingType.LCD); FXGraphics2D fxg2 = new FXGraphics2D(gc); fxg2.setRenderingHint(FXHints.KEY_USE_FX_FONT_METRICS, true); fxg2.setZeroStrokeWidth(0.1); fxg2.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); this.g2 = fxg2; this.liveHandler = null; this.availableMouseHandlers = new ArrayList<>(); this.availableMouseHandlers.add(new PanHandlerFX("pan", true, false, false, false)); this.auxiliaryMouseHandlers = new ArrayList<>(); this.auxiliaryMouseHandlers.add(new TooltipHandlerFX("tooltip")); this.auxiliaryMouseHandlers.add(new ScrollHandlerFX("scroll")); this.domainZoomable = true; this.rangeZoomable = true; this.auxiliaryMouseHandlers.add(new AnchorHandlerFX("anchor")); this.auxiliaryMouseHandlers.add(new DispatchHandlerFX("dispatch")); this.overlays = FXCollections.observableArrayList(); setOnMouseMoved(e -> handleMouseMoved(e)); setOnMouseClicked(e -> handleMouseClicked(e)); setOnMousePressed(e -> handleMousePressed(e)); setOnMouseDragged(e -> handleMouseDragged(e)); setOnMouseReleased(e -> handleMouseReleased(e)); setOnScroll(e -> handleScroll(e)); }