org.jfree.chart.ChartMouseEvent Java Examples
The following examples show how to use
org.jfree.chart.ChartMouseEvent.
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: VenndiPlot.java From chipster with MIT License | 6 votes |
public void chartMouseClicked(ChartMouseEvent e) { if(e.getEntity() != null){ for(Area shape : areas){ //if(shape.contains(e.getTrigger().getPoint())){ if(shape.equals(e.getEntity().getArea())){ if(!e.getTrigger().isControlDown()){ selected.clear(); } if(selected.contains(shape)){ selected.remove(shape); } else { selected.add(shape); } } } } else { selected.clear(); } setSelectedForList(true); }
Example #2
Source File: BarChartPanel.java From nmonvisualizer with Apache License 2.0 | 6 votes |
@Override public void chartMouseClicked(ChartMouseEvent event) { if (event.getEntity().getClass() == CategoryItemEntity.class) { if ((getChart() != null) && (getChart().getClass() == HighlightableBarChart.class)) { HighlightableBarChart chart = (HighlightableBarChart) getChart(); CategoryItemEntity entity = (CategoryItemEntity) event.getEntity(); // toggle highlight if already selected if (chart.isHighlighted(entity)) { chart.clearHighlights(); firePropertyChange("highlightedBar", getRowAndColumn(entity), null); } else { chart.clearHighlights(); chart.highlightEntity(entity); firePropertyChange("highlightedBar", null, getRowAndColumn(entity)); } // assume whatever fired the event will repaint the chart } } }
Example #3
Source File: MouseListenerTimelapse.java From SPIM_Registration with GNU General Public License v2.0 | 6 votes |
@Override public void chartMouseClicked( final ChartMouseEvent e ) { // left mouse click if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 && enableReferenceTimePoint ) { referenceTimePoint = getChartXLocation( e.getTrigger().getPoint(), panel ); valueMarker.setValue( referenceTimePoint ); valueMarker.setLabel( " Reference\n Timepoint " + referenceTimePoint ); if ( !markerShown ) { ((XYPlot) e.getChart().getPlot()).addDomainMarker( valueMarker ); markerShown = true; } } }
Example #4
Source File: GraphPanel.java From swift-k with Apache License 2.0 | 6 votes |
@Override public void chartMouseMoved(ChartMouseEvent e) { disableToolTip(); if (isPointWithinChartArea(e.getTrigger().getX(), e.getTrigger().getY())) { chart.getXYPlot().setDomainCrosshairVisible(true); double vx = valueFromPosition(e); chart.getXYPlot().setDomainCrosshairValue(vx); scheduleTooltipDisplay(vx); } else { chart.getXYPlot().setDomainCrosshairVisible(false); synchronized(this) { if (tooltipTimerTask != null) { tooltipTimerTask.cancel(); } } } }
Example #5
Source File: MouseListenerValue.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
@Override public void chartMouseClicked( final ChartMouseEvent e ) { // left mouse click if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 ) { final double value = getChartXLocation( e.getTrigger().getPoint(), panel ); valueMarker.setValue( value ); valueMarker.setLabel( " Distance=" + value ); } }
Example #6
Source File: MouseListenerTimelapse.java From SPIM_Registration with GNU General Public License v2.0 | 5 votes |
@Override public void chartMouseClicked( final ChartMouseEvent e ) { // left mouse click if ( e.getTrigger().getButton() == MouseEvent.BUTTON1 && enableReferenceTimePoint ) { final int referenceTimePoint = getChartXLocation( e.getTrigger().getPoint(), panel ); if ( timepoints != null ) { if ( setReferenceTimepoint( timepoints, referenceTimePoint ) ) this.referenceTimePoint = referenceTimePoint; } else { this.referenceTimePoint = referenceTimePoint; } valueMarker.setValue( this.referenceTimePoint ); valueMarker.setLabel( " Reference\n Timepoint " + this.referenceTimePoint ); if ( !markerShown ) { ((XYPlot) e.getChart().getPlot()).addDomainMarker( valueMarker ); markerShown = true; } } }
Example #7
Source File: AbstractChartPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Receives notification of mouse clicks on the panel. These are translated and passed on to any * registered {@link ChartMouseListener}s. * * @param event * Information about the mouse event. */ @Override public void mouseClicked(MouseEvent event) { Insets insets = getInsets(); int x = (int) ((event.getX() - insets.left) / this.scaleX); int y = (int) ((event.getY() - insets.top) / this.scaleY); this.anchor = new Point2D.Double(x, y); if (this.chart == null) { return; } this.chart.setNotify(true); // force a redraw // new entity code... Object[] listeners = this.chartMouseListeners.getListeners(ChartMouseListener.class); if (listeners.length == 0) { return; } ChartEntity entity = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } ChartMouseEvent chartEvent = new ChartMouseEvent(getChart(), event, entity); for (int i = listeners.length - 1; i >= 0; i -= 1) { ((ChartMouseListener) listeners[i]).chartMouseClicked(chartEvent); } }
Example #8
Source File: AbstractChartPanel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Implementation of the MouseMotionListener's method. * * @param e * the event. */ @Override public void mouseMoved(MouseEvent e) { Graphics2D g2 = (Graphics2D) getGraphics(); if (this.horizontalAxisTrace) { drawHorizontalAxisTrace(g2, e.getX()); } if (this.verticalAxisTrace) { drawVerticalAxisTrace(g2, e.getY()); } g2.dispose(); Object[] listeners = this.chartMouseListeners.getListeners(ChartMouseListener.class); if (listeners.length == 0) { return; } Insets insets = getInsets(); int x = (int) ((e.getX() - insets.left) / this.scaleX); int y = (int) ((e.getY() - insets.top) / this.scaleY); ChartEntity entity = null; if (this.info != null) { EntityCollection entities = this.info.getEntityCollection(); if (entities != null) { entity = entities.getEntity(x, y); } } // we can only generate events if the panel's chart is not null // (see bug report 1556951) if (this.chart != null) { ChartMouseEvent event = new ChartMouseEvent(getChart(), e, entity); for (int i = listeners.length - 1; i >= 0; i -= 1) { ((ChartMouseListener) listeners[i]).chartMouseMoved(event); } } }
Example #9
Source File: GraphPanel.java From swift-k with Apache License 2.0 | 4 votes |
@Override public void chartMouseClicked(ChartMouseEvent e) { if (isPointWithinChartArea(e.getTrigger().getX(), e.getTrigger().getY())) { enableTooltip(valueFromPosition(e)); } }
Example #10
Source File: IntervalChartPanel.java From nmonvisualizer with Apache License 2.0 | 4 votes |
@Override public final void chartMouseMoved(ChartMouseEvent event) {}
Example #11
Source File: BarChartPanel.java From nmonvisualizer with Apache License 2.0 | 4 votes |
@Override public void chartMouseMoved(ChartMouseEvent event) {}
Example #12
Source File: TrackerTab.java From jeveassets with GNU General Public License v2.0 | 4 votes |
@Override public void chartMouseMoved(ChartMouseEvent cme) { }
Example #13
Source File: LineChartPanel.java From nmonvisualizer with Apache License 2.0 | 4 votes |
@Override public final void chartMouseMoved(ChartMouseEvent event) {}
Example #14
Source File: LineChartPanel.java From nmonvisualizer with Apache License 2.0 | 4 votes |
@Override public final void chartMouseClicked(ChartMouseEvent event) { int series = -1; ChartEntity entity = event.getEntity(); if (entity == null) { return; } // users can click on either the line or the legend // regardless, figure out the series index if (entity.getClass() == XYItemEntity.class) { series = ((XYItemEntity) event.getEntity()).getSeriesIndex(); } else if (entity.getClass() == LegendItemEntity.class) { LegendItemEntity legendEntity = (LegendItemEntity) event.getEntity(); XYDataset dataset = (XYDataset) legendEntity.getDataset(); for (int i = 0; i < dataset.getSeriesCount(); i++) { if (dataset.getSeriesKey(i).equals(legendEntity.getSeriesKey())) { series = i; break; } } } if (series != -1) { XYItemRenderer renderer = getChart().getXYPlot().getRenderer(); Stroke oldHighlight = renderer.getSeriesStroke(series); // clear existing highlights ((AbstractRenderer) getChart().getXYPlot().getRenderer()).clearSeriesStrokes(false); // toggle series stroke if (oldHighlight != SELECTED_STROKE) { renderer.setSeriesStroke(series, SELECTED_STROKE); firePropertyChange("highlightedLine", null, series); } else { renderer.setSeriesStroke(series, null); firePropertyChange("highlightedLine", series, null); } // assume whatever fired the event will repaint the chart } }
Example #15
Source File: MouseListenerTimelapse.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
@Override public void chartMouseMoved( final ChartMouseEvent e ) { }
Example #16
Source File: MouseListenerTimelapse.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
@Override public void chartMouseMoved( final ChartMouseEvent e ) { }
Example #17
Source File: GraphPanel.java From swift-k with Apache License 2.0 | 4 votes |
private double valueFromPosition(ChartMouseEvent e) { Rectangle2D chartArea = cp.getScreenDataArea(); XYPlot plot = chart.getXYPlot(); return plot.getDomainAxis().java2DToValue(e.getTrigger().getX(), chartArea, plot.getDomainAxisEdge()); }
Example #18
Source File: MouseListenerValue.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
@Override public void chartMouseMoved( final ChartMouseEvent e ) { }
Example #19
Source File: XYPlotMarker.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
private void updatePoint(ChartMouseEvent event) { if (xyDataset == null || xyDataset.getSeriesCount() == 0 // This situation appears, if the dataset has changed while the overlay is still visible || (seriesIndex < 0 || seriesIndex >= xyDataset.getSeriesCount())) { if (removeOverlay()) { // FIXME - exception here: // listener.pointDeselected(); /* Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at ProductSceneView.getRaster(ProductSceneView.java:511) at ProductSceneView.getProduct(ProductSceneView.java:468) at org.esa.snap.visat.toolviews.nav.CursorSynchronizer.removePPL(CursorSynchronizer.java:133) at org.esa.snap.visat.toolviews.nav.CursorSynchronizer.clearPsvOverlayMap(CursorSynchronizer.java:116) at org.esa.snap.visat.toolviews.nav.CursorSynchronizer.setEnabled(CursorSynchronizer.java:67) at org.esa.snap.visat.toolviews.stat.ProfilePlotPanel$3.pointDeselected(ProfilePlotPanel.java:211) */ } return; } addOverlay(); XYPlot plot = chartPanel.getChart().getXYPlot(); Rectangle2D dataArea = chartPanel.getScreenDataArea(); PlotOrientation orientation = plot.getOrientation(); RectangleEdge domainEdge = Plot.resolveDomainAxisLocation( plot.getDomainAxisLocation(), orientation); RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation( plot.getRangeAxisLocation(), orientation); double xView = event.getTrigger().getPoint().x; double xData = plot.getDomainAxis().java2DToValue(xView, dataArea, domainEdge); int itemCount = xyDataset.getItemCount(seriesIndex); for (int i = 0; i < itemCount - 1; i++) { double x1 = xyDataset.getXValue(seriesIndex, i); double x2 = xyDataset.getXValue(seriesIndex, i + 1); if (xData >= x1 && xData <= x2) { double y1 = xyDataset.getYValue(seriesIndex, i); double y2 = xyDataset.getYValue(seriesIndex, i + 1); double yData = y1 + (xData - x1) * (y2 - y1) / (x2 - x1); double yView = plot.getRangeAxis().valueToJava2D(yData, dataArea, rangeEdge); Point2D.Double viewPoint = new Point2D.Double(xView, yView); Point2D.Double dataPoint = new Point2D.Double(xData, yData); overlay.setPoint(viewPoint, dataPoint); listener.pointSelected(xyDataset, seriesIndex, dataPoint); break; } } }
Example #20
Source File: XYPlotMarker.java From snap-desktop with GNU General Public License v3.0 | 4 votes |
@Override public void chartMouseMoved(ChartMouseEvent event) { updatePoint(event); }
Example #21
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 4 votes |
public void chartMouseMoved(ChartMouseEvent event) { // ignore }
Example #22
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 4 votes |
public void chartMouseClicked(ChartMouseEvent event) { // ignore }
Example #23
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Ignores a mouse move event. * * @param event the event. */ public void chartMouseMoved(ChartMouseEvent event) { // ignore }
Example #24
Source File: ChartPanelTests.java From astor with GNU General Public License v2.0 | 2 votes |
/** * Ignores a mouse click event. * * @param event the event. */ public void chartMouseClicked(ChartMouseEvent event) { // ignore }
Example #25
Source File: VenndiPlot.java From chipster with MIT License | 2 votes |
/** * Implements the ChartMouseListener interface. This * method does nothing. * * @param event the mouse event. */ public void chartMouseMoved(ChartMouseEvent event) { ; }