From fd6b8dadbaa0614671bef1508c23d6a932e25081 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 28 Dec 2016 16:37:08 -0500 Subject: [PATCH] 2.0.0 release fixes (#815) * Documentation / test cleanup * Remove deprecated avoidMinZero option * remove all references to dygraph-combined * Drop for..of and polyfill to save space * Check for strings in native format * Generate minified CSS * Get npm distribution working * Guard process access for rollup * Add ES6 example to home page * Update tests to source CSS from dist * update some references * Drop bower, bump version * index.es5.js * bump version --- .github/CONTRIBUTING.md | 4 +- .github/ISSUE_TEMPLATE.md | 4 +- .gitignore | 1 + README.md | 3 +- auto_tests/tests/formats.js | 10 ++++ auto_tests/tests/pathological_cases.js | 4 -- auto_tests/tests/range_tests.js | 44 ++++------------- bower.json | 37 -------------- docs/header.html | 5 +- docs/index.html | 16 +++++- docs/tutorial.html | 15 ++++-- docs/versions.html | 10 +++- gallery/avoid-min-zero.js | 61 ----------------------- gallery/edge-padding.js | 84 -------------------------------- gallery/gallery.js | 2 +- gallery/index.html | 4 +- gwt/org/danvk/Dygraphs.java | 2 +- index.es5.js | 2 + index.js | 1 + package.json | 26 +++++----- releases.json | 15 ++++++ scripts/build.sh | 17 ++++--- scripts/generate-documentation.py | 2 +- scripts/generate-download.py | 19 +++----- scripts/generate-jsdoc.sh | 2 +- scripts/push-to-web.sh | 27 +++++----- scripts/release.sh | 25 ++-------- scripts/weigh-in.sh | 2 +- src/dygraph-default-attrs.js | 1 - src/dygraph-options-reference.js | 10 ++-- src/dygraph-options.js | 8 ++- src/dygraph.js | 65 ++++++++++++++---------- src/plugins/axes.js | 12 ++--- src/plugins/grid.js | 13 +++-- tests/annotation-gviz.html | 4 -- tests/annotation-native.html | 2 +- tests/annotation.html | 9 +--- tests/avoidMinZero.html | 81 ------------------------------ tests/border.html | 6 +-- tests/callback.html | 6 +-- tests/century-scale.html | 6 +-- tests/charting-combinations.html | 2 +- tests/color-cycle.html | 6 +-- tests/color-visibility.html | 6 +-- tests/connect-separated.html | 6 +-- tests/crosshair.html | 6 +-- tests/css-positioning.html | 2 +- tests/custom-bars.html | 6 +-- tests/custom-circles.html | 6 +-- tests/customLabel.html | 6 +-- tests/customLabelCss3.html | 6 +-- tests/dateWindow.html | 6 +-- tests/daylight-savings.html | 6 +-- tests/demo.html | 6 +-- tests/dense-fill.html | 2 +- tests/draw-points.html | 6 +-- tests/drawing.html | 6 +-- tests/dygraph-many-points-benchmark.html | 6 +-- tests/dygraph.html | 6 +-- tests/dynamic-update.html | 6 +-- tests/exported-symbols.html | 2 +- tests/fillGraph-alpha.html | 6 +-- tests/fillGraph.html | 6 +-- tests/fractions.html | 6 +-- tests/grid_dot.html | 6 +-- tests/gviz-infinity.html | 6 +-- tests/gviz-selection.html | 6 +-- tests/gviz.html | 6 +-- tests/hairlines.html | 2 +- tests/highlighted-region.html | 6 +-- tests/hourly.html | 6 +-- tests/iframe.html | 2 +- tests/independent-series.html | 6 +-- tests/interaction.html | 6 +-- tests/is-zoomed.html | 6 +-- tests/isolated-points.html | 6 +-- tests/label-div.html | 6 +-- tests/labelsDateMilliseconds.html | 4 -- tests/labelsDateUTC.html | 6 +-- tests/labelsKMB.html | 6 +-- tests/layout-options.html | 6 +-- tests/legend-formatter.html | 2 +- tests/legend-values.html | 6 +-- tests/linear-regression-addseries.html | 6 +-- tests/linear-regression-fractions.html | 6 +-- tests/linear-regression.html | 6 +-- tests/link-interaction.html | 6 +-- tests/logscale.html | 6 +-- tests/missing-data.html | 6 +-- tests/multi-scale.html | 2 +- tests/native-format.html | 14 ++---- tests/negative.html | 6 +-- tests/no-range.html | 6 +-- tests/no-visibility.html | 6 +-- tests/number-format.html | 6 +-- tests/numeric-axis.html | 6 +-- tests/numeric-gviz.html | 6 +-- tests/out-of-order.html | 6 +-- tests/per-series.html | 38 +-------------- tests/perf.html | 6 +-- tests/plotter.html | 6 +-- tests/plotters.html | 2 +- tests/plugins.html | 2 +- tests/range-selector.html | 6 +-- tests/resize.html | 6 +-- tests/reverse-y-axis.html | 6 +-- tests/series-highlight.html | 6 +-- tests/small-range-zero.html | 6 +-- tests/smooth-plots.html | 2 +- tests/spacing.html | 6 +-- tests/stacked.html | 6 +-- tests/steps.html | 6 +-- tests/stock.html | 6 +-- tests/straw-broom.html | 2 +- tests/styled-chart-labels.html | 6 +-- tests/synchronize.html | 6 +-- tests/temperature-sf-ny.html | 6 +-- tests/two-axes-vr.html | 6 +-- tests/two-axes.html | 6 +-- tests/unboxed-spark.html | 6 +-- tests/underlay-callback.html | 6 +-- tests/value-axis-formatters.html | 6 +-- tests/visibility.html | 6 +-- tests/x-axis-formatter.html | 6 +-- tests/zero-series.html | 6 +-- tests/zoom.html | 6 +-- 126 files changed, 289 insertions(+), 878 deletions(-) delete mode 100644 bower.json delete mode 100644 gallery/avoid-min-zero.js delete mode 100644 gallery/edge-padding.js create mode 100644 index.es5.js create mode 100644 index.js delete mode 100644 tests/avoidMinZero.html diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index ee72da0..80d7cf2 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -7,13 +7,13 @@ It also helps if you include the non-compacted version of the JS on your page. For instance, instead of doing this: ```html - + ``` do this: ```html - + ``` This makes error messages and debugging simpler. The jsfiddle does this automatically. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 75d0c7a..3bbac04 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,13 +8,13 @@ It also helps if you include the non-compacted version of the JS on your page. For instance, instead of doing this: ```html - + ``` do this: ```html - + ``` This makes error messages and debugging simpler. The jsfiddle does this automatically. diff --git a/.gitignore b/.gitignore index 121cd66..e97dd19 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ env dist coverage *.log +*.pyc diff --git a/README.md b/README.md index 9abb9a1..8e639e5 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ Get help with dygraphs on ```html - + +
diff --git a/auto_tests/tests/formats.js b/auto_tests/tests/formats.js index f16cc6d..2548d99 100644 --- a/auto_tests/tests/formats.js +++ b/auto_tests/tests/formats.js @@ -77,6 +77,16 @@ it('testXValueParser', function() { assert.equal(6, g.getValue(3, 0)); }); +it('should throw on strings in native format', () => { + assert.throws(() => { + new Dygraph('graph', [['1', '10'], ['2', '20']]) + }, /expected number or date/i); + + assert.throws(() => { + new Dygraph('graph', [[new Date(), '10'], [new Date(), '20']]) + }, /expected number or array/i); +}); + var assertData = function(g) { var expected = dataArray; 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/bower.json b/bower.json deleted file mode 100644 index 6ebcc5c..0000000 --- a/bower.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "dygraphs", - "main": "dist/dygraph.js", - "ignore": [ - "Makefile", - "NOTES", - "auto_tests", - "common", - "data.js", - "docs", - "experimental", - "file-size-stats.sh", - "gadget.xml", - "gallery", - "generate-combined.sh", - "generate-documentation.py", - "generate-download.py", - "generate-jar.sh", - "generate-jsdoc.sh", - "gwt", - "jsTestDriver.conf", - "jsdoc-toolkit", - "lint.sh", - "node_modules", - "package.json", - "phantom-driver.js", - "phantom-perf.js", - "push-to-web.sh", - "release.sh", - "releases.json", - "screenshot.png", - "scripts", - "test.sh", - "tests", - "thumbnail.png" - ] -} diff --git a/docs/header.html b/docs/header.html index 870c84c..cc5881c 100644 --- a/docs/header.html +++ b/docs/header.html @@ -6,9 +6,10 @@ + - + - + @@ -33,14 +33,12 @@ - diff --git a/tests/annotation-native.html b/tests/annotation-native.html index 4e4538d..53ce249 100644 --- a/tests/annotation-native.html +++ b/tests/annotation-native.html @@ -1,7 +1,7 @@ - + Native format annotations diff --git a/tests/annotation.html b/tests/annotation.html index 002d4dd..c180070 100644 --- a/tests/annotation.html +++ b/tests/annotation.html @@ -1,15 +1,8 @@ - + demo - -