- * Helper method that computes the y value of a line defined by the points p1
- * and p2 and a given x value.
- *
- * @param {!Array.<number>} p1 left point ([x,y]).
- * @param {!Array.<number>} p2 right point ([x,y]).
- * @param {!number} xValue The x value to compute the y-intersection for.
- * @return {number} corresponding y value to x on the line defined by p1 and p2.
- * @private
- */
-handler.prototype.computeYInterpolation_ = function(p1, p2, xValue) {
- var deltaY = p2[1] - p1[1];
- var deltaX = p2[0] - p1[0];
- var gradient = deltaY / deltaX;
- var growth = (xValue - p1[0]) * gradient;
- return p1[1] + growth;
-};
-
-/**
- * Helper method that returns the first and the last index of the given series
- * that lie inside the given dateWindow.
- *
- * @param {!Array.<[!number,?number,?]>} series The series in the unified
- * data format where series[i] = [x,y,{extras}].
- * @param {!Array.<number>} dateWindow The x-value range to display with
- * the format: [min,max].
- * @return {!Array.<[!number,?number,?]>} The samples of the series that
- * are in the given date window.
- * @private
- */
-handler.prototype.getIndexesInWindow_ = function(series, dateWindow) {
- var firstIdx = 0, lastIdx = series.length - 1;
- if (dateWindow) {
- var idx = 0;
- var low = dateWindow[0];
- var high = dateWindow[1];
-
- // Start from each side of the array to minimize the performance
- // needed.
- while (idx < series.length - 1 && series[idx][0] < low) {
- firstIdx++;
- idx++;
- }
- idx = series.length - 1;
- while (idx > 0 && series[idx][0] > high) {
- lastIdx--;
- idx--;
- }
- }
- if (firstIdx <= lastIdx) {
- return [ firstIdx, lastIdx ];
- } else {
- return [ 0, series.length - 1 ];
- }
-};
-
-/**