/** * Append data to the data set. * * @param d Array containing (x,y) pairs to append * @param n Number of (x,y) data pairs in the array. * @throws Exception A generic exception if it fails to load the parsed array into the class. */ public void append(double d[], int n) throws Exception { int i; int k = 0; double tmp[]; int ln = n * stride; if (d == null || d.length == 0 || n <= 0) { throw new Exception("DataSet: Error in append data!"); } if (data == null) data = new double[increment]; // Copy the data locally. if (ln + length < data.length) { System.arraycopy(d, 0, data, length, ln); length += ln; } else { tmp = new double[ln + length + increment]; if (length != 0) { System.arraycopy(data, 0, tmp, 0, length); } System.arraycopy(d, 0, tmp, length, ln); length += ln; data = tmp; } // Calculate the data range. range(stride); // Update the range on Axis that this data is attached to if (xaxis != null) xaxis.resetRange(); if (yaxis != null) yaxis.resetRange(); }