Java Code Examples for org.jfree.chart.plot.XYPlot#setNotify()

The following examples show how to use org.jfree.chart.plot.XYPlot#setNotify() . 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: ChartLogicsFX.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Auto range the range axis
 * 
 * @param myChart
 * @param zoom
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void autoAxes(ChartViewer myChart) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  if (plot instanceof Zoomable) {
    Zoomable z = plot;
    Point2D endPoint = new Point2D.Double(0, 0);
    PlotRenderingInfo pri = myChart.getRenderingInfo().getPlotInfo();
    boolean saved = plot.isNotify();
    plot.setNotify(false);
    z.zoomDomainAxes(0, pri, endPoint);
    z.zoomRangeAxes(0, pri, endPoint);
    plot.setNotify(saved);
  }
}
 
Example 2
Source File: ChartLogicsFX.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Auto range the range axis
 * 
 * @param myChart
 * @param zoom
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void autoAxes(ChartViewer myChart) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  if (plot instanceof Zoomable) {
    Zoomable z = plot;
    Point2D endPoint = new Point2D.Double(0, 0);
    PlotRenderingInfo pri = myChart.getRenderingInfo().getPlotInfo();
    boolean saved = plot.isNotify();
    plot.setNotify(false);
    z.zoomDomainAxes(0, pri, endPoint);
    z.zoomRangeAxes(0, pri, endPoint);
    plot.setNotify(saved);
  }
}
 
Example 3
Source File: ChartLogicsFX.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Auto range the range axis
 * 
 * @param myChart
 * @param zoom
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void autoAxes(ChartViewer myChart) {
  XYPlot plot = (XYPlot) myChart.getChart().getPlot();
  if (plot instanceof Zoomable) {
    Zoomable z = plot;
    Point2D endPoint = new Point2D.Double(0, 0);
    PlotRenderingInfo pri = myChart.getRenderingInfo().getPlotInfo();
    boolean saved = plot.isNotify();
    plot.setNotify(false);
    z.zoomDomainAxes(0, pri, endPoint);
    z.zoomRangeAxes(0, pri, endPoint);
    plot.setNotify(saved);
  }
}
 
Example 4
Source File: ScatterPlotPanel.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
private ChartPanel createChartPanel(final JFreeChart chart) {
    scatterPlotDisplay = new ChartPanel(chart) {
        @Override
        public void restoreAutoBounds() {
            // here we tweak the notify flag on the plot so that only
            // one notification happens even though we update multiple
            // axes...
            final XYPlot plot = chart.getXYPlot();
            boolean savedNotify = plot.isNotify();
            plot.setNotify(false);
            xAxisRangeControl.adjustAxis(plot.getDomainAxis(), 3);
            yAxisRangeControl.adjustAxis(plot.getRangeAxis(), 3);
            plot.setNotify(savedNotify);
        }
    };

    MaskSelectionToolSupport maskSelectionToolSupport = new MaskSelectionToolSupport(this,
                                                                                     scatterPlotDisplay,
                                                                                     "correlative_plot_area",
                                                                                     "Mask generated from selected correlative plot area",
                                                                                     Color.RED,
                                                                                     PlotAreaSelectionTool.AreaType.Y_RANGE) {
        @Override
        protected String createMaskExpression(PlotAreaSelectionTool.AreaType areaType, Shape shape) {
            Rectangle2D bounds = shape.getBounds2D();
            return createMaskExpression(bounds.getMinY(), bounds.getMaxY());
        }

        protected String createMaskExpression(double x1, double x2) {
            String bandName = BandArithmetic.createExternalName(getRaster().getName());
            return String.format("%s >= %s && %s <= %s", bandName, x1, bandName, x2);
        }
    };
    scatterPlotDisplay.getPopupMenu().addSeparator();
    scatterPlotDisplay.getPopupMenu().add(maskSelectionToolSupport.createMaskSelectionModeMenuItem());
    scatterPlotDisplay.getPopupMenu().add(maskSelectionToolSupport.createDeleteMaskMenuItem());
    scatterPlotDisplay.getPopupMenu().addSeparator();
    scatterPlotDisplay.getPopupMenu().add(createCopyDataToClipboardMenuItem());
    return scatterPlotDisplay;
}