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


Java TimeSeries.getDataItem方法代码示例

本文整理汇总了Java中org.jfree.data.time.TimeSeries.getDataItem方法的典型用法代码示例。如果您正苦于以下问题:Java TimeSeries.getDataItem方法的具体用法?Java TimeSeries.getDataItem怎么用?Java TimeSeries.getDataItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.data.time.TimeSeries的用法示例。


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

示例1: getDataIndex

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
private int getDataIndex(TimeSeries timeSeries, Day targetDay) {
    int low = 0;
    int high = timeSeries.getItemCount() - 1;

    while (low <= high) {
        int mid = (low + high) >>> 1;

        final TimeSeriesDataItem timeSeriesDataItem = timeSeries.getDataItem(mid);
        final Day searchDay = (Day)timeSeriesDataItem.getPeriod();
        final long cmp = searchDay.compareTo(targetDay);

        if (cmp < 0) {
            low = mid + 1;
        }
        else if (cmp > 0) {
            high = mid - 1;
        }
        else {
            return mid;
        }
    }
    return -1;
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:24,代码来源:ChartLayerUI.java

示例2: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Test the setMaximumItemCount() method to ensure that it removes items from the series
 * if necessary.
 */
public void testSetMaximumItemCount() {

    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);

    assertTrue(s1.getItemCount() == 5);
    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:TimeSeriesTests.java

示例3: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Test the setMaximumItemCount() method to ensure that it removes items 
 * from the series if necessary.
 */
public void testSetMaximumItemCount() {

    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);

    assertTrue(s1.getItemCount() == 5);
    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:TimeSeriesTests.java

示例4: getDataSet

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * A helper function to convert data points (from startIndex to
 * endIndex) of a (JFreeChart) TimeSeries object into an
 * OpenForecast DataSet.
 * @param series the series of data points stored as a JFreeChart
 * TimeSeries object.
 * @param startIndex the index of the first data point required from the
 * series.
 * @param endIndex the index of the last data point required from the
 * series.
 * @return an OpenForecast DataSet representing the data points extracted
 * from the TimeSeries.
 */
private DataSet getDataSet( TimeSeries series,
                            int startIndex, int endIndex )
{
    DataSet dataSet = new DataSet();
    if ( endIndex > series.getItemCount() )
        endIndex = series.getItemCount();
    
    for ( int i=startIndex; i<endIndex; i++ )
        {
            TimeSeriesDataItem dataPair = series.getDataItem(i);
            DataPoint dp = new Observation( dataPair.getValue().doubleValue() );
            dp.setIndependentValue( "t", i );
            dataSet.add( dp );
        }
    
    return dataSet;
}
 
开发者ID:etheriau,项目名称:OpenForecast,代码行数:31,代码来源:ExponentialSmoothingChartDemo.java

示例5: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Test the setMaximumItemCount() method to ensure that it removes items
 * from the series if necessary.
 */
public void testSetMaximumItemCount() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);
    assertTrue(s1.getItemCount() == 5);

    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));
    assertEquals(16.89, s1.getMinY(), EPSILON);
    assertEquals(19.32, s1.getMaxY(), EPSILON);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:TimeSeriesTests.java

示例6: testGetDataItem2

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Some checks for the getDataItem(RegularTimePeriod) method.
 */
public void testGetDataItem2() {
    TimeSeries series = new TimeSeries("S", Year.class);
    assertNull(series.getDataItem(new Year(2006)));
    
    // try a null argument
    boolean pass = false;
    try {
        /* TimeSeriesDataItem item = */ series.getDataItem(null);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:TimeSeriesTests.java

示例7: testGetDataItem2

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Some checks for the getDataItem(RegularTimePeriod) method.
 */
public void testGetDataItem2() {
    TimeSeries series = new TimeSeries("S");
    assertNull(series.getDataItem(new Year(2006)));

    // try a null argument
    boolean pass = false;
    try {
        /* TimeSeriesDataItem item = */ series.getDataItem(null);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:TimeSeriesTests.java

示例8: createDataset

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/** Create the dataset used for the plot. */
private TimeTableXYDataset createDataset() {
	TimeTableXYDataset dataset = new TimeTableXYDataset();
	for (SeriesDescriptor seriesDesriptor : seriesList) {
		String seriesTitle = seriesDesriptor.seriesTitle;
		TimeSeries timeSeries = createTimeSeries(seriesTitle,
				seriesDesriptor.series);
		for (int i = 0; i < timeSeries.getItemCount(); ++i) {
			TimeSeriesDataItem di = timeSeries.getDataItem(i);
			dataset.add(di.getPeriod(), di.getValue().doubleValue(),
					seriesTitle);
		}
	}
	return dataset;
}
 
开发者ID:vimaier,项目名称:conqat,代码行数:16,代码来源:StackedAreaChartCreator.java

示例9: validate

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
@Override
public TimeSeries validate(TimeSeries timeSeries, String sourceName, TimeSeriesType type) throws ParseException {
    String qualifiedSourceName = createQualifiedSourcename(sourceName, type);
    final Symbol symbol = namespace.resolveSymbol(qualifiedSourceName);
    if (symbol == null) {
        throw new ParseException("No variable for identifier '" + qualifiedSourceName + "' registered.");
    }
    final String expression = getExpressionFor(qualifiedSourceName);
    if (expression == null || expression.trim().isEmpty()) {
        return timeSeries;
    }
    final Variable variable = (Variable) symbol;
    final Term term = parser.parse(expression, namespace);

    final int seriesCount = timeSeries.getItemCount();
    final TimeSeries validatedSeries = new TimeSeries(timeSeries.getKey());
    for (int i = 0; i < seriesCount; i++) {
        final TimeSeriesDataItem dataItem = timeSeries.getDataItem(i);
        final Number value = dataItem.getValue();
        variable.assignD(null, value.doubleValue());
        if (term.evalB(null)) {
            validatedSeries.add(dataItem);
        }
    }

    return validatedSeries;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:28,代码来源:TimeSeriesValidator.java


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