X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=auto_tests%2Ftests%2Fcustom_bars.js;h=e8af21456937176fa3fdd03cda8d3f550e5923ad;hb=a105b36aa566cc7b4198635af7ad36662ad5e30b;hp=493e86c533fd1b826559a0c8c5be34b4820b589b;hpb=23db4e0795017c84f7ae1c081a914ff46b719c42;p=dygraphs.git diff --git a/auto_tests/tests/custom_bars.js b/auto_tests/tests/custom_bars.js index 493e86c..e8af214 100644 --- a/auto_tests/tests/custom_bars.js +++ b/auto_tests/tests/custom_bars.js @@ -6,16 +6,16 @@ */ var CustomBarsTestCase = TestCase("custom-bars"); -var _origFunc = Dygraph.getContext; +CustomBarsTestCase._origFunc = Dygraph.getContext; CustomBarsTestCase.prototype.setUp = function() { document.body.innerHTML = "
"; Dygraph.getContext = function(canvas) { - return new Proxy(_origFunc(canvas)); + return new Proxy(CustomBarsTestCase._origFunc(canvas)); } }; CustomBarsTestCase.prototype.tearDown = function() { - Dygraph.getContext = _origFunc; + Dygraph.getContext = CustomBarsTestCase._origFunc; }; // This test used to reliably produce an infinite loop. @@ -99,10 +99,16 @@ CustomBarsTestCase.prototype.testCustomBarsAtTop = function() { width: 500, height: 350, customBars: true, errorBars: true, - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, valueRange: [0, 120], fillAlpha: 0.15, colors: [ '#00FF00' ] @@ -124,10 +130,16 @@ CustomBarsTestCase.prototype.testCustomBarsLogScale = function() { customBars: true, errorBars: true, valueRange: [1, 120], - drawXGrid: false, - drawYGrid: false, - drawXAxis: false, - drawYAxis: false, + axes : { + x : { + drawGrid: false, + drawAxis: false, + }, + y : { + drawGrid: false, + drawAxis: false, + } + }, fillAlpha: 1.0, logscale: true, colors: [ '#00FF00' ] @@ -151,3 +163,33 @@ CustomBarsTestCase.prototype.testCustomBarsLogScale = function() { [247.5, 152.02209814465604]], { fillStyle: "#00ff00" }); }; + +CustomBarsTestCase.prototype.testCustomBarsWithNegativeValuesInLogScale = + function() { + var graph = document.getElementById("graph"); + + var count = 0; + var drawPointCallback = function() { + count++; + }; + + var g = new Dygraph(graph, + [ + [1, [10, 20,30]], + [2, [5, 10, 15]], + [3, [-1, 5, 10]] + ], + { + drawPoints: true, + drawPointCallback : drawPointCallback, + customBars: true + }); + + // Normally all three points would be drawn. + assertEquals(3, count); + count = 0; + + // In log scale, the third point shouldn't be shown. + g.updateOptions({ logscale : true }); + assertEquals(2, count); +};