Java Code Examples for org.jfree.data.general.DatasetUtils#findMaximumRangeValue()
The following examples show how to use
org.jfree.data.general.DatasetUtils#findMaximumRangeValue() .
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: MsMsPlot.java From mzmine2 with GNU General Public License v2.0 | 6 votes |
@Override public void mouseClicked(final MouseEvent event) { // Let the parent handle the event (selection etc.) super.mouseClicked(event); if (event.getX() < 70) { // User clicked on Y-axis if (event.getClickCount() == 2) { // Reset zoom on Y-axis XYDataset data = ((XYPlot) getChart().getPlot()).getDataset(); Number maximum = DatasetUtils.findMaximumRangeValue(data); getXYPlot().getRangeAxis().setRange(0, 1.05 * maximum.floatValue()); } else if (event.getClickCount() == 1) { // Auto range on Y-axis getXYPlot().getRangeAxis().setAutoTickUnitSelection(true); getXYPlot().getRangeAxis().setAutoRange(true); } } else if (event.getY() > this.getChartRenderingInfo().getPlotInfo().getPlotArea().getMaxY() - 41 && event.getClickCount() == 2) { // Reset zoom on X-axis getXYPlot().getDomainAxis().setAutoTickUnitSelection(true); restoreAutoDomainBounds(); } else if (event.getClickCount() == 2) { visualizer.actionPerformed( new ActionEvent(event.getSource(), ActionEvent.ACTION_PERFORMED, "SHOW_SPECTRUM")); } }
Example 2
Source File: TICPlot.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public void mouseClicked(final MouseEvent event) { // Let the parent handle the event (selection etc.) // super.mouseClicked(event); // Request focus to receive key events. requestFocus(); // Handle mouse click events if (event.getButton() == MouseEvent.BUTTON1) { System.out.println("mouse " + event); if (event.getX() < 70) { // User clicked on Y-axis if (event.getClickCount() == 2) { // Reset zoom on Y-axis XYDataset data = ((XYPlot) getChart().getPlot()).getDataset(); Number maximum = DatasetUtils.findMaximumRangeValue(data); getXYPlot().getRangeAxis().setRange(0, 1.05 * maximum.floatValue()); } else if (event.getClickCount() == 1) { // Auto range on Y-axis getXYPlot().getRangeAxis().setAutoTickUnitSelection(true); getXYPlot().getRangeAxis().setAutoRange(true); } } else if (event.getY() > this.getRenderingInfo().getPlotInfo().getPlotArea().getMaxY() - 41 && event.getClickCount() == 2) { // Reset zoom on X-axis getXYPlot().getDomainAxis().setAutoTickUnitSelection(true); // restoreAutoDomainBounds(); } else if (event.getClickCount() == 2) { // If user double-clicked // left button, place a // request to open a // spectrum. showSpectrumRequest = true; } } }
Example 3
Source File: TICPlot.java From mzmine2 with GNU General Public License v2.0 | 5 votes |
@Override public void mouseClicked(final MouseEvent event) { // Let the parent handle the event (selection etc.) super.mouseClicked(event); // Request focus to receive key events. requestFocus(); // Handle mouse click events if (event.getButton() == MouseEvent.BUTTON1) { if (event.getX() < 70) { // User clicked on Y-axis if (event.getClickCount() == 2) { // Reset zoom on Y-axis XYDataset data = ((XYPlot) getChart().getPlot()).getDataset(); Number maximum = DatasetUtils.findMaximumRangeValue(data); getXYPlot().getRangeAxis().setRange(0, 1.05 * maximum.floatValue()); } else if (event.getClickCount() == 1) { // Auto range on Y-axis getXYPlot().getRangeAxis().setAutoTickUnitSelection(true); getXYPlot().getRangeAxis().setAutoRange(true); } } else if (event.getY() > this.getChartRenderingInfo().getPlotInfo().getPlotArea().getMaxY() - 41 && event.getClickCount() == 2) { // Reset zoom on X-axis getXYPlot().getDomainAxis().setAutoTickUnitSelection(true); restoreAutoDomainBounds(); } else if (event.getClickCount() == 2) { // If user double-clicked // left button, place a // request to open a // spectrum. showSpectrumRequest = true; } } }