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


Java TimeSeries.getItemCount方法代码示例

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


在下文中一共展示了TimeSeries.getItemCount方法的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: getForecastData

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
public static TimeSeries getForecastData(TimeSeries observationData, int forcastperc) {
	TimeSeries fcdataset = new TimeSeries("Time Series Forecast");
	if (observationData.isEmpty() == true)
		return fcdataset;
	int size = observationData.getItemCount();
	long fcsize = size + Math.round( (double)size * ((double)forcastperc/100)); // new data set
	
	try {
		fcdataset = observationData.createCopy(0,size-1);
		for (int i=size; i < fcsize; i++) {
			RegularTimePeriod nexttp = fcdataset.getNextTimePeriod();
			fcdataset.add(nexttp,0.00D);
		}
	} catch (Exception e) {
		System.out.println("Exception:" + e.getLocalizedMessage());
		System.out.println("Could not create forecasted data sample");
		return fcdataset;
	}
	
	return fcdataset;
	
}
 
开发者ID:arrahtech,项目名称:osdq-core,代码行数:23,代码来源:TimeUtil.java

示例3: addData

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/** Add a data item to the end of a series */
	public void addData(String name, double value){
//System.out.println("TimeGraphPanel: Adding data " + name + "=" + value);
		TimeSeries series = null;
		if(hiddenSeries.containsKey(name))
			series = hiddenSeries.get(name);
		else{
			TimeSeriesCollection dataset = (TimeSeriesCollection)chart.getXYPlot().getDataset(0);
			int id = seriesIds.get(name);
			series = dataset.getSeries(id);
		}
		if(series.getItemCount() == 0){
			series.add(new Week(startTime), value);
		}
		else{
//System.out.println("TimeGraphPanel: seriesDescription = " + series.getDomainDescription());
			series.add(series.getNextTimePeriod(), value);
		}
		
	}
 
开发者ID:Cride5,项目名称:jablus,代码行数:21,代码来源:TimeGraphPanel.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: calculateDifferenz

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Calculates difference between actual date and date the forecast ends (end of year). Is used for forecast.
 * 
 * @param planned Timeperiod of forecast.
 * @param is Timeperiod until real values exist.
 * @return Returns number of time elements between the end of the two timeperiods.
 */
private double calculateDifferenz(TimeSeries planned,TimeSeries is){
	double factor=0;
	
	int invalidValues=0;
	for(int i=0;i<is.getItemCount();i++){
		if(planned.getItemCount()>i&&planned.getValue(i).doubleValue()!=0){
			factor+=is.getValue(i).doubleValue()/planned.getValue(i).doubleValue();
		}else{
			invalidValues++;
		}
	}
	if(is.getItemCount()!=0&&is.getItemCount()-invalidValues!=0){
			factor/=(is.getItemCount()-invalidValues);
	}else{
		factor=1;
	}
	return factor;
}
 
开发者ID:Jather90,项目名称:AMOS_proj5,代码行数:26,代码来源:ChartRenderer.java

示例6: getValue

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
private Number getValue(int plotIndex, int seriesIndex, int dataIndex) {
    final TimeSeries timeSeries = this.getTimeSeries(plotIndex, seriesIndex);
    if (timeSeries == null) {
        return null;
    }
    
    if (dataIndex >= timeSeries.getItemCount()) {
        /* Not ready yet. */
        return null;
    }

    return timeSeries.getDataItem(dataIndex).getValue();
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:14,代码来源:ChartLayerUI.java

示例7: TimeSeriesBuilder

import org.jfree.data.time.TimeSeries; //导入方法依赖的package包/类
/**
 * Constructs a new TimeSeriesBuilder that reads its input from the given
 * TimeSeries object. This builder defaults the of the independent, time
 * variable to be the class name of the RegularTimePeriod used in the
 * TimeSeries. For example, if a series of org.jfree.data.time.Day objects
 * are used, then the name of the independent variable will default to
 * "Day" (without the quotes).
 *
 * See the class description for more information.
 * @param timeSeries the TimeSeries object containing data to be used to
 * build the DataSet.
 * @throws IllegalArgumentException if the TimeSeries is empty.
 */
public TimeSeriesBuilder( TimeSeries timeSeries )
{
    if ( timeSeries.getItemCount() <= 0 )
        throw new IllegalArgumentException("TimeSeries cannot be empty.");
    
    this.timeSeries = timeSeries;
    
    // Use base name of TimePeriod class, as name of time variable
    RegularTimePeriod timePeriod = timeSeries.getTimePeriod(0);
    String name = timePeriod.getClass().getName();
    name = name.substring( name.lastIndexOf(".")+1 );
    addVariable( name );
}
 
开发者ID:arrahtech,项目名称:osdq-core,代码行数:27,代码来源:TimeSeriesBuilder.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.getItemCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。