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


Java TimeSeriesCollection类代码示例

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


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

示例1: createDataset1

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

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

示例2: testSerialization4

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:20,代码来源:JFreeChartTest.java

示例3: replaceModel

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
@Override
	public void replaceModel(DataModel newModel) {
		this.dataModel = newModel;
		
//		this.chartPanel.setChart(ChartFactory.createTimeSeriesChart(
//				this.dataModel.getOntologyModel().getChartSettings().getChartTitle(), 
//				this.dataModel.getOntologyModel().getChartSettings().getXAxisLabel(), 
//				this.dataModel.getOntologyModel().getChartSettings().getYAxisLabel(), 
//				((TimeSeriesDataModel)this.dataModel).getTimeSeriesChartModel().getTimeSeriesCollection(), 
//				true, false, false
//		));
//		
//		applySettings();
		
		TimeSeriesCollection tsc = ((TimeSeriesDataModel)this.dataModel).getTimeSeriesChartModel().getTimeSeriesCollection();
		this.chartPanel.getChart().getXYPlot().setDataset(tsc);
		
		dataModel.getChartModel().addObserver(this);
	}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:TimeSeriesChartTab.java

示例4: plotTradeBubblesOnChart

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
private void plotTradeBubblesOnChart(ArrayList<Integer> toPlot, String p, int k, int j)
  {
  	final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0);
      final XYPlot plot = (XYPlot) main_plot;
      
  	final TimeSeries series = new TimeSeries(p);
///*
for(Integer i: toPlot)
{
	switch(j)
	{
	case 0:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getOpen());
		break;
	case 1:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getHigh());
		break;
	case 2:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getLow());
		break;
	case 3:
		series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getClose());
		break;
	}
	
}
/*
for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++) 
{
          series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
      }
*/
XYDataset dataSet = new TimeSeriesCollection(series);

plot.setDataset(k, dataSet);
  	XYItemRenderer ir = new XYShapeRenderer();
  	//ir.s
  	
  	plot.setRenderer(k, ir);
  }
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:41,代码来源:ChartJDialog.java

示例5: createIndicatorPlot

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
private XYDataset createIndicatorPlot(String name, Double[] plot)
{
	final TimeSeries series = new TimeSeries(name);
	///*
	for (int i = 0; i < chartDatas.size(); i++) 
	{
           series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),plot[i]);
       }
	/*
	for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++) 
	{
           series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
       }
	*/
       return new TimeSeriesCollection(series);
}
 
开发者ID:lead4good,项目名称:open-java-trade-manager,代码行数:17,代码来源:ChartJDialog.java

示例6: createDataset

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
private XYDataset createDataset(List<String> industrys) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    if (industrys != null) {
        for (String industry : industrys) {
            TimeSeries timeseries = new TimeSeries(industry + "资金统计",
                    org.jfree.data.time.Day.class);
            List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
            Double value = 0.0;
            if (industryInfos != null) {
                for (IndustryInfo industryInfo : industryInfos) {
                    value = value + industryInfo.getTotal() / 10000;
                    timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
                }
            }
            timeseriescollection.addSeries(timeseries);
        }
    }
    return timeseriescollection;
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:20,代码来源:IndustryTimeSeriesChart.java

示例7: createDataset

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
private XYDataset createDataset(List<String> industrys) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    if (industrys != null) {
        for (String industry : industrys) {
            TimeSeries timeseries = new TimeSeries(industry + "涨跌统计",
                    org.jfree.data.time.Day.class);
            List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
            BigDecimal value = new BigDecimal(0);
            if (industryInfos != null) {
                for (IndustryInfo industryInfo : industryInfos) {
                    if (industryInfo.getRise() != null) {
                        value = value.add(industryInfo.getRise());
                    }
                    timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
                }
            }
            timeseriescollection.addSeries(timeseries);
        }
    }
    return timeseriescollection;
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:22,代码来源:IndustryRiseChart.java

示例8: testRemoveSeries

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Tests the remove series method.
 */
public void testRemoveSeries() {

    final TimeSeriesCollection c1 = new TimeSeriesCollection();

    final TimeSeries s1 = new TimeSeries("Series 1");
    final TimeSeries s2 = new TimeSeries("Series 2");
    final TimeSeries s3 = new TimeSeries("Series 3");
    final TimeSeries s4 = new TimeSeries("Series 4");

    c1.addSeries(s1);
    c1.addSeries(s2);
    c1.addSeries(s3);
    c1.addSeries(s4);

    c1.removeSeries(s3);

    final TimeSeries s = c1.getSeries(2);
    final boolean b1 = s.equals(s4);
    assertTrue(b1);

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

示例9: createDataset

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Creates a sample dataset.
 * 
 * @param name  the dataset name.
 * @param base  the starting value.
 * @param start  the starting period.
 * @param count  the number of values to generate.
 *
 * @return The dataset.
 */
private static XYDataset createDataset(String name, double base, 
                                       RegularTimePeriod start, int count) {

    TimeSeries series = new TimeSeries(name, start.getClass());
    RegularTimePeriod period = start;
    double value = base;
    for (int i = 0; i < count; i++) {
        series.add(period, value);    
        period = period.next();
        value = value * (1 + (Math.random() - 0.495) / 10.0);
    }

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    return dataset;

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

示例10: testRemoveSeries

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Tests the remove series method.
 */
public void testRemoveSeries() {

    TimeSeriesCollection c1 = new TimeSeriesCollection();

    TimeSeries s1 = new TimeSeries("Series 1");
    TimeSeries s2 = new TimeSeries("Series 2");
    TimeSeries s3 = new TimeSeries("Series 3");
    TimeSeries s4 = new TimeSeries("Series 4");

    c1.addSeries(s1);
    c1.addSeries(s2);
    c1.addSeries(s3);
    c1.addSeries(s4);

    c1.removeSeries(s3);

    TimeSeries s = c1.getSeries(2);
    boolean b1 = s.equals(s4);
    assertTrue(b1);

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

示例11: generateToolTip

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Generates a tool tip text item for a particular item within a series.
 *
 * @param data  the dataset.
 * @param series  the series number (zero-based index).
 * @param item  the item number (zero-based index).
 *
 * @return The tool tip text (possibly <code>null</code>).
 */
public String generateToolTip(XYDataset data, int series, int item) {

    String xStr, yStr;
    if (data instanceof YisSymbolic) {
        yStr = ((YisSymbolic) data).getYSymbolicValue(series, item);
    }
    else {
        double y = data.getYValue(series, item);
        yStr = Double.toString(round(y, 2));
    }
    if (data instanceof XisSymbolic) {
        xStr = ((XisSymbolic) data).getXSymbolicValue(series, item);
    }
    else if (data instanceof TimeSeriesCollection) {
        RegularTimePeriod p
            = ((TimeSeriesCollection) data).getSeries(series)
                .getTimePeriod(item);
        xStr = p.toString();
    }
    else {
        double x = data.getXValue(series, item);
        xStr = Double.toString(round(x, 2));
    }
    return "X: " + xStr + ", Y: " + yStr;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:SymbolicXYItemLabelGenerator.java

示例12: createDataset

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Creates a sample dataset.
 *
 * @param name  the dataset name.
 * @param base  the starting value.
 * @param start  the starting period.
 * @param count  the number of values to generate.
 *
 * @return The dataset.
 */
private static XYDataset createDataset(String name, double base,
                                       RegularTimePeriod start, int count) {

    TimeSeries series = new TimeSeries(name);
    RegularTimePeriod period = start;
    double value = base;
    for (int i = 0; i < count; i++) {
        series.add(period, value);
        period = period.next();
        value = value * (1 + (Math.random() - 0.495) / 10.0);
    }

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    return dataset;

}
 
开发者ID:mdzio,项目名称:ccu-historian,代码行数:29,代码来源:SWTMultipleAxisDemo1.java

示例13: testSerialization4

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtils.serialised(c1);
    assertEquals(c1, c2);
}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:20,代码来源:JFreeChartTest.java

示例14: createDataset1

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1");
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
 
开发者ID:jfree,项目名称:jfreechart,代码行数:30,代码来源:XYPlotTest.java

示例15: getEntityHyperlink

import org.jfree.data.time.TimeSeriesCollection; //导入依赖的package包/类
@Override
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
{
	JRPrintHyperlink printHyperlink = null;
	if (hasHyperlinks() && entity instanceof XYItemEntity)
	{
		XYItemEntity itemEntity = (XYItemEntity) entity;
		TimeSeriesCollection dataset = (TimeSeriesCollection) itemEntity.getDataset();
		TimeSeries series = dataset.getSeries(itemEntity.getSeriesIndex());
		Map<RegularTimePeriod, JRPrintHyperlink> serieHyperlinks = itemHyperlinks.get(series.getKey());
		if (serieHyperlinks != null)
		{
			RegularTimePeriod timePeriod = series.getTimePeriod(itemEntity.getItem());
			printHyperlink = serieHyperlinks.get(timePeriod);
		}
	}
	return printHyperlink;
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:19,代码来源:TimeSeriesChartHyperlinkProvider.java


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