当前位置: 首页>>代码示例>>Java>>正文


Java YIntervalSeries类代码示例

本文整理汇总了Java中org.jfree.data.xy.YIntervalSeries的典型用法代码示例。如果您正苦于以下问题:Java YIntervalSeries类的具体用法?Java YIntervalSeries怎么用?Java YIntervalSeries使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


YIntervalSeries类属于org.jfree.data.xy包,在下文中一共展示了YIntervalSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toJson

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
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;
    }
 
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:24,代码来源:DatasetUtils.java

示例2: testAdd

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * Some checks for the add() method for an UNSORTED series.
 */
public void testAdd() {
    YIntervalSeries series = new YIntervalSeries("Series", false, true);
    series.add(5.0, 5.50, 5.50, 5.50);
    series.add(5.1, 5.51, 5.51, 5.51);
    series.add(6.0, 6.6, 6.6, 6.6);
    series.add(3.0, 3.3, 3.3, 3.3);
    series.add(4.0, 4.4, 4.4, 4.4);
    series.add(2.0, 2.2, 2.2, 2.2);
    series.add(1.0, 1.1, 1.1, 1.1);
    assertEquals(5.5, series.getYValue(0), EPSILON);
    assertEquals(5.51, series.getYValue(1), EPSILON);
    assertEquals(6.6, series.getYValue(2), EPSILON);
    assertEquals(3.3, series.getYValue(3), EPSILON);
    assertEquals(4.4, series.getYValue(4), EPSILON);
    assertEquals(2.2, series.getYValue(5), EPSILON);
    assertEquals(1.1, series.getYValue(6), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:YIntervalSeriesTests.java

示例3: testEquals

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:YIntervalSeriesCollectionTests.java

示例4: testEquals

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:25,代码来源:YIntervalSeriesCollectionTests.java

示例5: configureRendererForDataSet

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
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;
}
 
开发者ID:flyroom,项目名称:PeerfactSimKOM_Clone,代码行数:19,代码来源:MetricsPlot.java

示例6: makeCurveCollection

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
@Override
public IPerformanceCriterion makeCurveCollection(String name, double value, IIntervalSeries[] series) {
    CurveCollection col = new CurveCollection(name, value);
    for (IIntervalSeries ser : series) {
        col.addSeries((YIntervalSeries)ser);
    }
    return col;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:9,代码来源:MidasFrontendFactory.java

示例7: testIndexOf

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * Simple test for the indexOf() method.
 */
public void testIndexOf() {
    YIntervalSeries s1 = new YIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 3.0);
    s1.add(3.0, 3.0, 3.0, 4.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:11,代码来源:YIntervalSeriesTests.java

示例8: testIndexOf2

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * A check for the indexOf() method for an unsorted series.
 */
public void testIndexOf2() {
    YIntervalSeries s1 = new YIntervalSeries("Series 1", false, true);
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(0, s1.indexOf(new Double(1.0)));        
    assertEquals(1, s1.indexOf(new Double(3.0)));        
    assertEquals(2, s1.indexOf(new Double(2.0)));        
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:YIntervalSeriesTests.java

示例9: testRemove

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * Simple test for the remove() method.
 */
public void testRemove() {
    YIntervalSeries s1 = new YIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    assertEquals(3, s1.getItemCount());
    
    s1.remove(new Double(2.0));
    assertEquals(new Double(3.0), s1.getX(1));
    
    s1.remove(new Double(1.0));
    assertEquals(new Double(3.0), s1.getX(0));    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:YIntervalSeriesTests.java

示例10: testAdditionOfDuplicateXValues

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * When items are added with duplicate x-values, we expect them to remain 
 * in the order they were added.
 */
public void testAdditionOfDuplicateXValues() {
    YIntervalSeries s1 = new YIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 1.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    s1.add(2.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 4.0, 4.0, 4.0);
    s1.add(3.0, 5.0, 5.0, 5.0);
    assertEquals(1.0, s1.getYValue(0), EPSILON);
    assertEquals(2.0, s1.getYValue(1), EPSILON);
    assertEquals(3.0, s1.getYValue(2), EPSILON);
    assertEquals(4.0, s1.getYValue(3), EPSILON);
    assertEquals(5.0, s1.getYValue(4), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:YIntervalSeriesTests.java

示例11: testSetMaximumItemCount

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * A simple check that the maximumItemCount attribute is working.
 */
public void testSetMaximumItemCount() {
    YIntervalSeries s1 = new YIntervalSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:YIntervalSeriesTests.java

示例12: testSetMaximumItemCount2

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * Check that the maximum item count can be applied retrospectively.
 */
public void testSetMaximumItemCount2() {
    YIntervalSeries s1 = new YIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    s1.setMaximumItemCount(2);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:YIntervalSeriesTests.java

示例13: testGetLegendItemSeriesIndex

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * 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());
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:36,代码来源:YIntervalRendererTest.java

示例14: testIterateRangeBounds4

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:40,代码来源:DatasetUtilitiesTest.java

示例15: testIterateRangeBounds4

import org.jfree.data.xy.YIntervalSeries; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:40,代码来源:DatasetUtilsTest.java


注:本文中的org.jfree.data.xy.YIntervalSeries类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。