From 5060dffddf83f9bf53a0b218bfb050553f4a1f74 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 28 Dec 2016 11:47:10 -0500 Subject: [PATCH] Remove deprecated avoidMinZero option --- auto_tests/tests/pathological_cases.js | 4 -- auto_tests/tests/range_tests.js | 44 ++++-------------- gallery/avoid-min-zero.js | 61 ------------------------ gallery/edge-padding.js | 84 ---------------------------------- gallery/index.html | 2 - src/dygraph-default-attrs.js | 1 - src/dygraph-options-reference.js | 8 +--- src/dygraph.js | 13 ++---- tests/avoidMinZero.html | 81 -------------------------------- 9 files changed, 15 insertions(+), 283 deletions(-) delete mode 100644 gallery/avoid-min-zero.js delete mode 100644 gallery/edge-padding.js delete mode 100644 tests/avoidMinZero.html diff --git a/auto_tests/tests/pathological_cases.js b/auto_tests/tests/pathological_cases.js index 0fab200..326fefb 100644 --- a/auto_tests/tests/pathological_cases.js +++ b/auto_tests/tests/pathological_cases.js @@ -70,10 +70,6 @@ it('testCombinations', function() { var variantOpts = { none: {}, - avoidMinZero: { - avoidMinZero: true, - includeZero: true - }, padded: { includeZero: true, drawAxesAtZero: true, diff --git a/auto_tests/tests/range_tests.js b/auto_tests/tests/range_tests.js index 19d4294..f14d30f 100644 --- a/auto_tests/tests/range_tests.js +++ b/auto_tests/tests/range_tests.js @@ -19,7 +19,7 @@ // THE SOFTWARE. -/** +/** * @fileoverview Test valueRange and dateWindow changes. * * @author konigsberg@google.com (Robert Konigsberg) @@ -43,7 +43,7 @@ var ZERO_TO_FIFTY_STEPS = (function() { }()); var FIVE_TO_ONE_THOUSAND = [ - [ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ], + [ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ], [ 6, 60 ], [ 7, 70 ], [ 8, 80 ], [ 9, 90 ] , [ 10, 1000 ]]; describe("range-tests", function() { @@ -106,7 +106,7 @@ it('testRangeSetOperations', function() { g.updateOptions({ }); assert.deepEqual([12, 18], g.xAxisRange()); assert.deepEqual([10, 40], g.yAxisRange(0)); - + g.updateOptions({valueRange : null, axes: {y:{valueRange : [15, 20]}}}); assert.deepEqual([12, 18], g.xAxisRange()); assert.deepEqual([15, 20], g.yAxisRange(0)); @@ -182,7 +182,7 @@ it('testLogScaleExcludesZero', function() { labels: ['X', 'Y'] }); assert.deepEqual([10, 1099], g.yAxisRange(0)); - + g.updateOptions({ logscale : false }); assert.deepEqual([0, 1099], g.yAxisRange(0)); }); @@ -196,7 +196,7 @@ it('testIncludeZeroIncludesZero', function() { labels: ['X', 'Y'] }); assert.deepEqual([0, 1100], g.yAxisRange(0)); - + g.updateOptions({ includeZero : false }); assert.deepEqual([450, 1050], g.yAxisRange(0)); }); @@ -206,14 +206,14 @@ it('testIncludeZeroIncludesZero', function() { * Verify that includeZero range is properly specified per axis. */ it('testIncludeZeroPerAxis', function() { - var g = new Dygraph("graph", + var g = new Dygraph("graph", 'X,A,B\n'+ '0,50,50\n'+ '50,110,110\n', { drawPoints: true, pointSize:5, - series:{ + series:{ A: { axis: 'y', pointSize: 10 @@ -221,7 +221,7 @@ it('testIncludeZeroPerAxis', function() { B: { axis: 'y2' } - }, + }, axes: { 'y2': { includeZero: true } } @@ -242,7 +242,7 @@ it('testIncludeZeroPerAxis', function() { /** * Verify that very large Y ranges don't break things. - */ + */ it('testHugeRange', function() { var g = new Dygraph("graph", [[0, -1e120], [1, 1e230]], { includeZero: true, @@ -253,15 +253,6 @@ it('testHugeRange', function() { }); /** - * Verify old-style avoidMinZero option. - */ -it('testAvoidMinZero', function() { - var g = createGraph({ - avoidMinZero: true, - }, ZERO_TO_FIFTY_STEPS, [10, 20], [-5, 55]); -}); - -/** * Verify ranges with user-specified padding, implicit avoidMinZero. */ it('testPaddingAuto', function() { @@ -346,23 +337,6 @@ it('testLogscalePad', function() { }); /** - * Verify scrolling all-zero region, traditional. - */ -it('testZeroScroll', function() { - var g = new Dygraph( - document.getElementById("graph"), - "X,Y\n" + - "1,0\n" + - "8,0\n" + - "9,0.1\n", - { - drawAxesAtZero: true, - animatedZooms: true, - avoidMinZero: true - }); -}); - -/** * Verify scrolling all-zero region, new-style. */ it('testZeroScroll2', function() { diff --git a/gallery/avoid-min-zero.js b/gallery/avoid-min-zero.js deleted file mode 100644 index e74345f..0000000 --- a/gallery/avoid-min-zero.js +++ /dev/null @@ -1,61 +0,0 @@ -/*global Gallery,Dygraph,data */ -Gallery.register( - 'avoid-min-zero', - { - name: "Avoid Min Zero", - setup: function(parent) { - parent.innerHTML = - "

1: Line chart with axis at zero problem:

" + - "

2: Step chart with axis at zero problem:

" + - "

3: Line chart with avoidMinZero option:

" + - "

4: Step chart with avoidMinZero option:

"; - }, - run: function() { - new Dygraph(document.getElementById("graph1"), - "Date,Temperature\n" + - "2008-05-07,0\n" + - "2008-05-08,1\n" + - "2008-05-09,0\n" + - "2008-05-10,0\n" + - "2008-05-11,3\n" + - "2008-05-12,4\n" - ); - new Dygraph(document.getElementById("graphd2"), - "Date,Temperature\n" + - "2008-05-07,0\n" + - "2008-05-08,1\n" + - "2008-05-09,0\n" + - "2008-05-10,0\n" + - "2008-05-11,3\n" + - "2008-05-12,4\n", - { - stepPlot: true - } - ); - new Dygraph(document.getElementById("graph3"), - "Date,Temperature\n" + - "2008-05-07,0\n" + - "2008-05-08,1\n" + - "2008-05-09,0\n" + - "2008-05-10,0\n" + - "2008-05-11,3\n" + - "2008-05-12,4\n", - { - avoidMinZero: true - } - ); - new Dygraph(document.getElementById("graphd4"), - "Date,Temperature\n" + - "2008-05-07,0\n" + - "2008-05-08,1\n" + - "2008-05-09,0\n" + - "2008-05-10,0\n" + - "2008-05-11,3\n" + - "2008-05-12,4\n", - { - stepPlot: true, - avoidMinZero: true - } - ); - } -}); diff --git a/gallery/edge-padding.js b/gallery/edge-padding.js deleted file mode 100644 index 5956d4a..0000000 --- a/gallery/edge-padding.js +++ /dev/null @@ -1,84 +0,0 @@ -/*global Gallery,Dygraph,data */ -Gallery.register( - 'edge-padding', - { - name: 'Edge Padding', - title: 'Graph edge padding and axis position', - setup: function(parent) { - parent.innerHTML = ( - "" + - "

" + - " Mode:" + - " use {x,y}RangePad" + - " original" + - "
Settings:" + - " valueRange=[-2,2]" + - "

" + - "
" - ); - }, - run: function() { - var parent = document.getElementById("demodiv"); - - var graphs = []; - var nrows = 50; - - for (var oy = -2; oy <= 2; ++oy) { - for (var ox = -1; ox <= 1; ++ox) { - var gdiv = document.createElement('div'); - gdiv.style.display = 'inline-block'; - gdiv.style.margin = '2px'; - parent.appendChild(gdiv); - - var data = []; - for (var row = 0; row < nrows; ++row) { - var x = row * 5 / (nrows - 1); - data.push([ox * 2.5 + x - 2.5, - oy + Math.sin(x), - oy + Math.round(Math.cos(x))]); - } - - var g = new Dygraph(gdiv, data, { - labels: ['x', 'A', 'B'], - gridLineColor: '#ccc', - includeZero: true, - width: 250, - height: 130 - }); - graphs.push(g); - } - parent.appendChild(document.createElement('br')); - } - - var updateGraphOpts = function(opts) { - for (var i = 0; i < graphs.length; ++i) { - graphs[i].updateOptions(opts); - } - }; - - var mode = document.getElementsByName('mode'); - mode[0].onchange = function() { - updateGraphOpts({ - avoidMinZero: false, - xRangePad: 3, - yRangePad: 10, - drawAxesAtZero: true}); - }; - mode[1].onchange = function() { - updateGraphOpts({ - avoidMinZero: true, - xRangePad: 0, - yRangePad: null, - drawAxesAtZero: false}); - }; - mode[0].checked = true; - mode[0].onchange(); - - var yrange = document.getElementById('yrange'); - yrange.onchange = function(ev) { - updateGraphOpts({ - valueRange: ev.target.checked ? [-2, 2] : null}); - }; - - } - }); diff --git a/gallery/index.html b/gallery/index.html index a749cf0..86c87ec 100644 --- a/gallery/index.html +++ b/gallery/index.html @@ -33,14 +33,12 @@ - - - - - -

1: Line chart with axis at zero problem:

-
- - -

2: Step chart with axis at zero problem:

-
- - -

3: Line chart with avoidMinZero option:

-
- - -

4: Step chart with avoidMinZero option:

-
- - - - -- 2.7.4