List of usage examples for org.jfree.data.time TimeSeries TimeSeries
public TimeSeries(Comparable name, Class timePeriodClass)
From source file:edu.unibonn.plotting.TimeSeriesPlotter_Sensors.java
private XYDataset createDataset(ArrayList<Cluster_KMeans> clusters, LocalDateTime from) { final TimeSeriesCollection dataset = new TimeSeriesCollection(); for (int i = 0; i < clusters.size(); i++) { Cluster_KMeans current_cluster = clusters.get(i); ArrayList<Sensor> member_time_series = current_cluster.getMembership(); for (Iterator iterator = member_time_series.iterator(); iterator.hasNext();) { final TimeSeries s1 = new TimeSeries("Cluster_" + current_cluster.getCluster_id(), Hour.class); Sensor current_series = (Sensor) iterator.next(); for (int j = 0; j < current_series.getDimensions(); j++) { LocalDateTime current_record_time = current_series.getInitial_record_time().plusHours(j); s1.add(new Hour(current_record_time.getHour(), current_record_time.getDayOfMonth(), current_record_time.getMonthValue(), current_record_time.getYear()), current_series.getMeasurement(j)); }/* w w w .j a va 2 s. com*/ dataset.addSeries(s1); } } dataset.setDomainIsPointsInTime(true); return dataset; }
From source file:de.tsystems.mms.apm.performancesignature.ui.PerfSigBuildActionResultsDisplay.java
public void doSummarizerGraph(final StaplerRequest request, final StaplerResponse response) throws IOException { final Graph graph = new GraphImpl(request, getBuild().getTimestamp().getTimeInMillis()) { @Override/*w ww.jav a 2s . c om*/ protected TimeSeriesCollection createDataSet() { String measure = request.getParameter("measure"); String chartDashlet = request.getParameter("chartdashlet"); String testCase = request.getParameter("testcase"); TimeSeries timeSeries = new TimeSeries(chartDashlet, Second.class); DashboardReport dashboardReport = getDashBoardReport(testCase); Measure m = dashboardReport.getMeasure(chartDashlet, measure); if (m == null || m.getMeasurements() == null) { return null; } for (Measurement measurement : m.getMeasurements()) { timeSeries.add(new Second(new Date(measurement.getTimestamp())), measurement.getMetricValue(m.getAggregation())); } return new TimeSeriesCollection(timeSeries); } }; graph.doPng(request, response); }
From source file:org.jfree.chart.demo.OverlaidXYPlotDemo.java
/** * Creates a sample dataset.// ww w.jav a 2 s. c o m * * @return The dataset. */ private IntervalXYDataset createDataset1() { // create dataset 1... final TimeSeries series1 = new TimeSeries("Series 1", Day.class); series1.add(new Day(1, SerialDate.MARCH, 2002), 12353.3); series1.add(new Day(2, SerialDate.MARCH, 2002), 13734.4); series1.add(new Day(3, SerialDate.MARCH, 2002), 14525.3); series1.add(new Day(4, SerialDate.MARCH, 2002), 13984.3); series1.add(new Day(5, SerialDate.MARCH, 2002), 12999.4); series1.add(new Day(6, SerialDate.MARCH, 2002), 14274.3); series1.add(new Day(7, SerialDate.MARCH, 2002), 15943.5); series1.add(new Day(8, SerialDate.MARCH, 2002), 14845.3); series1.add(new Day(9, SerialDate.MARCH, 2002), 14645.4); series1.add(new Day(10, SerialDate.MARCH, 2002), 16234.6); series1.add(new Day(11, SerialDate.MARCH, 2002), 17232.3); series1.add(new Day(12, SerialDate.MARCH, 2002), 14232.2); series1.add(new Day(13, SerialDate.MARCH, 2002), 13102.2); series1.add(new Day(14, SerialDate.MARCH, 2002), 14230.2); series1.add(new Day(15, SerialDate.MARCH, 2002), 11235.2); return new TimeSeriesCollection(series1); }
From source file:org.miloss.fgsms.services.rs.impl.reports.broker.ConsumersByQueueOrTopic.java
@Override public void generateReport(OutputStreamWriter data, List<String> urls, String path, List<String> files, TimeRange range, String currentuser, SecurityWrapper classification, WebServiceContext ctx) throws IOException { Connection con = Utility.getPerformanceDBConnection(); try {// w ww. ja va2s.c om PreparedStatement cmd = null; ResultSet rs = null; DefaultCategoryDataset set = new DefaultCategoryDataset(); JFreeChart chart = null; data.append("<hr /><h2>").append(GetDisplayName()).append("</h2>"); data.append( "This represents the average number of consumers for all channels (topics/queues/etc) on a specific message broker.<br />"); data.append( "<table class=\"table table-hover\"><tr><th>URI</th><th>Channel</th><th>Average Consumer Count</th></tr>"); TimeSeriesCollection col = new TimeSeriesCollection(); for (int i = 0; i < urls.size(); i++) { if (!isPolicyTypeOf(urls.get(i), PolicyType.STATISTICAL)) { continue; } //https://github.com/mil-oss/fgsms/issues/112 if (!UserIdentityUtil.hasReadAccess(currentuser, "getReport", urls.get(i), classification, ctx)) { continue; } String url = Utility.encodeHTML(BaseReportGenerator.getPolicyDisplayName(urls.get(i))); try { data.append("<tr><td>").append(Utility.encodeHTML(urls.get(i))).append("</td>"); double average = 0; try { cmd = con.prepareStatement( "select avg(activeconsumercount), host, canonicalname from brokerhistory where host=? and utcdatetime > ? and utcdatetime < ? group by canonicalname, host;"); cmd.setString(1, urls.get(i)); cmd.setLong(2, range.getStart().getTimeInMillis()); cmd.setLong(3, range.getEnd().getTimeInMillis()); rs = cmd.executeQuery(); if (rs.next()) { average = rs.getDouble(1); } } catch (Exception ex) { log.log(Level.WARN, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(cmd); } data.append("<td>").append(average + "").append("</td>"); try { //ok now get the raw data.... cmd = con.prepareStatement( "select utcdatetime,activeconsumercount, canonicalname from brokerhistory where host=? and utcdatetime > ? and utcdatetime < ?;"); cmd.setString(1, urls.get(i)); cmd.setLong(2, range.getStart().getTimeInMillis()); cmd.setLong(3, range.getEnd().getTimeInMillis()); rs = cmd.executeQuery(); TimeSeries ts = new TimeSeries(urls.get(i), Millisecond.class); while (rs.next()) { //set.addValue(rs.getLong(1), urls.get(i), rs.getString("canonicalname")); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(rs.getLong(1)); Millisecond m = new Millisecond(gcal.getTime()); ts.addOrUpdate(m, rs.getLong(2)); } col.addSeries(ts); } catch (Exception ex) { log.log(Level.WARN, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(cmd); } } catch (Exception ex) { log.log(Level.ERROR, "Error opening or querying the database.", ex); } } chart = org.jfree.chart.ChartFactory.createTimeSeriesChart(GetDisplayName(), "Timestamp", "Count", col, true, false, false); data.append("</table>"); try { ChartUtilities.saveChartAsPNG(new File( path + getFilePathDelimitor() + "image_" + this.getClass().getSimpleName() + ".png"), chart, 1500, 400); data.append("<img src=\"image_").append(this.getClass().getSimpleName()).append(".png\">"); files.add(path + getFilePathDelimitor() + "image_" + this.getClass().getSimpleName() + ".png"); } catch (IOException ex) { log.log(Level.ERROR, "Error saving chart image for request", ex); } } catch (Exception ex) { log.log(Level.ERROR, null, ex); } finally { DBUtils.safeClose(con); } }
From source file:org.ietr.preesm.mapper.ui.BestCostPlotter.java
/** * Creates a chart./*from ww w . ja va 2 s .c o m*/ * * @return A chart. */ private JFreeChart createChart(String title) { final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[subplotCount]; for (int i = 0; i < subplotCount; i++) { this.lastValue[i] = 100.0; final TimeSeries series = new TimeSeries("Real Time", Millisecond.class); this.datasets[i] = new TimeSeriesCollection(series); final NumberAxis rangeAxis = new NumberAxis("Schedule"); rangeAxis.setAutoRangeIncludesZero(false); final XYPlot subplot = new XYPlot(this.datasets[i], null, rangeAxis, new XYLineAndShapeRenderer()); subplot.setBackgroundPaint(Color.white); subplot.setDomainGridlinePaint(Color.lightGray); subplot.setRangeGridlinePaint(Color.lightGray); plot.add(subplot); } final JFreeChart chart = new JFreeChart(title, plot); chart.removeLegend(); // chart.getLegend().setPosition(RectangleEdge.BOTTOM); chart.setBorderPaint(Color.lightGray); chart.setBorderVisible(true); Paint p = GanttPlotter.getBackgroundColorGradient(); chart.setBackgroundPaint(p); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.black); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); return chart; }
From source file:org.jfree.chart.demo.PriceVolumeDemo.java
/** * Creates a sample dataset./*ww w. java2 s. c o m*/ * * @return A sample dataset. */ private XYDataset createPriceDataset() { // create dataset 1... final TimeSeries series1 = new TimeSeries("Price", Day.class); series1.add(new Day(2, MonthConstants.JANUARY, 2002), 95.565); series1.add(new Day(3, MonthConstants.JANUARY, 2002), 95.640); series1.add(new Day(4, MonthConstants.JANUARY, 2002), 95.710); series1.add(new Day(7, MonthConstants.JANUARY, 2002), 95.930); series1.add(new Day(8, MonthConstants.JANUARY, 2002), 95.930); series1.add(new Day(9, MonthConstants.JANUARY, 2002), 95.960); series1.add(new Day(10, MonthConstants.JANUARY, 2002), 96.055); series1.add(new Day(11, MonthConstants.JANUARY, 2002), 96.335); series1.add(new Day(14, MonthConstants.JANUARY, 2002), 96.290); series1.add(new Day(15, MonthConstants.JANUARY, 2002), 96.275); series1.add(new Day(16, MonthConstants.JANUARY, 2002), 96.240); series1.add(new Day(17, MonthConstants.JANUARY, 2002), 96.080); series1.add(new Day(18, MonthConstants.JANUARY, 2002), 96.145); series1.add(new Day(22, MonthConstants.JANUARY, 2002), 96.120); series1.add(new Day(23, MonthConstants.JANUARY, 2002), 96.015); series1.add(new Day(24, MonthConstants.JANUARY, 2002), 95.890); series1.add(new Day(25, MonthConstants.JANUARY, 2002), 95.8650); series1.add(new Day(28, MonthConstants.JANUARY, 2002), 95.880); series1.add(new Day(29, MonthConstants.JANUARY, 2002), 96.050); series1.add(new Day(30, MonthConstants.JANUARY, 2002), 96.065); series1.add(new Day(31, MonthConstants.JANUARY, 2002), 95.910); series1.add(new Day(1, MonthConstants.FEBRUARY, 2002), 96.015); series1.add(new Day(4, MonthConstants.FEBRUARY, 2002), 96.140); series1.add(new Day(5, MonthConstants.FEBRUARY, 2002), 96.195); series1.add(new Day(6, MonthConstants.FEBRUARY, 2002), 96.245); series1.add(new Day(7, MonthConstants.FEBRUARY, 2002), 96.220); series1.add(new Day(8, MonthConstants.FEBRUARY, 2002), 96.280); series1.add(new Day(11, MonthConstants.FEBRUARY, 2002), 96.265); series1.add(new Day(12, MonthConstants.FEBRUARY, 2002), 96.160); series1.add(new Day(13, MonthConstants.FEBRUARY, 2002), 96.120); series1.add(new Day(14, MonthConstants.FEBRUARY, 2002), 96.125); series1.add(new Day(15, MonthConstants.FEBRUARY, 2002), 96.265); series1.add(new Day(19, MonthConstants.FEBRUARY, 2002), 96.290); series1.add(new Day(20, MonthConstants.FEBRUARY, 2002), 96.275); series1.add(new Day(21, MonthConstants.FEBRUARY, 2002), 96.280); series1.add(new Day(22, MonthConstants.FEBRUARY, 2002), 96.305); series1.add(new Day(25, MonthConstants.FEBRUARY, 2002), 96.265); series1.add(new Day(26, MonthConstants.FEBRUARY, 2002), 96.185); series1.add(new Day(27, MonthConstants.FEBRUARY, 2002), 96.305); series1.add(new Day(28, MonthConstants.FEBRUARY, 2002), 96.215); series1.add(new Day(1, MonthConstants.MARCH, 2002), 96.015); series1.add(new Day(4, MonthConstants.MARCH, 2002), 95.970); series1.add(new Day(5, MonthConstants.MARCH, 2002), 95.935); series1.add(new Day(6, MonthConstants.MARCH, 2002), 95.935); series1.add(new Day(7, MonthConstants.MARCH, 2002), 95.705); series1.add(new Day(8, MonthConstants.MARCH, 2002), 95.4850); series1.add(new Day(11, MonthConstants.MARCH, 2002), 95.505); series1.add(new Day(12, MonthConstants.MARCH, 2002), 95.540); series1.add(new Day(13, MonthConstants.MARCH, 2002), 95.675); series1.add(new Day(14, MonthConstants.MARCH, 2002), 95.510); series1.add(new Day(15, MonthConstants.MARCH, 2002), 95.500); series1.add(new Day(18, MonthConstants.MARCH, 2002), 95.500); series1.add(new Day(19, MonthConstants.MARCH, 2002), 95.535); series1.add(new Day(20, MonthConstants.MARCH, 2002), 95.420); series1.add(new Day(21, MonthConstants.MARCH, 2002), 95.400); series1.add(new Day(22, MonthConstants.MARCH, 2002), 95.375); series1.add(new Day(25, MonthConstants.MARCH, 2002), 95.350); series1.add(new Day(26, MonthConstants.MARCH, 2002), 95.505); series1.add(new Day(27, MonthConstants.MARCH, 2002), 95.550); series1.add(new Day(28, MonthConstants.MARCH, 2002), 95.485); series1.add(new Day(1, MonthConstants.APRIL, 2002), 95.485); series1.add(new Day(2, MonthConstants.APRIL, 2002), 95.630); series1.add(new Day(3, MonthConstants.APRIL, 2002), 95.735); series1.add(new Day(4, MonthConstants.APRIL, 2002), 95.695); series1.add(new Day(5, MonthConstants.APRIL, 2002), 95.810); series1.add(new Day(8, MonthConstants.APRIL, 2002), 95.810); series1.add(new Day(9, MonthConstants.APRIL, 2002), 95.865); series1.add(new Day(10, MonthConstants.APRIL, 2002), 95.885); series1.add(new Day(11, MonthConstants.APRIL, 2002), 95.900); series1.add(new Day(12, MonthConstants.APRIL, 2002), 95.980); series1.add(new Day(15, MonthConstants.APRIL, 2002), 96.035); series1.add(new Day(16, MonthConstants.APRIL, 2002), 96.000); series1.add(new Day(17, MonthConstants.APRIL, 2002), 96.035); series1.add(new Day(18, MonthConstants.APRIL, 2002), 96.085); series1.add(new Day(19, MonthConstants.APRIL, 2002), 96.0750); series1.add(new Day(22, MonthConstants.APRIL, 2002), 96.105); series1.add(new Day(23, MonthConstants.APRIL, 2002), 96.075); series1.add(new Day(24, MonthConstants.APRIL, 2002), 96.210); series1.add(new Day(25, MonthConstants.APRIL, 2002), 96.255); series1.add(new Day(26, MonthConstants.APRIL, 2002), 96.310); series1.add(new Day(29, MonthConstants.APRIL, 2002), 96.310); series1.add(new Day(30, MonthConstants.APRIL, 2002), 96.325); series1.add(new Day(1, MonthConstants.MAY, 2002), 96.345); series1.add(new Day(2, MonthConstants.MAY, 2002), 96.285); series1.add(new Day(3, MonthConstants.MAY, 2002), 96.385); series1.add(new Day(6, MonthConstants.MAY, 2002), 96.380); series1.add(new Day(7, MonthConstants.MAY, 2002), 96.485); series1.add(new Day(8, MonthConstants.MAY, 2002), 96.230); series1.add(new Day(9, MonthConstants.MAY, 2002), 96.310); series1.add(new Day(10, MonthConstants.MAY, 2002), 96.445); series1.add(new Day(13, MonthConstants.MAY, 2002), 96.355); series1.add(new Day(14, MonthConstants.MAY, 2002), 96.180); series1.add(new Day(15, MonthConstants.MAY, 2002), 96.240); series1.add(new Day(16, MonthConstants.MAY, 2002), 96.325); series1.add(new Day(17, MonthConstants.MAY, 2002), 96.200); series1.add(new Day(20, MonthConstants.MAY, 2002), 96.305); series1.add(new Day(21, MonthConstants.MAY, 2002), 96.385); series1.add(new Day(22, MonthConstants.MAY, 2002), 96.445); series1.add(new Day(23, MonthConstants.MAY, 2002), 96.385); series1.add(new Day(24, MonthConstants.MAY, 2002), 96.390); series1.add(new Day(28, MonthConstants.MAY, 2002), 96.390); series1.add(new Day(29, MonthConstants.MAY, 2002), 96.475); series1.add(new Day(30, MonthConstants.MAY, 2002), 96.555); series1.add(new Day(31, MonthConstants.MAY, 2002), 96.500); series1.add(new Day(3, MonthConstants.JUNE, 2002), 96.540); series1.add(new Day(4, MonthConstants.JUNE, 2002), 96.605); series1.add(new Day(5, MonthConstants.JUNE, 2002), 96.580); series1.add(new Day(6, MonthConstants.JUNE, 2002), 96.610); series1.add(new Day(7, MonthConstants.JUNE, 2002), 96.600); series1.add(new Day(10, MonthConstants.JUNE, 2002), 96.615); series1.add(new Day(11, MonthConstants.JUNE, 2002), 96.705); series1.add(new Day(12, MonthConstants.JUNE, 2002), 96.750); series1.add(new Day(13, MonthConstants.JUNE, 2002), 96.830); series1.add(new Day(14, MonthConstants.JUNE, 2002), 96.965); series1.add(new Day(17, MonthConstants.JUNE, 2002), 96.945); series1.add(new Day(18, MonthConstants.JUNE, 2002), 96.990); series1.add(new Day(19, MonthConstants.JUNE, 2002), 97.165); series1.add(new Day(20, MonthConstants.JUNE, 2002), 97.030); series1.add(new Day(21, MonthConstants.JUNE, 2002), 97.145); series1.add(new Day(24, MonthConstants.JUNE, 2002), 97.120); series1.add(new Day(25, MonthConstants.JUNE, 2002), 97.175); series1.add(new Day(26, MonthConstants.JUNE, 2002), 97.365); series1.add(new Day(27, MonthConstants.JUNE, 2002), 97.245); series1.add(new Day(28, MonthConstants.JUNE, 2002), 97.245); series1.add(new Day(1, MonthConstants.JULY, 2002), 97.290); series1.add(new Day(2, MonthConstants.JULY, 2002), 97.380); series1.add(new Day(3, MonthConstants.JULY, 2002), 97.380); series1.add(new Day(5, MonthConstants.JULY, 2002), 97.220); series1.add(new Day(8, MonthConstants.JULY, 2002), 97.325); series1.add(new Day(9, MonthConstants.JULY, 2002), 97.455); series1.add(new Day(10, MonthConstants.JULY, 2002), 97.580); series1.add(new Day(11, MonthConstants.JULY, 2002), 97.605); series1.add(new Day(12, MonthConstants.JULY, 2002), 97.690); series1.add(new Day(15, MonthConstants.JULY, 2002), 97.730); series1.add(new Day(16, MonthConstants.JULY, 2002), 97.580); series1.add(new Day(17, MonthConstants.JULY, 2002), 97.640); series1.add(new Day(18, MonthConstants.JULY, 2002), 97.680); series1.add(new Day(19, MonthConstants.JULY, 2002), 97.715); series1.add(new Day(22, MonthConstants.JULY, 2002), 97.815); series1.add(new Day(23, MonthConstants.JULY, 2002), 97.875); series1.add(new Day(24, MonthConstants.JULY, 2002), 97.835); series1.add(new Day(25, MonthConstants.JULY, 2002), 97.925); series1.add(new Day(26, MonthConstants.JULY, 2002), 97.960); series1.add(new Day(29, MonthConstants.JULY, 2002), 97.745); series1.add(new Day(30, MonthConstants.JULY, 2002), 97.710); series1.add(new Day(31, MonthConstants.JULY, 2002), 97.930); series1.add(new Day(1, MonthConstants.AUGUST, 2002), 98.000); series1.add(new Day(2, MonthConstants.AUGUST, 2002), 98.170); series1.add(new Day(5, MonthConstants.AUGUST, 2002), 98.225); series1.add(new Day(6, MonthConstants.AUGUST, 2002), 98.115); series1.add(new Day(7, MonthConstants.AUGUST, 2002), 98.265); series1.add(new Day(8, MonthConstants.AUGUST, 2002), 98.180); series1.add(new Day(9, MonthConstants.AUGUST, 2002), 98.185); series1.add(new Day(12, MonthConstants.AUGUST, 2002), 98.150); series1.add(new Day(13, MonthConstants.AUGUST, 2002), 98.290); series1.add(new Day(14, MonthConstants.AUGUST, 2002), 98.155); series1.add(new Day(15, MonthConstants.AUGUST, 2002), 98.075); series1.add(new Day(16, MonthConstants.AUGUST, 2002), 98.000); series1.add(new Day(19, MonthConstants.AUGUST, 2002), 98.040); series1.add(new Day(20, MonthConstants.AUGUST, 2002), 98.135); series1.add(new Day(21, MonthConstants.AUGUST, 2002), 98.110); series1.add(new Day(22, MonthConstants.AUGUST, 2002), 98.005); series1.add(new Day(23, MonthConstants.AUGUST, 2002), 98.055); series1.add(new Day(26, MonthConstants.AUGUST, 2002), 98.065); series1.add(new Day(27, MonthConstants.AUGUST, 2002), 97.980); series1.add(new Day(28, MonthConstants.AUGUST, 2002), 98.035); series1.add(new Day(29, MonthConstants.AUGUST, 2002), 98.095); series1.add(new Day(30, MonthConstants.AUGUST, 2002), 98.060); series1.add(new Day(3, MonthConstants.SEPTEMBER, 2002), 98.250); series1.add(new Day(4, MonthConstants.SEPTEMBER, 2002), 98.245); series1.add(new Day(5, MonthConstants.SEPTEMBER, 2002), 98.315); series1.add(new Day(6, MonthConstants.SEPTEMBER, 2002), 98.170); series1.add(new Day(9, MonthConstants.SEPTEMBER, 2002), 98.080); series1.add(new Day(10, MonthConstants.SEPTEMBER, 2002), 98.090); series1.add(new Day(11, MonthConstants.SEPTEMBER, 2002), 98.030); series1.add(new Day(12, MonthConstants.SEPTEMBER, 2002), 98.105); series1.add(new Day(13, MonthConstants.SEPTEMBER, 2002), 98.135); series1.add(new Day(16, MonthConstants.SEPTEMBER, 2002), 98.115); series1.add(new Day(17, MonthConstants.SEPTEMBER, 2002), 98.125); series1.add(new Day(18, MonthConstants.SEPTEMBER, 2002), 98.130); series1.add(new Day(19, MonthConstants.SEPTEMBER, 2002), 98.255); series1.add(new Day(20, MonthConstants.SEPTEMBER, 2002), 98.255); series1.add(new Day(23, MonthConstants.SEPTEMBER, 2002), 98.280); series1.add(new Day(24, MonthConstants.SEPTEMBER, 2002), 98.310); series1.add(new Day(25, MonthConstants.SEPTEMBER, 2002), 98.250); series1.add(new Day(26, MonthConstants.SEPTEMBER, 2002), 98.300); series1.add(new Day(27, MonthConstants.SEPTEMBER, 2002), 98.410); series1.add(new Day(30, MonthConstants.SEPTEMBER, 2002), 98.495); series1.add(new Day(1, MonthConstants.OCTOBER, 2002), 98.440); series1.add(new Day(2, MonthConstants.OCTOBER, 2002), 98.440); series1.add(new Day(3, MonthConstants.OCTOBER, 2002), 98.440); series1.add(new Day(4, MonthConstants.OCTOBER, 2002), 98.380); series1.add(new Day(7, MonthConstants.OCTOBER, 2002), 98.385); series1.add(new Day(8, MonthConstants.OCTOBER, 2002), 98.340); series1.add(new Day(9, MonthConstants.OCTOBER, 2002), 98.420); series1.add(new Day(10, MonthConstants.OCTOBER, 2002), 98.375); series1.add(new Day(11, MonthConstants.OCTOBER, 2002), 98.275); series1.add(new Day(14, MonthConstants.OCTOBER, 2002), 98.275); series1.add(new Day(15, MonthConstants.OCTOBER, 2002), 98.135); series1.add(new Day(16, MonthConstants.OCTOBER, 2002), 98.165); series1.add(new Day(17, MonthConstants.OCTOBER, 2002), 98.170); series1.add(new Day(18, MonthConstants.OCTOBER, 2002), 98.165); series1.add(new Day(21, MonthConstants.OCTOBER, 2002), 98.105); series1.add(new Day(22, MonthConstants.OCTOBER, 2002), 98.125); series1.add(new Day(23, MonthConstants.OCTOBER, 2002), 98.185); series1.add(new Day(24, MonthConstants.OCTOBER, 2002), 98.245); series1.add(new Day(25, MonthConstants.OCTOBER, 2002), 98.320); series1.add(new Day(28, MonthConstants.OCTOBER, 2002), 98.420); series1.add(new Day(29, MonthConstants.OCTOBER, 2002), 98.540); series1.add(new Day(30, MonthConstants.OCTOBER, 2002), 98.545); series1.add(new Day(31, MonthConstants.OCTOBER, 2002), 98.560); return new TimeSeriesCollection(series1); }
From source file:DualAxisDemo2.java
/** * Creates a sample dataset.// w w w . ja v a2 s . c om * * @return The dataset. */ private XYDataset createDataset2() { final TimeSeries s2 = new TimeSeries("Random Data 2", Month.class); s2.add(new Month(2, 2001), 429.6); s2.add(new Month(3, 2001), 323.2); s2.add(new Month(4, 2001), 417.2); s2.add(new Month(5, 2001), 624.1); s2.add(new Month(6, 2001), 422.6); s2.add(new Month(7, 2001), 619.2); s2.add(new Month(8, 2001), 416.5); s2.add(new Month(9, 2001), 512.7); s2.add(new Month(10, 2001), 501.5); s2.add(new Month(11, 2001), 306.1); s2.add(new Month(12, 2001), 410.3); s2.add(new Month(1, 2002), 511.7); s2.add(new Month(2, 2002), 611.0); s2.add(new Month(3, 2002), 709.6); s2.add(new Month(4, 2002), 613.2); s2.add(new Month(5, 2002), 711.6); s2.add(new Month(6, 2002), 708.8); s2.add(new Month(7, 2002), 501.6); final TimeSeriesCollection dataset = new TimeSeriesCollection(); dataset.addSeries(s2); return dataset; }
From source file:org.jfree.chart.demo.CombinedXYPlotDemo2.java
/** * Creates a sample dataset.//from w w w . j a va 2 s .com * * @return Series 1. */ private IntervalXYDataset createDataset1() { // create dataset 1... final TimeSeries series1 = new TimeSeries("Series 1", Day.class); series1.add(new Day(1, SerialDate.MARCH, 2002), 12353.3); series1.add(new Day(2, SerialDate.MARCH, 2002), 13734.4); series1.add(new Day(3, SerialDate.MARCH, 2002), 14525.3); series1.add(new Day(4, SerialDate.MARCH, 2002), 13984.3); series1.add(new Day(5, SerialDate.MARCH, 2002), 12999.4); series1.add(new Day(6, SerialDate.MARCH, 2002), 14274.3); series1.add(new Day(7, SerialDate.MARCH, 2002), 15943.5); series1.add(new Day(8, SerialDate.MARCH, 2002), 14845.3); series1.add(new Day(9, SerialDate.MARCH, 2002), 14645.4); series1.add(new Day(10, SerialDate.MARCH, 2002), 16234.6); series1.add(new Day(11, SerialDate.MARCH, 2002), 17232.3); series1.add(new Day(12, SerialDate.MARCH, 2002), 14232.2); series1.add(new Day(13, SerialDate.MARCH, 2002), 13102.2); series1.add(new Day(14, SerialDate.MARCH, 2002), 14230.2); series1.add(new Day(15, SerialDate.MARCH, 2002), 11235.2); final TimeSeriesCollection collection = new TimeSeriesCollection(series1); collection.setDomainIsPointsInTime(false); // this tells the time series collection that // we intend the data to represent time periods // NOT points in time. This is required when // determining the min/max values in the // dataset's domain. return collection; }
From source file:org.jfree.chart.demo.TimeSeriesDemo9.java
/** * Creates a time series containing random daily data. * * @param series the series index./* w ww. j ava2 s. co m*/ * @param count the number of items for the series. * * @return the dataset. */ public TimeSeries createTimeSeries(final int series, final int count) { final TimeSeries result = new TimeSeries("Series " + series, Day.class); Day start = new Day(); for (int i = 0; i < count; i++) { result.add(start, Math.random()); start = (Day) start.next(); } return result; }
From source file:org.jrecruiter.web.actions.admin.ShowStatisticsAction.java
public final String chartJobCount() throws Exception { final Calendar calendarToday = CalendarUtils.getCalendarWithoutTime(); final Calendar calendar30 = CalendarUtils.getCalendarWithoutTime(); calendar30.add(Calendar.MONTH, -36); final List<JobCountPerDay> jobCountPerDayList = jobService.getJobCountPerDayAndPeriod(calendar30.getTime(), calendarToday.getTime());//from ww w. j av a2 s. c o m final TimeSeries hitsPerDayData = new TimeSeries("Hits", Day.class); final XYDataset hitsPerDayDataset = new TimeSeriesCollection(hitsPerDayData); this.chart = ChartFactory.createTimeSeriesChart("", super.getText("class.ShowStatisticsAcion.chart.job.count.caption"), "", hitsPerDayDataset, false, true, false); final XYPlot xyplot = (XYPlot) this.chart.getPlot(); for (JobCountPerDay jobCountPerDay : jobCountPerDayList) { final Day day = new Day(jobCountPerDay.getJobDate()); if (jobCountPerDay.getAutomaticallyCleaned()) { final Marker originalEnd = new ValueMarker(day.getFirstMillisecond()); originalEnd.setPaint(new Color(0, 80, 138, 150)); float[] dashPattern = { 6, 2 }; originalEnd.setStroke( new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, dashPattern, 0)); originalEnd.setLabelAnchor(RectangleAnchor.TOP_LEFT); originalEnd.setLabelTextAnchor(TextAnchor.TOP_RIGHT); originalEnd.setLabel("C"); originalEnd.setAlpha(0.1F); xyplot.addDomainMarker(originalEnd); } hitsPerDayData.add(day, jobCountPerDay.getTotalNumberOfJobs()); } chart.setBackgroundPaint(new Color(255, 255, 255, 0)); xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY); xyplot.setBackgroundPaint(new Color(255, 255, 255, 0)); xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(false); xyitemrenderer.setSeriesPaint(0, new Color(244, 66, 0)); } DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setAutoRange(true); dateaxis.setAutoTickUnitSelection(true); NumberAxis valueAxis = (NumberAxis) xyplot.getRangeAxis(); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return SUCCESS; }