/** * Returns the y-value for the specified series and item. * * @param series the series (zero-based index). * @param item the item (zero-based index). * * @return The value (possibly {@code null}). */ @Override public Number getY(int series, int item) { TimeSeries ts = (TimeSeries) this.data.get(series); return ts.getValue(item); }
/** * Returns the y-value for the specified series and item. * * @param series the series (zero-based index). * @param item the item (zero-based index). * * @return The value (possibly <code>null</code>). */ public Number getY(int series, int item) { TimeSeries ts = (TimeSeries) this.data.get(series); return ts.getValue(item); }
private static void updateSeries( TimeSeries series, Second second, double increment ) { Number old = series.getValue( second ); if ( old == null ) { old = 0d; } double newValue = old.doubleValue() + increment; series.addOrUpdate( second, newValue ); }
/** * Returns the value for a time period. If there is no data item with the * specified period, this method will return {@code null}. * * @param period time period ({@code null} not permitted). * * @return The value (possibly {@code null}). */ public Number getValue(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getValue(index); } return null; }
/** * Returns the value for a time period. If there is no data item with the * specified period, this method will return <code>null</code>. * * @param period time period (<code>null</code> not permitted). * * @return The value (possibly <code>null</code>). */ public Number getValue(RegularTimePeriod period) { int index = getIndex(period); if (index >= 0) { return getValue(index); } else { return null; } }
TimeChart.TimeDataRow[] generateDataSet(final TimeSeriesCollection dataSet, XYURLGenerator urlGenerator, TimeZoneManager timeZoneManager) { final TimePeriodUtils timePeriodUtils = new TimePeriodUtils(timeZoneManager); final TimeSeries issuesSeries = dataSet.getSeries(0); TimeSeries totalSeries = dataSet.getSeries(1); TimeSeries averageSeries = dataSet.getSeries(2); int count = issuesSeries.getItems().size(); ArrayList<TimeDataRow> data = new ArrayList<TimeChart.TimeDataRow>(count); for (int i = 0; i < count; i++) { final int issues = issuesSeries.getValue(i).intValue(); final int total = totalSeries.getValue(i).intValue(); final int avg = averageSeries.getValue(i).intValue(); final String issuesLink = urlGenerator != null ? urlGenerator.generateURL(dataSet, 0, i) : null; final RegularTimePeriod timePeriod = issuesSeries.getTimePeriod(i); data.add(new TimeChart.TimeDataRow(timePeriodUtils.prettyPrint(timePeriod), issues, issuesLink, total, avg)); } return data.toArray(new TimeChart.TimeDataRow[data.size()]); } }
return this.series.getValue(row);
return this.series.getValue(row);
public static void normaliseDateRange(TimeSeriesCollection collection, RegularTimePeriod[] range) { if (collection.getSeriesCount() == 0) return; // find earliest date, then move it forwards until we hit now RegularTimePeriod earliest = range[0]; RegularTimePeriod latest = range[1]; RegularTimePeriod cursor = earliest; for (int i = 0; i < collection.getSeriesCount(); i++) { TimeSeries series = collection.getSeries(i); while (cursor.compareTo(latest) != 1) { if (series.getValue(cursor) == null) series.add(cursor, Integer.valueOf(0)); cursor = cursor.next(); } cursor = earliest; } } }
/** * Creates a TimeSeriesCollection which represents the cumulative values of a given TimeSeriesCollection. * * @param collection collection * @return TimeSeriesCollection */ public static TimeSeriesCollection makeCumulative(TimeSeriesCollection collection) { TimeSeriesCollection result = new TimeSeriesCollection(); for (int i = 0; i < collection.getSeriesCount(); i++) { TimeSeries oldSeries = collection.getSeries(i); TimeSeries cumulativeSeries = new TimeSeries(oldSeries.getKey(), oldSeries.getTimePeriodClass()); int cumulativeValue = 0; for (int j = 0; j < oldSeries.getItemCount(); j++) { cumulativeValue += oldSeries.getValue(j).intValue(); cumulativeSeries.add(oldSeries.getTimePeriod(j), Integer.valueOf(cumulativeValue)); } result.addSeries(cumulativeSeries); } return result; }
if(key != null) { Number existing = null; if((existing = ts.getValue(key)) == null) { ts.add(key, getTotalValue(s, report)); }else{ if((existing = ts.getValue(key)) == null) { ts.add(key, getTotalValue(s, report)); }else{ if(key != null) { Number existing = null; if((existing = tsV.getValue(key)) == null) { tsV.add(key, s.getTotalVisits()); tsUV.add(key, s.getTotalUnique());