switch (interpolationMethod) { case INTERPOLATE_REGRESSION: calculateBestFitLine(); this.interpolationMethod = interpolationMethod; break;
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param timestamps timestamps in seconds * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(long[] timestamps, double[] values) throws RrdException { this.timestamps = timestamps; this.values = values; validate(); }
rrdGraphDef.setTitle(rrdDef.getDsDefs()[dsIndex].dump() + " " + rrdDef.getArcDefs()[arcIndex].dump()); LinearInterpolator linearInterpolator = new LinearInterpolator(timestamps, values); linearInterpolator.setInterpolationMethod(LinearInterpolator.INTERPOLATE_RIGHT); rrdGraphDef.datasource(dsName, linearInterpolator); rrdGraphDef.area(dsName, color, dsName + "\\r");
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param dates array of GregorianCalendar objects * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(Calendar[] dates, double[] values) throws RrdException { this.values = values; timestamps = new long[dates.length]; for (int i = 0; i < dates.length; i++) { timestamps[i] = Util.getTimestamp(dates[i]); } validate(); }
switch (interpolationMethod) { case INTERPOLATE_REGRESSION: calculateBestFitLine(); case INTERPOLATE_LEFT: case INTERPOLATE_RIGHT:
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param dates Array of Date objects * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(Date[] dates, double[] values) throws RrdException { this.values = values; timestamps = new long[dates.length]; for (int i = 0; i < dates.length; i++) { timestamps[i] = Util.getTimestamp(dates[i]); } validate(); }
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param timestamps timestamps in seconds * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(long[] timestamps, double[] values) throws RrdException { this.timestamps = timestamps; this.values = values; validate(); }
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param dates Array of Date objects * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(Date[] dates, double[] values) throws RrdException { this.values = values; timestamps = new long[dates.length]; for (int i = 0; i < dates.length; i++) { timestamps[i] = Util.getTimestamp(dates[i]); } validate(); }
/** * Creates LinearInterpolator from arrays of timestamps and corresponding datasource values. * * @param dates array of GregorianCalendar objects * @param values corresponding datasource values * @throws RrdException Thrown if supplied arrays do not contain at least two values, or if * timestamps are not ordered, or array lengths are not equal. */ public LinearInterpolator(Calendar[] dates, double[] values) throws RrdException { this.values = values; timestamps = new long[dates.length]; for (int i = 0; i < dates.length; i++) { timestamps[i] = Util.getTimestamp(dates[i]); } validate(); }