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

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

Introduction

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

Prototype

public void notifyListeners(PlotChangeEvent event) 

Source Link

Document

Notifies all registered listeners that the plot has been modified.

Usage

From source file:net.sf.maltcms.chromaui.charts.tools.ChartTools.java

/**
 *
 * @param p/*from   w  w w.j  a v  a  2  s. c  o m*/
 * @param sps
 */
public static void changePaintScale(final XYPlot p, final PaintScale sps) {
    if (p.getRenderer() instanceof XYBlockRenderer) {
        Runnable r = new Runnable() {
            @Override
            public void run() {
                XYBlockRenderer renderer = (XYBlockRenderer) p.getRenderer();
                Logger.getLogger(ChartTools.class.getName()).info("Setting paintscale");
                renderer.setPaintScale(sps);
                if (p instanceof FastHeatMapPlot) {
                    Logger.getLogger(ChartTools.class.getName()).info("Resetting data image");
                    FastHeatMapPlot fhp = (FastHeatMapPlot) p;
                    fhp.resetDataImage();
                }
                p.notifyListeners(new PlotChangeEvent(p));
            }
        };
        SwingUtilities.invokeLater(r);
    }
}

From source file:cs.cirg.cida.CIDAView.java

@Action
public void changeSeriesName() {
    SeriesPair series = (SeriesPair) lineSeriesComboBox.getSelectedItem();
    JFreeChart chart = ((ChartPanel) chartPanel).getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    XYSeriesCollection xYSeriesCollection = (XYSeriesCollection) plot.getDataset();
    CIDAInputDialog dialog = new CIDAInputDialog(this.getFrame(), CIDAConstants.DIALOG_NEW_NAME_MSG,
            (String) xYSeriesCollection.getSeries(series.getValue()).getKey());
    dialog.displayPrompt();//from w ww  . jav a 2s  .c om
    xYSeriesCollection.getSeries(series.getValue()).setKey(dialog.getInput());
    plot.notifyListeners(new PlotChangeEvent(plot));
    lineSeriesComboBox.removeItem(series);
    lineSeriesComboBox.addItem(new SeriesPair(series.getKey(), dialog.getInput()));
}