Package org.jfree.data.time

Examples of org.jfree.data.time.TimeSeriesCollection


      if (paintIndex < 0) paintIndex += DEFAULT_PAINTS.length;
      paint = DEFAULT_PAINTS[paintIndex];
      this.startTimestamp = startTimestamp;
      this.endTimestamp = endTimestamp;
      TimeSeries series = new TimeSeries("Slave " + slaveIndex);
      TimeSeriesCollection dataset = new TimeSeriesCollection(series, GMT);
      chart = ChartFactory.createTimeSeriesChart(null, "Time from start", null, dataset, false, false, false);
      chart.setBackgroundPaint(new Color(0, 0, 0, 0));
      XYPlot plot = chart.getXYPlot();
      plot.getRenderer().setSeriesPaint(0, paint);
      //plot.getRenderer().setSeriesShape(0, shape);
View Full Code Here


    }

   
    private JFreeChart createHeapChart(double maxMemory)
    {
        TimeSeriesCollection dataSet = new TimeSeriesCollection();
        dataSet.addSeries(memoryUsageSeries);
        dataSet.addSeries(heapSizeSeries);
        JFreeChart chart = ChartFactory.createXYAreaChart("JVM Heap",
                                                          "Time",
                                                          "Megabytes",
                                                           dataSet,
                                                           PlotOrientation.VERTICAL,
View Full Code Here

      String chartTitle, String timeAxisLabel, String valueAxisLabel) {
    super(new BorderLayout());
    this.server = server;
    this.category = category;
    this.title = title;
    this.timeSeries = new TimeSeriesCollection();
    this.chart = ChartFactory.createTimeSeriesChart(
        chartTitle, timeAxisLabel, valueAxisLabel, timeSeries,
        true, true, false
    );
    this.chartPanel = new ChartPanel(chart);
View Full Code Here

    super(new BorderLayout());
    this.server = server;
    this.category = category;
    this.title = title;
    this.series = new TimeSeries(title, Minute.class);
    TimeSeriesCollection timeSeries = new TimeSeriesCollection(series);
    this.chart = ChartFactory.createTimeSeriesChart(
        title, timeAxisLabel, valueAxisLabel, timeSeries,
        false, true, false
    );
    this.chartPanel = new ChartPanel(chart);
View Full Code Here

        if(!hasLabels)showlegend=false;
        return dataset;
    }
  private XYDataset createTimeSeriesCollection() {
    TimeZone tz = ThreadLocalPageContext.getTimeZone();
    final TimeSeriesCollection coll=new TimeSeriesCollection(tz);
   
        //final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        Iterator<ChartSeriesBean> it = _series.iterator();
        //int seriesCount=_series.size();
        Iterator itt;
        List datas;
        ChartSeriesBean csb;
        ChartDataBean cdb;
        int count=0;
        smallest=Double.MAX_VALUE;
        biggest = Double.MIN_VALUE;
        String label;
        boolean hasLabels=false;
        while(it.hasNext()) {
          count++;
          csb=it.next();
          label=csb.getSeriesLabel();
          if(StringUtil.isEmpty(label))label=""+count;
          else hasLabels=true;
          datas = csb.getDatas();
          if(sortxaxis)Collections.sort(datas);
            itt=datas.iterator();
            TimeSeries ts=new TimeSeries(label,Second.class);
            while(itt.hasNext()) {
            cdb=(ChartDataBean) itt.next();
            if(smallest>cdb.getValue())smallest=cdb.getValue();
            if(biggest<cdb.getValue())biggest=cdb.getValue();
            //if(seriesCount>1)
            ts.addOrUpdate(new Second(DateCaster.toDateSimple(cdb.getItem(),false,false, tz,null)), cdb.getValue());
           
            //else dataset.addValue(cdb.getValue(), cdb.getItem(),"");
           
             
          }
            coll.addSeries(ts);
        }
        if(!hasLabels)showlegend=false;
        return coll;
    }
View Full Code Here

            return xyPlotAdapter;
        }

        if (info.getModelType().equals(ModelType.Date)) {
            TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, info);
            XYBarRenderer renderer = new XYBarRendererAdapter();
            ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;

            int seriesCount = ds != null ? ds.getSeriesCount() : 0;
            configure(chartView, configurableRenderer, seriesCount);

            final GridDatePlotAdapter datePlotAdapter = new GridDatePlotAdapter(ds, renderer, chartView);
            initMarkers(chart, datePlotAdapter);

            return datePlotAdapter;
        }

        CategoryDataset ds = ModelConverter.toCategoryDataset(info);
        int rowCount = ds != null ? ds.getRowCount() : 0;

        BarRenderer renderer = chartView.isEnable3D()
                ? new BarRenderer3DAdapter()
                : new BarRendererAdapter();
View Full Code Here

            return xyPlot;
        }

        if (info.getModelType().equals(ModelType.Date)) {
            TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, info);

            AbstractXYItemRenderer renderer = createRenderer(chart, ds);

            final GridDatePlotAdapter xyPlot = new GridDatePlotAdapter(ds, renderer, chartView);
            initMarkers(chart, xyPlot);

            return xyPlot;
        }

        CategoryDataset ds = ModelConverter.toCategoryDataset(info);
        LineAndShapeRenderer renderer;

        if (chartView.getLineAreaFill() != null) {
            renderer = new LineFillRenderer();
        } else {
            renderer = chartView.isEnable3D()
                    ? new LineRenderer3DAdapter()
                    : new LineRendererAdapter();
        }

        if (chart.getChartSelection() != null && !chartView.isShapesVisible()) {
            throw new IllegalStateException("Chart selection is unsupported with disabled shapes.");
        }

        int rowCount = ds != null ? ds.getRowCount() : 0;
        ConfigurableRenderer configurableRenderer = (ConfigurableRenderer) renderer;

        configure(chartView, configurableRenderer, ds, rowCount);

        final GridCategoryPlotAdapter gridCategoryPlot = new GridCategoryPlotAdapter(ds, renderer, chartView);
View Full Code Here

        info.getSeries().setIndex(en.getSeriesIndex());
        info.setIndex(en.getItem());
        ModelInfo modelInfo = new ModelInfo(model);
        if (!modelInfo.isDataEmpty()) {
            if (modelInfo.getModelType() == ModelType.Date) {
                TimeSeriesCollection ds = ModelConverter.toTimeSeriesCollection(chart, modelInfo);
                Comparable seriesKey = ds.getSeriesKey(en.getSeriesIndex());
                Number tupleKey = ds.getX(en.getSeriesIndex(), en.getItem());
                if (tupleKey instanceof Long) {
                    info.setKey(new Date(tupleKey.longValue()));
                } else {
                    info.setKey(tupleKey);
                }

                Object tupleValue = ds.getY(en.getSeriesIndex(), en.getItem());

                info.setValue(tupleValue);
                info.getSeries().setKey(seriesKey);
            } else {
                XYDataset ds = ModelConverter.toXYSeriesCollection(modelInfo);
                Comparable seriesKey = ds.getSeriesKey(en.getSeriesIndex());
                Number tupleKey = ds.getX(en.getSeriesIndex(), en.getItem());
                info.setKey(tupleKey);

                Object tupleValue = ds.getY(en.getSeriesIndex(), en.getItem());

                info.setValue(tupleValue);
                info.getSeries().setKey(seriesKey);
            }
        }
View Full Code Here

    public static TimeSeriesCollection toTimeSeriesCollection(Chart chart, ModelInfo info) {
        if (info.isDataEmpty())
            return null;

        TimeSeriesCollection xyResult = new TimeSeriesCollection();

        Series[] series = info.getNonEmptySeriesList();
        for (Series s : series) {
            TimeSeries tSeries = toTimeSeries(s, chart.getTimePeriodPrecision());
            if (tSeries != null)
                xyResult.addSeries(tSeries);
        }

        return xyResult;
    }
View Full Code Here

        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;

    }
View Full Code Here

TOP

Related Classes of org.jfree.data.time.TimeSeriesCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.