Example usage for org.jfree.chart.annotations XYTitleAnnotation XYTitleAnnotation

List of usage examples for org.jfree.chart.annotations XYTitleAnnotation XYTitleAnnotation

Introduction

In this page you can find the example usage for org.jfree.chart.annotations XYTitleAnnotation XYTitleAnnotation.

Prototype

public XYTitleAnnotation(double x, double y, Title title) 

Source Link

Document

Creates a new annotation to be displayed at the specified (x, y) location.

Usage

From source file:org.esa.snap.rcp.statistics.ScatterPlotPanel.java

ScatterPlotPanel(TopComponent parentDialog, String helpId) {
    super(parentDialog, helpId, CHART_TITLE, false);
    userSettingsMap = new HashMap<>();
    productRemovedListener = new ProductManager.Listener() {
        @Override/*w ww  .j  a v  a  2  s . co  m*/
        public void productAdded(ProductManager.Event event) {
        }

        @Override
        public void productRemoved(ProductManager.Event event) {
            final UserSettings userSettings = userSettingsMap.remove(event.getProduct());
            if (userSettings != null) {
                userSettings.dispose();
            }
        }
    };

    xAxisRangeControl = new AxisRangeControl("X-Axis");
    yAxisRangeControl = new AxisRangeControl("Y-Axis");
    scatterPlotModel = new ScatterPlotModel();
    bindingContext = new BindingContext(PropertyContainer.createObjectBacked(scatterPlotModel));
    scatterpointsDataset = new XYIntervalSeriesCollection();
    acceptableDeviationDataset = new XYIntervalSeriesCollection();
    regressionDataset = new XYIntervalSeriesCollection();
    r2Annotation = new XYTitleAnnotation(0, 0, new TextTitle(""));
    chart = ChartFactory.createScatterPlot(CHART_TITLE, "", "", scatterpointsDataset, PlotOrientation.VERTICAL,
            true, true, false);
    chart.getXYPlot().setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    createDomainAxisChangeListener();
    final PropertyChangeListener userSettingsUpdateListener = evt -> {
        if (getRaster() != null) {
            final VectorDataNode pointDataSourceValue = scatterPlotModel.pointDataSource;
            final AttributeDescriptor dataFieldValue = scatterPlotModel.dataField;
            final UserSettings userSettings = getUserSettings(getRaster().getProduct());
            userSettings.set(getRaster().getName(), pointDataSourceValue, dataFieldValue);
        }
    };

    bindingContext.addPropertyChangeListener(PROPERTY_NAME_DATA_FIELD, userSettingsUpdateListener);
    bindingContext.addPropertyChangeListener(PROPERTY_NAME_POINT_DATA_SOURCE, userSettingsUpdateListener);
}

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

ScatterPlotPanel(ToolView parentDialog, String helpId) {
    super(parentDialog, helpId, CHART_TITLE, false);
    userSettingsMap = new HashMap<>();
    productRemovedListener = new ProductManager.Listener() {
        @Override//ww w .  ja  v  a 2 s  .  co m
        public void productAdded(ProductManager.Event event) {
        }

        @Override
        public void productRemoved(ProductManager.Event event) {
            final UserSettings userSettings = userSettingsMap.remove(event.getProduct());
            if (userSettings != null) {
                userSettings.dispose();
            }
        }
    };

    xAxisRangeControl = new AxisRangeControl("X-Axis");
    yAxisRangeControl = new AxisRangeControl("Y-Axis");
    scatterPlotModel = new ScatterPlotModel();
    bindingContext = new BindingContext(PropertyContainer.createObjectBacked(scatterPlotModel));
    scatterpointsDataset = new XYIntervalSeriesCollection();
    acceptableDeviationDataset = new XYIntervalSeriesCollection();
    regressionDataset = new XYIntervalSeriesCollection();
    r2Annotation = new XYTitleAnnotation(0, 0, new TextTitle(""));
    chart = ChartFactory.createScatterPlot(CHART_TITLE, "", "", scatterpointsDataset, PlotOrientation.VERTICAL,
            true, true, false);
    chart.getXYPlot().setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    createDomainAxisChangeListener();
    final PropertyChangeListener userSettingsUpdateListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (getRaster() != null) {
                final VectorDataNode pointDataSourceValue = scatterPlotModel.pointDataSource;
                final AttributeDescriptor dataFieldValue = scatterPlotModel.dataField;
                final UserSettings userSettings = getUserSettings(getRaster().getProduct());
                userSettings.set(getRaster().getName(), pointDataSourceValue, dataFieldValue);
            }
        }
    };

    bindingContext.addPropertyChangeListener(PROPERTY_NAME_DATA_FIELD, userSettingsUpdateListener);
    bindingContext.addPropertyChangeListener(PROPERTY_NAME_POINT_DATA_SOURCE, userSettingsUpdateListener);
}