Java 类org.jfree.data.xy.YIntervalSeriesCollection 实例源码

项目:shabdiz    文件:StateChangeOverlaidAnalyzer.java   
@Override
public JFreeChart getChart() throws IOException {

    if (chart == null) {
        final YIntervalSeriesCollection series_collection = getDataset();

        chart = ChartFactory.createXYLineChart("Change of state over time", "Time through experiment (s)", "Number of instances", series_collection, PlotOrientation.VERTICAL, true, false, false);
        final XYErrorRenderer error_renderer = new XYErrorRenderer();
        error_renderer.setBaseShapesVisible(false);
        error_renderer.setBaseLinesVisible(true);
        error_renderer.setDrawYError(false);
        final XYPlot plot = chart.getXYPlot();
        plot.getRangeAxis().setLowerBound(0);
        plot.setRenderer(error_renderer);

        PlainChartTheme.applyTheme(chart);
    }
    return chart;
}
项目:shabdiz    文件:OverlaidGaugeCsvAnalyzer.java   
@Override
public JFreeChart getChart() throws IOException {

    if (chart == null) {
        final YIntervalSeriesCollection series_collection = getDataset();

        chart = ChartFactory.createXYLineChart(chart_title, "Time through experiment (s)", y_axis_label, series_collection, PlotOrientation.VERTICAL, getDataset().getSeriesCount() > 1, false, false);
        final XYErrorRenderer error_renderer = new XYErrorRenderer();
        error_renderer.setBaseShapesVisible(false);
        error_renderer.setBaseLinesVisible(true);
        error_renderer.setDrawYError(false);
        final XYPlot plot = chart.getXYPlot();
        plot.getRangeAxis().setLowerBound(0);
        plot.setRenderer(error_renderer);
        PlainChartTheme.applyTheme(chart);
    }
    return chart;
}
项目:shabdiz    文件:DatasetUtils.java   
public static JSONArray toJson(YIntervalSeriesCollection dataset) throws JSONException {

        final JSONArray json = new JSONArray();

        for (int series_index = 0; series_index < dataset.getSeriesCount(); series_index++) {

            final YIntervalSeries series = dataset.getSeries(series_index);
            final String series_key = dataset.getSeriesKey(series_index).toString();

            for (int item_index = 0; item_index < series.getItemCount(); item_index++) {
                final JSONObject item_value = new JSONObject();
                item_value.put("series_key", series_key);
                item_value.put("x", format(series.getX(item_index)));
                item_value.put("y", format(series.getYValue(item_index)));
                item_value.put("y_low", format(series.getYLowValue(item_index)));
                item_value.put("y_high", format(series.getYHighValue(item_index)));

                json.put(item_value);
            }
        }

        return json;
    }
项目:parabuild-ci    文件:YIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    YIntervalSeriesCollection c1 = new YIntervalSeriesCollection();
    YIntervalSeriesCollection c2 = new YIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    YIntervalSeries s1 = new YIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    YIntervalSeries s2 = new YIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new YIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new YIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:DOO-Q_BRACIS2016    文件:MultiAgentPerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:DOO-Q_BRACIS2016    文件:PerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:DOO-Q_BRACIS2016    文件:MultiAgentPerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:DOO-Q_BRACIS2016    文件:PerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:nabs    文件:YIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    YIntervalSeriesCollection c1 = new YIntervalSeriesCollection();
    YIntervalSeriesCollection c2 = new YIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    YIntervalSeries s1 = new YIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    YIntervalSeries s2 = new YIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new YIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new YIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:astor    文件:YIntervalSeriesCollectionTests.java   
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    YIntervalSeriesCollection c1 = new YIntervalSeriesCollection();
    YIntervalSeriesCollection c2 = new YIntervalSeriesCollection();
    assertEquals(c1, c2);

    // add a series
    YIntervalSeries s1 = new YIntervalSeries("Series");
    s1.add(1.0, 1.1, 1.2, 1.3);
    c1.addSeries(s1);
    assertFalse(c1.equals(c2));
    YIntervalSeries s2 = new YIntervalSeries("Series");
    s2.add(1.0, 1.1, 1.2, 1.3);
    c2.addSeries(s2);
    assertTrue(c1.equals(c2));

    // add an empty series
    c1.addSeries(new YIntervalSeries("Empty Series"));
    assertFalse(c1.equals(c2));
    c2.addSeries(new YIntervalSeries("Empty Series"));
    assertTrue(c1.equals(c2));
}
项目:PeerfactSimKOM_Clone    文件:MetricsPlot.java   
private DeviationRenderer configureRendererForDataSet(XYItemRenderer r,
        YIntervalSeriesCollection dataSet) {
    DeviationRenderer renderer = (DeviationRenderer) r;
    YIntervalSeries serie = null;
    for (int i = 0; i < dataSet.getSeriesCount(); i++) {
        serie = dataSet.getSeries(i);
        renderer.setSeriesStroke(i, displayedSeries.get(serie.getKey())
                .getStroke());
        renderer.setSeriesPaint(i, displayedSeries.get(serie.getKey())
                .getColor());
        renderer.setSeriesFillPaint(i, Color.LIGHT_GRAY);

    }
    if (showSdtDev) {
        renderer.setAlpha(0.3f);
    }
    return renderer;
}
项目:burlap    文件:MultiAgentPerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:burlap    文件:PerformancePlotter.java   
/**
 * Adds the most recent trial (if enabled) chart and trial average (if enabled) chart into the provided container.
 * The GridBagConstraints will aumatically be incremented to the next position after this method returns.
 * @param plotContainer the contain in which to insert the plot(s).
 * @param c the current grid bag contraint locaiton in which the plots should be inserted.
 * @param columns the number of columns to fill in the plot container
 * @param chartWidth the width of any single plot
 * @param chartHeight the height of any single plot
 * @param title the title to label thep plot; if average trial plots are enabled the word "Average" will be prepended to the title for the average plot.
 * @param xlab the xlab axis of the plot
 * @param ylab the y lab axis of the plot
 * @param mostRecentCollection the XYSeriesCollection dataset with which the most recent trial plot is associated 
 * @param averageCollection the YIntervalSeriesCollection dataset with which the trial average plot is associated
 */
protected void insertChart(Container plotContainer, GridBagConstraints c, int columns, int chartWidth, int chartHeight,
        String title, String xlab, String ylab, XYSeriesCollection mostRecentCollection, YIntervalSeriesCollection averageCollection){

    if(this.trialMode.mostRecentTrialEnabled()){
        final JFreeChart chartCSR = ChartFactory.createXYLineChart(title, xlab, ylab, mostRecentCollection);
        ChartPanel chartPanelCSR = new ChartPanel(chartCSR);
        chartPanelCSR.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSR, c);
        this.updateGBConstraint(c, columns);
    }

    if(this.trialMode.averagesEnabled()){
        final JFreeChart chartCSRAvg = ChartFactory.createXYLineChart("Average " + title, xlab, ylab, averageCollection);
        ((XYPlot)chartCSRAvg.getPlot()).setRenderer(this.createDeviationRenderer());
        ChartPanel chartPanelCSRAvg = new ChartPanel(chartCSRAvg);
        chartPanelCSRAvg.setPreferredSize(new java.awt.Dimension(chartWidth, chartHeight));
        plotContainer.add(chartPanelCSRAvg, c);
        this.updateGBConstraint(c, columns);
    }
}
项目:ccu-historian    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtils.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtils.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtils.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtils.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtils.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtils.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:ECG-Viewer    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:ECG-Viewer    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:astor    文件:YIntervalRendererTests.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:astor    文件:DatasetUtilitiesTests.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:group-five    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:group-five    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:BfROpenLab    文件:ChartCreator.java   
private XYDataset createFunctionDataSet(Plotable plotable, String id, double minX, double maxX)
        throws ParseException, UnitException {
    double[][] points = plotable.getFunctionPoints(varX, varY, minX, maxX);

    if (points == null) {
        return null;
    }

    double[][] functionErrors = null;

    if (showConfidence || showPrediction) {
        functionErrors = plotable.getFunctionErrors(varX, varY, minX, maxX, showPrediction);
    }

    if (functionErrors != null) {
        YIntervalSeriesCollection functionDataset = new YIntervalSeriesCollection();
        YIntervalSeries series = new YIntervalSeries(legend.get(id));

        for (int j = 0; j < points[0].length; j++) {
            double error = Double.isNaN(functionErrors[1][j]) ? 0.0 : functionErrors[1][j];

            series.add(points[0][j], points[1][j], points[1][j] - error, points[1][j] + error);
        }

        functionDataset.addSeries(series);

        return functionDataset;
    } else {
        DefaultXYDataset dataSet = new DefaultXYDataset();

        dataSet.addSeries(legend.get(id), points);

        return dataSet;
    }
}
项目:PeerfactSimKOM_Clone    文件:MetricsPlot.java   
private void createChartPanel(String title, long time) {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    chart = ChartFactory.createTimeSeriesChart(title, X_AXIS_TITLE, "",
            dataset, true, true, true);
    XYPlot plot = (XYPlot) chart.getPlot();

    DeviationRenderer errorRenderer = new DeviationRenderer();
    errorRenderer.setShapesVisible(false);
    errorRenderer.setLinesVisible(true);
    errorRenderer.setAlpha(0.0f);
    // errorRenderer.setDrawYError(false);
    // errorRenderer.setDrawXError(false);
    plot.setRenderer(errorRenderer);

    plot.setBackgroundPaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    upperDomainBound = (time / 1000) + ((interval - 1) * step / 1000);
    DateAxis domain = (DateAxis) plot.getDomainAxis();
    domain.setAutoRange(false);
    domain.setRange((time / 1000), upperDomainBound);
    RelativeDateFormat rdf = new RelativeDateFormat();
    rdf.setHourSuffix(":");
    rdf.setMinuteSuffix(":");
    rdf.setSecondSuffix("");
    rdf.setSecondFormatter(new DecimalFormat("0"));
    domain.setDateFormatOverride(rdf);
    plot.setDomainAxis(domain);
    plotPanel = new ChartPanel(chart, true);
    setSizeOfComponent(plotPanel, new Dimension(plotWidth, plotHeight));
    container.add(plotPanel, BorderLayout.CENTER);
    container.add(createRadioBoxes(visType == VisualizationType.Metric),
            BorderLayout.SOUTH);
    setSizeOfComponent(container, new Dimension(plotWidth, plotHeight
            + boxOffset));
}
项目:buffer_bci    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:buffer_bci    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:proyecto-teoria-control-utn-frro    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:proyecto-teoria-control-utn-frro    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:Memetic-Algorithm-for-TSP    文件:YIntervalRendererTest.java   
/**
 * A check for the datasetIndex and seriesIndex fields in the LegendItem
 * returned by the getLegendItem() method.
 */
@Test
public void testGetLegendItemSeriesIndex() {
    YIntervalSeriesCollection d1 = new YIntervalSeriesCollection();
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s2 = new YIntervalSeries("S2");
    s2.add(1.0, 1.1, 1.2, 1.3);
    d1.addSeries(s1);
    d1.addSeries(s2);

    YIntervalSeriesCollection d2 = new YIntervalSeriesCollection();
    YIntervalSeries s3 = new YIntervalSeries("S3");
    s3.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s4 = new YIntervalSeries("S4");
    s4.add(1.0, 1.1, 1.2, 1.3);
    YIntervalSeries s5 = new YIntervalSeries("S5");
    s5.add(1.0, 1.1, 1.2, 1.3);
    d2.addSeries(s3);
    d2.addSeries(s4);
    d2.addSeries(s5);

    YIntervalRenderer r = new YIntervalRenderer();
    XYPlot plot = new XYPlot(d1, new NumberAxis("x"),
            new NumberAxis("y"), r);
    plot.setDataset(1, d2);
    /*JFreeChart chart =*/ new JFreeChart(plot);
    LegendItem li = r.getLegendItem(1, 2);
    assertEquals("S5", li.getLabel());
    assertEquals(1, li.getDatasetIndex());
    assertEquals(2, li.getSeriesIndex());
}
项目:Memetic-Algorithm-for-TSP    文件:DatasetUtilitiesTest.java   
/**
 * Some checks for the range bounds of a dataset that implements the
 * {@link IntervalXYDataset} interface.
 */
@Test
public void testIterateRangeBounds4() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.iterateRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);
}
项目:rapidminer    文件:ROCChartPlotter.java   
protected void prepareData() {

        this.dataset = new YIntervalSeriesCollection();

        Iterator<Map.Entry<String, List<ROCData>>> r = rocDataLists.entrySet().iterator();
        boolean showThresholds = true;
        if (rocDataLists.size() > 1) {
            showThresholds = false;
        }

        while (r.hasNext()) {
            Map.Entry<String, List<ROCData>> entry = r.next();
            YIntervalSeries rocSeries = new YIntervalSeries(entry.getKey());
            YIntervalSeries thresholdSeries = new YIntervalSeries(entry.getKey() + " (Thresholds)");
            List<ROCData> dataList = entry.getValue();
            for (int i = 0; i <= NUMBER_OF_POINTS; i++) {

                double rocSum = 0.0d;
                double rocSquaredSum = 0.0d;
                double thresholdSum = 0.0d;
                double thresholdSquaredSum = 0.0d;
                for (ROCData data : dataList) {
                    double rocValue = data.getInterpolatedTruePositives(i / (double) NUMBER_OF_POINTS)
                            / data.getTotalPositives();
                    rocSum += rocValue;
                    rocSquaredSum += rocValue * rocValue;

                    double thresholdValue = data.getInterpolatedThreshold(i / (double) NUMBER_OF_POINTS);
                    thresholdSum += thresholdValue;
                    thresholdSquaredSum += thresholdValue * thresholdValue;
                }

                double rocMean = rocSum / dataList.size();
                double rocDeviation = Math.sqrt(rocSquaredSum / dataList.size() - (rocMean * rocMean));
                rocSeries.add(i / (double) NUMBER_OF_POINTS, rocMean, rocMean - rocDeviation, rocMean + rocDeviation);

                double thresholdMean = thresholdSum / dataList.size();
                double thresholdDeviation = Math.sqrt(thresholdSquaredSum / dataList.size()
                        - (thresholdMean * thresholdMean));
                thresholdSeries.add(i / (double) NUMBER_OF_POINTS, thresholdMean, thresholdMean - thresholdDeviation,
                        thresholdMean + thresholdDeviation);

            }
            dataset.addSeries(rocSeries);

            if (showThresholds) {
                dataset.addSeries(thresholdSeries);
            }
        }
    }
项目:rapidminer    文件:CurveCollection.java   
public YIntervalSeriesCollection getCollections() {
    return curves;
}
项目:shabdiz    文件:OverlaidCrossRepetitionPerPropertyAnalyzer.java   
@Override
public YIntervalSeriesCollection getDataset() throws IOException {
    return overlaid_analyzer.getDataset();
}
项目:ccu-historian    文件:DatasetUtilitiesTest.java   
/**
 * A test for the findRangeBounds(XYDataset) method using
 * an IntervalXYDataset.
 */
@Test
public void testFindRangeBounds2() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.findRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);

    // what if we don't want the interval?
    r = DatasetUtilities.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:jfreechart    文件:DatasetUtilsTest.java   
/**
 * A test for the findRangeBounds(XYDataset) method using
 * an IntervalXYDataset.
 */
@Test
public void testFindRangeBounds2() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtils.findRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtils.findRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtils.findRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    r = DatasetUtils.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtils.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtils.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtils.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);

    // what if we don't want the interval?
    r = DatasetUtils.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:aya-lang    文件:DatasetUtilitiesTest.java   
/**
 * A test for the findRangeBounds(XYDataset) method using
 * an IntervalXYDataset.
 */
@Test
public void testFindRangeBounds2() {
    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();
    Range r = DatasetUtilities.findRangeBounds(dataset);
    assertNull(r);
    YIntervalSeries s1 = new YIntervalSeries("S1");
    dataset.addSeries(s1);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertNull(r);

    // try a single item
    s1.add(1.0, 2.0, 1.5, 2.5);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.5, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    r = DatasetUtilities.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);

    // another item
    s1.add(2.0, 2.0, 1.4, 2.1);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // another empty series
    YIntervalSeries s2 = new YIntervalSeries("S2");
    dataset.addSeries(s2);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.5, r.getUpperBound(), EPSILON);

    // an item in series 2
    s2.add(1.0, 2.0, 1.9, 2.6);
    r = DatasetUtilities.findRangeBounds(dataset);
    assertEquals(1.4, r.getLowerBound(), EPSILON);
    assertEquals(2.6, r.getUpperBound(), EPSILON);

    // what if we don't want the interval?
    r = DatasetUtilities.findRangeBounds(dataset, false);
    assertEquals(2.0, r.getLowerBound(), EPSILON);
    assertEquals(2.0, r.getUpperBound(), EPSILON);
}
项目:rapidminer-studio    文件:ROCChartPlotter.java   
private void prepareData() {

        this.dataset = new YIntervalSeriesCollection();

        Iterator<Map.Entry<String, List<ROCData>>> r = rocDataLists.entrySet().iterator();
        boolean showThresholds = true;
        if (rocDataLists.size() > 1) {
            showThresholds = false;
        }

        while (r.hasNext()) {
            Map.Entry<String, List<ROCData>> entry = r.next();
            YIntervalSeries rocSeries = new YIntervalSeries(entry.getKey());
            YIntervalSeries thresholdSeries = new YIntervalSeries(entry.getKey() + " (Thresholds)");
            List<ROCData> dataList = entry.getValue();
            for (int i = 0; i <= NUMBER_OF_POINTS; i++) {

                double rocSum = 0.0d;
                double rocSquaredSum = 0.0d;
                double thresholdSum = 0.0d;
                double thresholdSquaredSum = 0.0d;
                for (ROCData data : dataList) {
                    double rocValue = data.getInterpolatedTruePositives(i / (double) NUMBER_OF_POINTS)
                            / data.getTotalPositives();
                    rocSum += rocValue;
                    rocSquaredSum += rocValue * rocValue;

                    double thresholdValue = data.getInterpolatedThreshold(i / (double) NUMBER_OF_POINTS);
                    thresholdSum += thresholdValue;
                    thresholdSquaredSum += thresholdValue * thresholdValue;
                }

                double rocMean = rocSum / dataList.size();
                double rocDeviation = Math.sqrt(rocSquaredSum / dataList.size() - (rocMean * rocMean));
                rocSeries.add(i / (double) NUMBER_OF_POINTS, rocMean, rocMean - rocDeviation, rocMean + rocDeviation);

                double thresholdMean = thresholdSum / dataList.size();
                double thresholdDeviation = Math.sqrt(thresholdSquaredSum / dataList.size()
                        - (thresholdMean * thresholdMean));
                thresholdSeries.add(i / (double) NUMBER_OF_POINTS, thresholdMean, thresholdMean - thresholdDeviation,
                        thresholdMean + thresholdDeviation);

            }
            dataset.addSeries(rocSeries);

            if (showThresholds) {
                dataset.addSeries(thresholdSeries);
            }
        }
    }