Example usage for org.jfree.data.xy XIntervalSeriesCollection addSeries

List of usage examples for org.jfree.data.xy XIntervalSeriesCollection addSeries

Introduction

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

Prototype

public void addSeries(XIntervalSeries series) 

Source Link

Document

Adds a series to the collection and sends a DatasetChangeEvent to all registered listeners.

Usage

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Build content for animationType StatisticGrafic.ANIMATION_Histogram
 * @return// w  w  w.  j  a  v  a 2  s.c om
 * @throws ModelException
 */
private JPanel buildHistogramPanel() throws ModelException {
    XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();
    dataset.addSeries(this.statistic.getHistogram());
    this.chart = ChartFactory.createXYBarChart(null, "Observation", false, "Count", dataset,
            PlotOrientation.VERTICAL, false, true, false);
    this.chart.setBackgroundPaint(Grafic.COLOR_BACKGROUND);
    XYPlot plot = this.chart.getXYPlot();
    plot.setBackgroundPaint(StatisticGrafic.DIAGRAM_BACKGROUND);
    plot.setDomainGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
    plot.setRangeGridlinePaint(StatisticGrafic.DIAGRAM_GRID);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    ValueAxis rangeAxis = (ValueAxis) plot.getRangeAxis();
    rangeAxis.setLabelFont(Grafic.FONT_DEFAULT);
    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLabelFont(Grafic.FONT_DEFAULT);
    domainAxis.setAutoRange(true);

    XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
    renderer.setShadowVisible(false);
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setDrawBarOutline(true);
    renderer.setSeriesPaint(0, StatisticGrafic.DIAGRAM_FORGROUND);
    renderer.setSeriesOutlinePaint(0, StatisticGrafic.DIAGRAM_BORDER);
    renderer.setSeriesOutlineStroke(0, new BasicStroke(1.0f));

    this.buildHistogramAxisFormat(plot, "Observations");
    JPanel out = new ChartPanel(chart);
    out.setPreferredSize(new Dimension(350, 200));
    return out;
}

From source file:org.esa.beam.visat.toolviews.stat.StatisticsPanel.java

private static ChartPanel createChartPanel(XIntervalSeries percentileSeries, String xAxisLabel,
        String yAxisLabel, Color color, double domainBounds[], double rangeBounds[]) {
    XIntervalSeriesCollection percentileDataset = new XIntervalSeriesCollection();
    percentileDataset.addSeries(percentileSeries);
    return getHistogramPlotPanel(percentileDataset, xAxisLabel, yAxisLabel, color, domainBounds, rangeBounds);
}

From source file:org.esa.beam.visat.toolviews.stat.StatisticsPanel.java

private static ChartPanel createScatterChartPanel(XIntervalSeries percentileSeries, String xAxisLabel,
        String yAxisLabel, Color color, double domainBounds[], double rangeBounds[]) {
    XIntervalSeriesCollection percentileDataset = new XIntervalSeriesCollection();
    percentileDataset.addSeries(percentileSeries);
    return getScatterPlotPanel(percentileDataset, xAxisLabel, yAxisLabel, color, domainBounds, rangeBounds);
}

From source file:org.jax.haplotype.analysis.visualization.GenomicGraphFactory.java

/**
 * Convert the intervals & values to a dataset that JFreeChart can use
 * @param snpIntervals/*from  w  w  w  .  ja v  a  2 s.  c o  m*/
 *          the intervals
 * @param visualInterval
 *          the visual interval that we should use
 * @return
 *          the data set
 */
private XYDataset createSnpIntervalHistogramData(final List<? extends RealValuedBasePairInterval> snpIntervals,
        final HighlightedSnpInterval visualInterval) {
    XIntervalSeriesCollection dataset = new XIntervalSeriesCollection();

    XIntervalSeries series = new XIntervalSeries("Interval Values", false, true);
    XIntervalSeries highlightSeries = new XIntervalSeries("Highlighted Interval Values", false, true);

    int endIndex = visualInterval.getEndIndex();
    int[] highlightIndices = visualInterval.getIndicesToHighlight();
    for (int i = visualInterval.getStartIndex(); i <= endIndex; i++) {
        RealValuedBasePairInterval currSnpInterval = snpIntervals.get(i);

        boolean highlight = false;
        for (int j = 0; j < highlightIndices.length; j++) {
            if (i == highlightIndices[j]) {
                highlight = true;
                break;
            }
        }

        if (highlight) {
            highlightSeries.add(currSnpInterval.getStartInBasePairs(), currSnpInterval.getStartInBasePairs(),
                    currSnpInterval.getEndInBasePairs(), currSnpInterval.getRealValue());
        } else {
            series.add(currSnpInterval.getStartInBasePairs(), currSnpInterval.getStartInBasePairs(),
                    currSnpInterval.getEndInBasePairs(), currSnpInterval.getRealValue());
        }
    }

    dataset.addSeries(series);
    dataset.addSeries(highlightSeries);
    return dataset;
}