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.category.DefaultCategoryDataset;
|
---|
19 |
|
---|
20 | import ec.EvolutionState;
|
---|
21 | import ec.util.Parameter;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @author spaus
|
---|
25 | */
|
---|
26 | public class BarChartStatistics
|
---|
27 | extends ChartableStatistics
|
---|
28 | {
|
---|
29 |
|
---|
30 | public DefaultCategoryDataset dataset;
|
---|
31 |
|
---|
32 | public void setup(EvolutionState state, Parameter base)
|
---|
33 | {
|
---|
34 | super.setup(state, base);
|
---|
35 | dataset = new DefaultCategoryDataset();
|
---|
36 |
|
---|
37 | }
|
---|
38 |
|
---|
39 | public JFreeChart makeChart(){
|
---|
40 | JFreeChart chart = ChartFactory.createBarChart(this.title,
|
---|
41 | this.xlabel,this.ylabel, this.dataset, PlotOrientation.VERTICAL,
|
---|
42 | false, true, false);
|
---|
43 |
|
---|
44 | return chart;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public void makeBar(int seriesID, double[] genes)
|
---|
48 | {
|
---|
49 | for (int i = 0; i < genes.length; i++)
|
---|
50 | {
|
---|
51 | dataset.setValue(genes[i], "Genome "+seriesID, String.valueOf(i));
|
---|
52 | }
|
---|
53 | }
|
---|
54 |
|
---|
55 | }
|
---|