Example usage for org.jfree.chart.plot XYPlot isNotify

List of usage examples for org.jfree.chart.plot XYPlot isNotify

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot isNotify.

Prototype

public boolean isNotify() 

Source Link

Document

Returns a flag that controls whether or not change events are sent to registered listeners.

Usage

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Auto range the range axis/*from w w  w.  j a v a2  s. c  o  m*/
 * 
 * @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);
    }
}

From source file:org.esa.beam.visat.toolviews.stat.ScatterPlotPanel.java

private ChartPanel createChartPanel(final JFreeChart chart) {
    scatterPlotDisplay = new ChartPanel(chart) {
        @Override/*from   w  w  w  .  j a  v  a2s  . c  om*/
        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;
}