1 | /* |
---|
2 | Copyright 2006 by Sean Luke |
---|
3 | Licensed under the Academic Free License version 3.0 |
---|
4 | See the file "LICENSE" for more information |
---|
5 | */ |
---|
6 | |
---|
7 | |
---|
8 | /*
|
---|
9 | * Created on Apr 16, 2005 12:25:57 PM
|
---|
10 | *
|
---|
11 | * By: spaus, Hovden
|
---|
12 | */
|
---|
13 | package ec.display.chart;
|
---|
14 |
|
---|
15 | import org.jfree.chart.ChartFactory;
|
---|
16 | import org.jfree.chart.JFreeChart;
|
---|
17 | import org.jfree.chart.plot.PlotOrientation;
|
---|
18 | import org.jfree.data.xy.XYSeries;
|
---|
19 | import org.jfree.data.xy.XYSeriesCollection;
|
---|
20 |
|
---|
21 | import ec.EvolutionState;
|
---|
22 | import ec.util.Parameter;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * @author spaus
|
---|
26 | */
|
---|
27 | public abstract class XYSeriesChartStatistics
|
---|
28 | extends ChartableStatistics
|
---|
29 | {
|
---|
30 |
|
---|
31 | public XYSeriesCollection seriesCollection;
|
---|
32 |
|
---|
33 | public void setup(EvolutionState state, Parameter base)
|
---|
34 | {
|
---|
35 | super.setup(state, base);
|
---|
36 |
|
---|
37 | seriesCollection = new XYSeriesCollection();
|
---|
38 |
|
---|
39 | }
|
---|
40 |
|
---|
41 | public JFreeChart makeChart(){
|
---|
42 | JFreeChart chart = ChartFactory.createXYLineChart(this.title,this.xlabel,this.ylabel,this.seriesCollection,PlotOrientation.VERTICAL,true,false,false);
|
---|
43 |
|
---|
44 | return chart;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public int addSeries(String name)
|
---|
48 | {
|
---|
49 | seriesCollection.addSeries(new XYSeries(name));
|
---|
50 | return seriesCollection.getSeriesCount()-1;
|
---|
51 | }
|
---|
52 |
|
---|
53 | public void addDataPoint(int seriesID, double x, double y)
|
---|
54 | {
|
---|
55 | seriesCollection.getSeries(seriesID).add(x,y);
|
---|
56 | }
|
---|
57 | }
|
---|