X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fper_series.js;h=4831ded5994b62d0ca4358a22f4fe78ea3a31842;hb=45a8c16f0f004c4513d2127553d1a2cb2502f282;hp=3b6ee540e57f52ba18c6d8284f4dfc2a268328ec;hpb=e2d8db3a5de3343e44e92d087e5cc3d2a56da1a6;p=dygraphs.git diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index 3b6ee54..4831ded 100644 --- a/auto_tests/tests/per_series.js +++ b/auto_tests/tests/per_series.js @@ -12,43 +12,6 @@ perSeriesTestCase.prototype.setUp = function() { perSeriesTestCase.prototype.tearDown = function() { }; -/** - * @constructor - */ -var PixelSampler = function(dygraph) { - this.dygraph_ = dygraph; - - var canvas = dygraph.hidden_; - var ctx = canvas.getContext("2d"); - this.imageData_ = ctx.getImageData(0, 0, canvas.width, canvas.height); -}; - -/** - * @param {number} x The screen x-coordinate at which to sample. - * @param {number} y The screen y-coordinate at which to sample. - * @return {Array.} a 4D array: [R, G, B, alpha]. All four values - * are in [0, 255]. A pixel which has never been touched will be [0,0,0,0]. - */ -PixelSampler.prototype.colorAtPixel = function(x, y) { - var i = 4 * (x + this.imageData_.width * y); - var d = this.imageData_.data; - return [d[i], d[i+1], d[i+2], d[i+3]]; -}; - -/** - * The method samples a color using data coordinates (not screen coordinates). - * This will round your data coordinates to the nearest screen pixel before - * sampling. - * @param {number} x The data x-coordinate at which to sample. - * @param {number} y The data y-coordinate at which to sample. - * @return {Array.} a 4D array: [R, G, B, alpha]. All four values - * are in [0, 255]. A pixel which has never been touched will be [0,0,0,0]. - */ -PixelSampler.prototype.colorAtCoordinate = function(x, y) { - var dom_xy = this.dygraph_.toDomCoords(x, y); - return this.colorAtPixel(Math.round(dom_xy[0]), Math.round(dom_xy[1])); -}; - perSeriesTestCase.prototype.testPerSeriesFill = function() { var opts = {