X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fper_series.js;h=f3ff16d099c551f8ee3f6bc45a4cdf45a16906ac;hb=bedc5cd39283fe07b9e4125c4e397b14571fed15;hp=a09f912c367e220e2c4c8ec10210b0cbe4de1215;hpb=3123ca57f71d145bb5bcc4a2f754d3dff3225346;p=dygraphs.git diff --git a/auto_tests/tests/per_series.js b/auto_tests/tests/per_series.js index a09f912..f3ff16d 100644 --- a/auto_tests/tests/per_series.js +++ b/auto_tests/tests/per_series.js @@ -3,14 +3,14 @@ * * @author danvk@google.com (Dan Vanderkam) */ -describe("per-series", function() { -beforeEach(function() { - document.body.innerHTML = "
"; -}); +import Dygraph from '../../src/dygraph'; -afterEach(function() { -}); +import PixelSampler from './PixelSampler'; + +describe("per-series", function() { + +cleanupAfterEach(); it('testPerSeriesFill', function() { var opts = { @@ -55,6 +55,49 @@ it('testPerSeriesFill', function() { assert.deepEqual([255,0,0,38], sampler.colorAtCoordinate(6.5, 0.5)); }); +it('testPerSeriesAlpha', function() { + var opts = { + width: 480, + height: 320, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, + series: { + Y: { fillGraph: true, fillAlpha: 0.25 }, + Z: { fillGraph: true, fillAlpha: 0.75 } + }, + colors: [ '#FF0000', '#0000FF' ] + }; + var data = "X,Y,Z\n" + + "1,0,0\n" + + "2,0,1\n" + + "3,0,1\n" + + "4,0,0\n" + + "5,0,0\n" + + "6,1,0\n" + + "7,1,0\n" + + "8,0,0\n" + ; + + var graph = document.getElementById("graph"); + var g = new Dygraph(graph, data, opts); + + var sampler = new PixelSampler(g); + + // Inside of the "Y" bump -- 5% alpha. + assert.deepEqual([255,0,0,63], sampler.colorAtCoordinate(6.5, 0.5)); + + // Inside of the "Z" bump -- 95% alpha. + assert.deepEqual([0,0,255,191], sampler.colorAtCoordinate(2.5, 0.5)); +}); + it('testNewStyleSeries', function() { var opts = { pointSize : 5,