Example usage for org.jfree.data.xy XYSeriesCollection XYSeriesCollection

List of usage examples for org.jfree.data.xy XYSeriesCollection XYSeriesCollection

Introduction

In this page you can find the example usage for org.jfree.data.xy XYSeriesCollection XYSeriesCollection.

Prototype

public XYSeriesCollection() 

Source Link

Document

Constructs an empty dataset.

Usage

From source file:com.heatonresearch.aifh.examples.rbf.LearnIrisAnnealROC.java

public LearnIrisAnnealROC() {
    this.setSize(640, 480);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setTitle("Iris Classify ROC");
    Container content = this.getContentPane();
    content.setLayout(new BorderLayout());

    this.dataset = new XYSeriesCollection();
    this.dataSeries1 = new XYSeries("Threshold");
    this.dataset.addSeries(this.dataSeries1);

    final JFreeChart lineChart = ChartFactory.createXYLineChart("Line Chart Demo 6", // chart title
            FPR, // x axis label
            TPR, // y axis label
            this.dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );//from ww w .j  av a2 s. c o  m

    ChartPanel chartPanel = new ChartPanel(lineChart);
    chartPanel.setPreferredSize(new java.awt.Dimension(560, 367));
    content.add(chartPanel, BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    buttonPanel.add(this.buttonAnneal = new JButton("Anneal"));
    buttonPanel.add(this.buttonReset = new JButton("Reset"));
    this.buttonAnneal.addActionListener(this);
    this.buttonReset.addActionListener(this);
    content.add(buttonPanel, BorderLayout.SOUTH);

    this.training = loadIrisData();

    this.network = new RBFNetwork(4, 4, 1);
    this.network.reset(new MersenneTwisterGenerateRandom());

    final ScoreFunction score = new ScoreRegressionData(this.training);
    this.trainer = new TrainAnneal(this.network, score);
}

From source file:IHM.NewClass.java

private XYDataset createDataset() {
    XYSeries s1 = new XYSeries("Temperature");
    XYSeries s2 = new XYSeries("Humidit");
    XYSeries s3 = new XYSeries("Nebulosit");
    Controller c = new Controller();
    // c.AfficherStationMoyenneTousLesJours();
    for (ReleveMeteo i : c.getStationRecherchee()) {
        System.out.println(i.getTemperature());
        if (i.getJour().getJour() == 0) {
            s1.add(Double.parseDouble("" + i.getMois().getMois()), Double.parseDouble(i.getTemperature()));
            s2.add(Double.parseDouble("" + i.getMois().getMois()), Double.parseDouble(i.getHumidite()));
            s3.add(Double.parseDouble("" + i.getMois().getMois()), Double.parseDouble(i.getNebulosite()));
        } else {/*from  w  ww .  j a  v  a2 s. c o m*/
            s1.add(Double.parseDouble("" + i.getJour().getJour()), Double.parseDouble(i.getTemperature()));
            s2.add(Double.parseDouble("" + i.getJour().getJour()), Double.parseDouble(i.getHumidite()));
            s3.add(Double.parseDouble("" + i.getJour().getJour()), Double.parseDouble(i.getNebulosite()));
        }

    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(s1);
    dataset.addSeries(s2);
    dataset.addSeries(s3);

    return dataset;
}

From source file:org.jfree.chart.demo.XYLineAndShapeRendererDemo.java

/**
 * Creates a sample dataset./*from ww  w  . ja  v a2  s  . com*/
 * 
 * @return A dataset.
 */
private XYDataset createSampleDataset() {
    XYSeries series1 = new XYSeries("Series 1");
    series1.add(1.0, 3.3);
    series1.add(2.0, 4.4);
    series1.add(3.0, 1.7);
    XYSeries series2 = new XYSeries("Series 2");
    series2.add(1.0, 7.3);
    series2.add(2.0, 6.8);
    series2.add(3.0, 9.6);
    series2.add(4.0, 5.6);
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);
    return dataset;
}

From source file:org.micromanager.CRISP.CRISPFrame.java

/**
* Create a frame with a plot of the data given in XYSeries
*//* w  w  w.java 2s  . c o  m*/
public static void plotData(String title, XYSeries data, String xTitle, String yTitle, int xLocation,
        int yLocation) {
    // JFreeChart code
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(data);
    JFreeChart chart = ChartFactory.createScatterPlot(title, // Title
            xTitle, // x-axis Label
            yTitle, // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            false, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setRangeGridlinePaint(Color.lightGray);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setSeriesPaint(0, Color.black);
    renderer.setSeriesFillPaint(0, Color.white);
    renderer.setSeriesLinesVisible(0, true);
    Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f);
    renderer.setSeriesShape(0, circle, false);
    renderer.setUseFillPaint(true);

    ChartFrame graphFrame = new ChartFrame(title, chart);
    graphFrame.getChartPanel().setMouseWheelEnabled(true);
    graphFrame.pack();
    graphFrame.setLocation(xLocation, yLocation);
    graphFrame.setVisible(true);
}

From source file:IHM.compargraph.java

private XYDataset createDataset() {

    XYSeriesCollection dataset1 = new XYSeriesCollection();

    if (t1.size() < t2.size()) {
        if (c == "Temperature") {
            XYSeries s1 = new XYSeries("Temperature station 1");
            XYSeries s2 = new XYSeries("Temperature station 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getTemperature()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getTemperature()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;/*from  w  w  w  .  j a va2  s. c  o m*/
                    Double f = Double.parseDouble(t1.get(i).getTemperature())
                            - Double.parseDouble(t2.get(i).getTemperature());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);

                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getTemperature()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getTemperature()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getTemperature())
                            - Double.parseDouble(t2.get(i).getTemperature());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);

                    dataset1 = dataset;
                }
            }
        } else if (c == "Humidit") {
            XYSeries s1 = new XYSeries("Humidit station 1");
            XYSeries s2 = new XYSeries("Humidit station 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getHumidite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getHumidite()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getHumidite())
                            - Double.parseDouble(t2.get(i).getHumidite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getHumidite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getHumidite()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getHumidite())
                            - Double.parseDouble(t2.get(i).getHumidite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                }
            }
        }

        else if (c == "Nbulosit") {
            XYSeries s1 = new XYSeries("Nbulosit station 1");
            XYSeries s2 = new XYSeries("Nbulosit station 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getNebulosite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getNebulosite()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getNebulosite())
                            - Double.parseDouble(t2.get(i).getNebulosite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getNebulosite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getNebulosite()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getNebulosite())
                            - Double.parseDouble(t2.get(i).getNebulosite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                }
            }
        }
    }
    // XYSeries s3 = new XYSeries("Nebulosit");
    //  Controller c = new Controller();
    // Controller c2 = new Controller();
    // c.AfficherStationMoyenneTousLesJours();

    //***************** comparaison temperature 

    if (t2.size() <= t1.size()) {
        if (c == "Temperature") {
            XYSeries s1 = new XYSeries("Temperature station 1");
            XYSeries s2 = new XYSeries("Temperature tation 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getTemperature()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getTemperature()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getTemperature())
                            - Double.parseDouble(t2.get(i).getTemperature());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);

                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getTemperature()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getTemperature()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getTemperature())
                            - Double.parseDouble(t2.get(i).getTemperature());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;

                }
            }
        } else if (c == "Humidit") {
            XYSeries s1 = new XYSeries("Humidit station 1");
            XYSeries s2 = new XYSeries("Humidit station 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getHumidite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getHumidite()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getHumidite())
                            - Double.parseDouble(t2.get(i).getHumidite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getHumidite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getHumidite()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getHumidite())
                            - Double.parseDouble(t2.get(i).getHumidite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                }
            }
        }

        else if (c == "Nbulosit") {
            XYSeries s1 = new XYSeries("Nbulosit station 1");
            XYSeries s2 = new XYSeries("Nbulosit station 2");
            XYSeries s3 = new XYSeries("rsultante");
            for (int i = 0; i < t1.size(); i++) {
                if (t1.get(i).getJour().getJour() == 0) {
                    s1.add(Double.parseDouble("" + t1.get(i).getMois().getMois()),
                            Double.parseDouble(t1.get(i).getNebulosite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getMois().getMois()),
                            Double.parseDouble(t2.get(i).getNebulosite()));
                    Double d = Double.parseDouble("" + t1.get(i).getMois().getMois());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getNebulosite())
                            - Double.parseDouble(t2.get(i).getNebulosite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                } else {
                    s1.add(Double.parseDouble("" + t1.get(i).getJour().getJour()),
                            Double.parseDouble(t1.get(i).getNebulosite()));
                    s2.add(Double.parseDouble("" + t2.get(i).getJour().getJour()),
                            Double.parseDouble(t2.get(i).getNebulosite()));
                    Double d = Double.parseDouble("" + t1.get(i).getJour().getJour());
                    if (d < 0)
                        d = -d;
                    Double f = Double.parseDouble(t1.get(i).getNebulosite())
                            - Double.parseDouble(t2.get(i).getNebulosite());
                    if (f < 0)
                        f = -f;
                    s3.add(d, f);
                    XYSeriesCollection dataset = new XYSeriesCollection();
                    dataset.addSeries(s1);
                    dataset.addSeries(s2);
                    dataset.addSeries(s3);
                    dataset1 = dataset;
                }
            }
        }
    }

    /*for (ReleveMeteo i : t1.getStationRecherchee())
     {
    System.out.println(i.getTemperature());   
       if(i.getJour().getJour() == 0){
      s1.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getTemperature()));
     // s2.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getHumidite()));
      //s3.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getNebulosite()));
       }
       else{
      s1.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getTemperature()));
      //s2.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getHumidite()));
      //s3.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getNebulosite()));
       }
               
     }  
             
      for (ReleveMeteo i : t2.getStationRecherchee())
     {
    System.out.println(i.getTemperature());   
       if(i.getJour().getJour() == 0){
      s2.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getTemperature()));
     // s2.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getHumidite()));
      //s3.add(Double.parseDouble(""+i.getMois().getMois()), Double.parseDouble(i.getNebulosite()));
       }
       else{
      s2.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getTemperature()));
      //s2.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getHumidite()));
      //s3.add(Double.parseDouble(""+i.getJour().getJour()), Double.parseDouble(i.getNebulosite()));
       }
               
     }  
     */

    return dataset1;
    //  dataset.addSeries(s3);
}

From source file:org.drools.planner.benchmark.core.statistic.calculatecount.CalculateCountProblemStatistic.java

protected void writeGraphStatistic() {
    XYSeriesCollection seriesCollection = new XYSeriesCollection();
    for (SingleBenchmark singleBenchmark : problemBenchmark.getSingleBenchmarkList()) {
        CalculateCountSingleStatistic singleStatistic = (CalculateCountSingleStatistic) singleBenchmark
                .getSingleStatistic(problemStatisticType);
        XYSeries series = new XYSeries(singleBenchmark.getSolverBenchmark().getName());
        for (CalculateCountSingleStatisticPoint point : singleStatistic.getPointList()) {
            long timeMillisSpend = point.getTimeMillisSpend();
            long calculateCountPerSecond = point.getCalculateCountPerSecond();
            series.add(timeMillisSpend, calculateCountPerSecond);
        }//from  www.j a  v a2s.  com
        seriesCollection.addSeries(series);
    }
    NumberAxis xAxis = new NumberAxis("Time spend");
    xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat());
    NumberAxis yAxis = new NumberAxis("Calculate count per second");
    yAxis.setAutoRangeIncludesZero(false);
    XYItemRenderer renderer = new XYLineAndShapeRenderer();
    XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer);
    plot.setOrientation(PlotOrientation.VERTICAL);
    JFreeChart chart = new JFreeChart(problemBenchmark.getName() + " calculate count statistic",
            JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    BufferedImage chartImage = chart.createBufferedImage(1024, 768);
    graphStatisticFile = new File(problemBenchmark.getProblemReportDirectory(),
            problemBenchmark.getName() + "CalculateCountStatistic.png");
    OutputStream out = null;
    try {
        out = new FileOutputStream(graphStatisticFile);
        ImageIO.write(chartImage, "png", out);
    } catch (IOException e) {
        throw new IllegalArgumentException("Problem writing graphStatisticFile: " + graphStatisticFile, e);
    } finally {
        IOUtils.closeQuietly(out);
    }
}

From source file:Main.Chart.java

/**
 * Creates a sample dataset.//  w ww . j  a v  a 2s.c om
 * 
 * @return a sample dataset.
 */
private XYDataset createDataset(WeatherData wd) {

    final XYSeries series1 = new XYSeries("Temperature");
    final XYSeries series2 = new XYSeries("Wind speed");

    TimeSerie first = wd.getTimeseries().get(0);

    int offset = first.getValidTime().get(Calendar.HOUR_OF_DAY);

    for (int i = 0; i < wd.getTimeseries().size(); i++) {
        TimeSerie temp = wd.getTimeseries().get(i);
        series1.add(offset + i, temp.getT());
        series2.add(offset + i, temp.getWs());
    }

    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);

    return dataset;

}

From source file:edu.gmu.cs.sim.util.media.chart.TimeSeriesChartGenerator.java

protected void buildChart() {
    XYSeriesCollection collection = new XYSeriesCollection();

    chart = ChartFactory.createXYLineChart("Untitled Chart", "Untitled X Axis", "Untitled Y Axis", collection,
            PlotOrientation.VERTICAL, false, true, false);
    ((XYLineAndShapeRenderer) (((XYPlot) (chart.getPlot())).getRenderer())).setDrawSeriesLineAsPath(true);

    chart.setAntiAlias(true);/*from   www. j  a  va 2 s  . c om*/
    //chartPanel = new ScrollableChartPanel(chart, true); 
    chartPanel = buildChartPanel(chart);
    setChartPanel(chartPanel);
    //        chartHolder.getViewport().setView(chartPanel);

    // this must come last because the chart must exist for us to set its dataset
    setSeriesDataset(collection);
}

From source file:cs.register.geraGrafico.java

private XYDataset datarank(List<partida> list1) {
    XYSeriesCollection data = new XYSeriesCollection();
    XYSeries ser = new XYSeries("kda");
    for (partida p : list1) {
        ser.add(list1.indexOf(p) + 1, p.getRank());
    }/*w ww  . ja  va2  s .c  om*/
    data.addSeries(ser);

    return data;
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileChartPanelEditor.java

private Component createChartPanel() {
    depthSerie = new XYSeries("depth");
    XYSeriesCollection depthCollection = new XYSeriesCollection();
    depthCollection.addSeries(depthSerie);

    JFreeChart chart = ChartFactory.createXYLineChart("",
            I18nResourceManager.sharedInstance().getString("time"),
            I18nResourceManager.sharedInstance().getString("depth"), depthCollection, PlotOrientation.VERTICAL,
            true, true, false);/*  ww w  .j  ava2  s .c om*/
    plot = chart.getXYPlot();
    Paint p = new GradientPaint(0f, 0f, UIAgent.getInstance().getColorWaterBottom(), 200f, 200f,
            UIAgent.getInstance().getColorWaterSurface(), false);
    plot.setBackgroundPaint(p);

    XYAreaRenderer renderer0 = new XYAreaRenderer();
    renderer0.setOutline(true);
    renderer0.setBaseOutlinePaint(UIAgent.getInstance().getColorProfileEdition());

    Color baseColor = UIAgent.getInstance().getColorBaseBackground();
    renderer0.setSeriesPaint(0, new Color(baseColor.getRed(), baseColor.getGreen(), baseColor.getBlue(), 50));
    plot.setRenderer(0, renderer0);

    dAxis = new NumberAxis();
    rAxis = new NumberAxis();
    // dAxis.setAutoRange(false);
    // rAxis.setAutoRange(false);
    // dAxis.setRange(0, maxTime);
    // rAxis.setRange(lowestDepth, 0);
    plot.setDomainAxis(dAxis);
    plot.setRangeAxis(rAxis);

    // plot.setRangeCrosshairLockedOnData(false);
    // plot.setDomainCrosshairLockedOnData(false);
    ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride(new MinutesNumberFormat());

    panel = new ChartPanel(chart);
    // panel.addChartMouseListener(new ChartMouseListener() {
    //
    // @Override
    // public void chartMouseMoved(ChartMouseEvent arg0) {
    // // TODO Auto-generated method stub
    //
    // }
    //
    // @Override
    // public void chartMouseClicked(ChartMouseEvent evt) {
    //
    // double x = plot.getDomainAxis().java2DToValue(
    // panel.translateScreenToJava2D(
    // evt.getTrigger().getPoint()).getX(),
    // panel.getChartRenderingInfo().getPlotInfo()
    // .getDataArea(), plot.getDomainAxisEdge());
    //
    // double y = plot.getRangeAxis().java2DToValue(
    // panel.translateScreenToJava2D(
    // evt.getTrigger().getPoint()).getY(),
    // panel.getChartRenderingInfo().getPlotInfo()
    // .getDataArea(), plot.getRangeAxisEdge());
    //
    // diveProfileEditor.addEntry(x, y, this);
    // }
    // });

    createDecoWarningCollection();
    createAscentTooFastCollection();
    createRemainBottomTimeCollection();
    createDecoEntriesCollection();

    return panel;
}