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


Java RegularTimePeriod.createInstance方法代码示例

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


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

示例1: createChart

import org.jfree.data.time.RegularTimePeriod; //导入方法依赖的package包/类
private JFreeChart createChart() {

      final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
      final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
      final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
      final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

      final TimeSeries seriests = new TimeSeries("Series");
      final TimeSeries seasonalts = new TimeSeries("Seasonal");
      final TimeSeries trendts = new TimeSeries("Trend");
      final TimeSeries remainderts = new TimeSeries("Remainder");

      final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
      final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

      for (int i = 0; i < series.length; i++) {
        final Date d = new Date((long) times[i]);
        RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
        seriests.addOrUpdate(rtp, series[i]);
        seasonalts.addOrUpdate(rtp, seasonal[i]);
        trendts.addOrUpdate(rtp, trend[i]);
        remainderts.addOrUpdate(rtp, remainder[i]);
      }

      plot.setGap(10.0);
      renderer.setSeriesPaint(0, black);
      barRenderer.setSeriesPaint(0, black);
      plot.setOrientation(PlotOrientation.VERTICAL);

      for (int i = 0; i < tsArray.length; i++) {
        final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
        final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
        plot.add(p);
      }

      final XYDataset rts = new TimeSeriesCollection(remainderts);
      final XYDataset sts = new TimeSeriesCollection(seriests);
      final XYDataset tts = new TimeSeriesCollection(trendts);
      final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
      final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

      seriesAndTrend.setDataset(1, tts);
      seriesAndTrend.setRenderer(1, renderer);

      plot.add(rplot);
      plot.add(seriesAndTrend);

      return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    }
 
开发者ID:ruananswer,项目名称:twitter-anomalyDetection-java,代码行数:50,代码来源:StlPlotter.java

示例2: generateSeries

import org.jfree.data.time.RegularTimePeriod; //导入方法依赖的package包/类
public TimeSeries generateSeries(String seriesName, AbstractActivityMonitor monitor) {
   Class<?> timePeriod = null;

   if (this.chartTimeUnit.equals(TimeUnit.MILLISECONDS)) {
      timePeriod = Millisecond.class;
      dateUnit = Calendar.MILLISECOND;
   }
   if (this.chartTimeUnit.equals(TimeUnit.SECONDS)) {
      timePeriod = Second.class;
      dateUnit = Calendar.SECOND;
   }
   if (this.chartTimeUnit.equals(TimeUnit.MINUTES)) {
      timePeriod = Minute.class;
      dateUnit = Calendar.MINUTE;
   }
   if (this.chartTimeUnit.equals(TimeUnit.HOURS)) {
      timePeriod = Hour.class;
      dateUnit = Calendar.HOUR;
   }

   if (timePeriod == null) {
      throw new IllegalArgumentException("Time Unit '" + chartTimeUnit.name() + "' is not supported.");
   }

   TimeSeries newSeries = new TimeSeries(seriesName, timePeriod);

   List<BigDecimal> measurements = monitor.getMeasurements();

   RegularTimePeriod timeScale = null;
   int counter = 1;
   Calendar date = new GregorianCalendar();
   // reset hour, minutes, seconds and millis
   date.set(Calendar.HOUR_OF_DAY, 0);
   date.set(Calendar.MINUTE, 0);
   date.set(Calendar.SECOND, 0);
   date.set(Calendar.MILLISECOND, 0);
   for (BigDecimal value : measurements) {
      timeScale = RegularTimePeriod.createInstance(timePeriod, date.getTime(), TimeZone.getDefault());
      newSeries.add(timeScale, value);
      date.add(dateUnit, chartFrequency);
   }
   return newSeries;
}
 
开发者ID:ppdai,项目名称:blacksmith,代码行数:44,代码来源:ClusterTimeSeriesReport.java

示例3: createChart

import org.jfree.data.time.RegularTimePeriod; //导入方法依赖的package包/类
private JFreeChart createChart() {

            final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time"));
            final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
            final ClusteredXYBarRenderer barRenderer = new ClusteredXYBarRenderer();
            final GradientPaint black = new GradientPaint(0.0f, 0.0f, Color.black, 0.0f, 0.0f, Color.black);

            final TimeSeries seriests = new TimeSeries("Series");
            final TimeSeries seasonalts = new TimeSeries("Seasonal");
            final TimeSeries trendts = new TimeSeries("Trend");
            final TimeSeries remainderts = new TimeSeries("Remainder");

            final TimeSeries[] tsArray = new TimeSeries[]{seriests, seasonalts, trendts};
            final String[] labels = new String[]{"Series", "Seasonal", "Trend"};

            for (int i = 0; i < series.length; i++) {
                final Date d = new Date((long) times[i]);
                RegularTimePeriod rtp = RegularTimePeriod.createInstance(this.timePeriod, d, TimeZone.getDefault());
                seriests.addOrUpdate(rtp, series[i]);
                seasonalts.addOrUpdate(rtp, seasonal[i]);
                trendts.addOrUpdate(rtp, trend[i]);
                remainderts.addOrUpdate(rtp, remainder[i]);
            }

            plot.setGap(10.0);
            renderer.setSeriesPaint(0, black);
            barRenderer.setSeriesPaint(0, black);
            plot.setOrientation(PlotOrientation.VERTICAL);

            for (int i = 0; i < tsArray.length; i++) {
                final XYDataset ts = new TimeSeriesCollection(tsArray[i]);
                final XYPlot p = new XYPlot(ts, new DateAxis(labels[i]), new NumberAxis(labels[i]), renderer);
                plot.add(p);
            }

            final XYDataset rts = new TimeSeriesCollection(remainderts);
            final XYDataset sts = new TimeSeriesCollection(seriests);
            final XYDataset tts = new TimeSeriesCollection(trendts);
            final XYPlot rplot = new XYPlot(rts, new DateAxis(), new NumberAxis("Remainder"), barRenderer);
            final XYPlot seriesAndTrend = new XYPlot(sts, new DateAxis(), new NumberAxis("S & T"), renderer);

            seriesAndTrend.setDataset(1, tts);
            seriesAndTrend.setRenderer(1, renderer);

            plot.add(rplot);
            plot.add(seriesAndTrend);

            return new JFreeChart(this.title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
        }
 
开发者ID:kevoree,项目名称:kevoree-brain,代码行数:50,代码来源:StlPlotter.java


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