EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation]

COVERAGE SUMMARY FOR SOURCE FILE [JFreeChartHistogramViewer.java]

nameclass, %method, %block, %line, %
JFreeChartHistogramViewer.java0%   (0/1)0%   (0/7)0%   (0/140)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class JFreeChartHistogramViewer0%   (0/1)0%   (0/7)0%   (0/140)0%   (0/28)
JFreeChartHistogramViewer (Composite, int): void 0%   (0/1)0%   (0/5)0%   (0/2)
addHistogram (Histogram): void 0%   (0/1)0%   (0/39)0%   (0/8)
computeDensities (Histogram): XYSeries 0%   (0/1)0%   (0/33)0%   (0/4)
getHistogramWidth (): double 0%   (0/1)0%   (0/4)0%   (0/1)
getSeries (): XYSeries 0%   (0/1)0%   (0/5)0%   (0/1)
initChart (): void 0%   (0/1)0%   (0/32)0%   (0/7)
initializeContextMenu (MenuManager): void 0%   (0/1)0%   (0/22)0%   (0/5)

1package de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation;
2 
3import org.eclipse.jface.action.MenuManager;
4import org.eclipse.swt.widgets.Composite;
5import org.jfree.chart.ChartFactory;
6import org.jfree.chart.plot.PlotOrientation;
7import org.jfree.chart.plot.XYPlot;
8import org.jfree.data.xy.XYSeries;
9 
10import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.Histogram;
11import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.HistogramBucketInformation;
12 
13 
14public class JFreeChartHistogramViewer extends AbstractJFreeChartWidthViewer
15        implements IHistogramAccepter, IHistSeriesExporter {
16 
17        public JFreeChartHistogramViewer(Composite parent, int style) {
18                super(parent, style);
19        }
20 
21        @Override
22        protected void initializeContextMenu(MenuManager menu_manager) {
23                super.initializeContextMenu(menu_manager);
24            menu_manager.add(new LoadCSVHistogram(this));
25            menu_manager.add(new ExportCSV(this));
26            menu_manager.add(new ExportDoublePDF(this));
27        }
28 
29        public void addHistogram(Histogram histogram) {
30                XYSeries density = new XYSeries(histogram.getTitle(),true,false);
31                for (HistogramBucketInformation e : histogram.getBucketInformation())
32                        density.add(e.getValue(), e.getProbability());
33                densityDataset.addSeries(density);
34                densityDataset.setAutoWidth(true);
35                initChart();
36                this.redraw();
37        }
38 
39        protected void initChart() {
40                chart = ChartFactory.createHistogram("Histogram","Time","Probability", densityDataset,PlotOrientation.VERTICAL,true,true,true);
41 
42                XYPlot plot = (XYPlot)chart.getPlot();
43                plot.getRangeAxis().setAutoRange(true);
44                plot.setForegroundAlpha(0.8f); // for transparency
45                if (densityDataset != null)
46                        densityDataset.setAutoWidth(true);
47        }
48        
49        protected XYSeries computeDensities(Histogram hist) {
50                XYSeries density;
51                density = new XYSeries(hist.getTitle(),true,false);
52                for (HistogramBucketInformation bucketInformation : hist.getBucketInformation()) {
53                        density.add(bucketInformation.getValue() + hist.getBucketWidth() / 2, bucketInformation.getProbability());
54                }
55                return density;
56        }
57 
58        public XYSeries getSeries() {
59                return densityDataset.getSeries(0);
60        }
61 
62        public double getHistogramWidth() {
63                return densityDataset.getIntervalWidth();
64        }
65 
66}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.jfreechartvisualisation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov