1 | package de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation; |
2 | |
3 | import java.util.Collection; |
4 | |
5 | import org.eclipse.swt.widgets.Composite; |
6 | import org.jfree.data.xy.DefaultTableXYDataset; |
7 | import org.jfree.data.xy.XYSeries; |
8 | |
9 | import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.Histogram; |
10 | |
11 | public abstract class AbstractJFreeChartWidthViewer extends |
12 | AbstractJFreeChartChart<Histogram> { |
13 | |
14 | protected Collection<Histogram> lastData; |
15 | |
16 | protected DefaultTableXYDataset densityDataset=new DefaultTableXYDataset(); |
17 | |
18 | |
19 | public AbstractJFreeChartWidthViewer(Composite parent, int style) { |
20 | super(parent, style); |
21 | } |
22 | |
23 | public void setData(Collection<Histogram> data) { |
24 | densityDataset.removeAllSeries(); |
25 | |
26 | for (Histogram h : data) { |
27 | densityDataset.addSeries(computeDensities(h)); |
28 | } |
29 | initChart(); |
30 | |
31 | this.setChart(chart); |
32 | this.forceRedraw(); |
33 | |
34 | lastData = data; |
35 | } |
36 | |
37 | protected abstract XYSeries computeDensities(Histogram hist); |
38 | } |