Skip to content

Commit fd6b8da

Browse files
authored
2.0.0 release fixes (danvk#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
1 parent 627e054 commit fd6b8da

File tree

126 files changed

+289
-878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+289
-878
lines changed

.github/CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ It also helps if you include the non-compacted version of the JS on your
77
page. For instance, instead of doing this:
88

99
```html
10-
<script type="text/javascript" src="dygraph-combined.js"></script>
10+
<script type="text/javascript" src="dygraph.min.js"></script>
1111
```
1212

1313
do this:
1414

1515
```html
16-
<script type="text/javascript" src="dygraph-combined.dev.js"></script>
16+
<script type="text/javascript" src="dygraph.js"></script>
1717
```
1818

1919
This makes error messages and debugging simpler. The jsfiddle does this automatically.

.github/ISSUE_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ It also helps if you include the non-compacted version of the JS on your
88
page. For instance, instead of doing this:
99

1010
```html
11-
<script type="text/javascript" src="dygraph-combined.js"></script>
11+
<script type="text/javascript" src="dygraph.min.js"></script>
1212
```
1313

1414
do this:
1515

1616
```html
17-
<script type="text/javascript" src="dygraph-combined.dev.js"></script>
17+
<script type="text/javascript" src="dygraph.js"></script>
1818
```
1919

2020
This makes error messages and debugging simpler. The jsfiddle does this automatically.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ env
55
dist
66
coverage
77
*.log
8+
*.pyc

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Get help with dygraphs on
2424
```html
2525
<html>
2626
<head>
27-
<script type="text/javascript" src="dygraph-combined.js"></script>
27+
<script type="text/javascript" src="dygraph.js"></script>
28+
<link rel="stylesheet" href="dygraph.css" />
2829
</head>
2930
<body>
3031
<div id="graphdiv"></div>

auto_tests/tests/formats.js

+10
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ it('testXValueParser', function() {
7777
assert.equal(6, g.getValue(3, 0));
7878
});
7979

80+
it('should throw on strings in native format', () => {
81+
assert.throws(() => {
82+
new Dygraph('graph', [['1', '10'], ['2', '20']])
83+
}, /expected number or date/i);
84+
85+
assert.throws(() => {
86+
new Dygraph('graph', [[new Date(), '10'], [new Date(), '20']])
87+
}, /expected number or array/i);
88+
});
89+
8090
var assertData = function(g) {
8191
var expected = dataArray;
8292

auto_tests/tests/pathological_cases.js

-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,6 @@ it('testCombinations', function() {
7070

7171
var variantOpts = {
7272
none: {},
73-
avoidMinZero: {
74-
avoidMinZero: true,
75-
includeZero: true
76-
},
7773
padded: {
7874
includeZero: true,
7975
drawAxesAtZero: true,

auto_tests/tests/range_tests.js

+9-35
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// THE SOFTWARE.
2020

2121

22-
/**
22+
/**
2323
* @fileoverview Test valueRange and dateWindow changes.
2424
*
2525
* @author konigsberg@google.com (Robert Konigsberg)
@@ -43,7 +43,7 @@ var ZERO_TO_FIFTY_STEPS = (function() {
4343
}());
4444

4545
var FIVE_TO_ONE_THOUSAND = [
46-
[ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ],
46+
[ 1, 10 ], [ 2, 20 ], [ 3, 30 ], [ 4, 40 ] , [ 5, 50 ],
4747
[ 6, 60 ], [ 7, 70 ], [ 8, 80 ], [ 9, 90 ] , [ 10, 1000 ]];
4848

4949
describe("range-tests", function() {
@@ -106,7 +106,7 @@ it('testRangeSetOperations', function() {
106106
g.updateOptions({ });
107107
assert.deepEqual([12, 18], g.xAxisRange());
108108
assert.deepEqual([10, 40], g.yAxisRange(0));
109-
109+
110110
g.updateOptions({valueRange : null, axes: {y:{valueRange : [15, 20]}}});
111111
assert.deepEqual([12, 18], g.xAxisRange());
112112
assert.deepEqual([15, 20], g.yAxisRange(0));
@@ -182,7 +182,7 @@ it('testLogScaleExcludesZero', function() {
182182
labels: ['X', 'Y']
183183
});
184184
assert.deepEqual([10, 1099], g.yAxisRange(0));
185-
185+
186186
g.updateOptions({ logscale : false });
187187
assert.deepEqual([0, 1099], g.yAxisRange(0));
188188
});
@@ -196,7 +196,7 @@ it('testIncludeZeroIncludesZero', function() {
196196
labels: ['X', 'Y']
197197
});
198198
assert.deepEqual([0, 1100], g.yAxisRange(0));
199-
199+
200200
g.updateOptions({ includeZero : false });
201201
assert.deepEqual([450, 1050], g.yAxisRange(0));
202202
});
@@ -206,22 +206,22 @@ it('testIncludeZeroIncludesZero', function() {
206206
* Verify that includeZero range is properly specified per axis.
207207
*/
208208
it('testIncludeZeroPerAxis', function() {
209-
var g = new Dygraph("graph",
209+
var g = new Dygraph("graph",
210210
'X,A,B\n'+
211211
'0,50,50\n'+
212212
'50,110,110\n',
213213
{
214214
drawPoints: true,
215215
pointSize:5,
216-
series:{
216+
series:{
217217
A: {
218218
axis: 'y',
219219
pointSize: 10
220220
},
221221
B: {
222222
axis: 'y2'
223223
}
224-
},
224+
},
225225
axes: {
226226
'y2': { includeZero: true }
227227
}
@@ -242,7 +242,7 @@ it('testIncludeZeroPerAxis', function() {
242242

243243
/**
244244
* Verify that very large Y ranges don't break things.
245-
*/
245+
*/
246246
it('testHugeRange', function() {
247247
var g = new Dygraph("graph", [[0, -1e120], [1, 1e230]], {
248248
includeZero: true,
@@ -252,15 +252,6 @@ it('testHugeRange', function() {
252252
assert.closeTo(1, 1.1e230 / g.yAxisRange(0)[1], 0.001);
253253
});
254254

255-
/**
256-
* Verify old-style avoidMinZero option.
257-
*/
258-
it('testAvoidMinZero', function() {
259-
var g = createGraph({
260-
avoidMinZero: true,
261-
}, ZERO_TO_FIFTY_STEPS, [10, 20], [-5, 55]);
262-
});
263-
264255
/**
265256
* Verify ranges with user-specified padding, implicit avoidMinZero.
266257
*/
@@ -345,23 +336,6 @@ it('testLogscalePad', function() {
345336
[-10, 30], [5.623, 1778.279]);
346337
});
347338

348-
/**
349-
* Verify scrolling all-zero region, traditional.
350-
*/
351-
it('testZeroScroll', function() {
352-
var g = new Dygraph(
353-
document.getElementById("graph"),
354-
"X,Y\n" +
355-
"1,0\n" +
356-
"8,0\n" +
357-
"9,0.1\n",
358-
{
359-
drawAxesAtZero: true,
360-
animatedZooms: true,
361-
avoidMinZero: true
362-
});
363-
});
364-
365339
/**
366340
* Verify scrolling all-zero region, new-style.
367341
*/

bower.json

-37
This file was deleted.

docs/header.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
77
<link rel="stylesheet" href="bootstrap.min.css">
88
<link rel="stylesheet" href="site.css">
9+
<link rel="stylesheet" href="dygraph.css">
910

1011
<script src="bootstrap.min.js"></script>
11-
<script type="text/javascript" src="dygraph-combined.js"></script>
12+
<script type="text/javascript" src="dygraph.min.js"></script>
1213
</head>
1314
<body>
1415
<!--
@@ -28,7 +29,7 @@
2829

2930
<h1 class="navbar-brand"><a href="/">dygraphs</a></h1>
3031

31-
32+
3233
<!-- Place everything within .navbar-collapse to hide it until above 768px -->
3334
<div class="nav-collapse collapse navbar-responsive-collapse">
3435

docs/index.html

+14-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ <h4>dygraphs is a fast, flexible open source JavaScript charting library.</h4>
2626
<div id="demodiv"></div>
2727
</div>
2828
</div>
29-
29+
3030

3131
<script type="text/javascript">
3232
g = new Dygraph(
@@ -61,6 +61,18 @@ <h3>Getting Started</h3>
6161
<p>Start by <a href="download.html">downloading dygraphs</a>. Then read the <a href="tutorial.html">Tutorial</a> to learn how to use it, or just <a href="http://dygraphs.com/fiddle">play with dygraphs</a> on jsFiddle.</p>
6262

6363
<p>Once you've got your feet wet, look for inspiration in the <a href="gallery/">demo gallery</a> or check out our <a href="users.html">list of users</a>.</p>
64+
65+
<p>If you're using npm and a bundler like webpack, browserify or rollup, you can install dygraphs via:</p>
66+
67+
<pre>npm install --save dygraphs</pre>
68+
69+
and use it via:
70+
71+
<pre class="prettyprint">import Dygraph from 'dygraphs';
72+
// or: const Dygraph = require('dygraphs');
73+
const g = new Dygraph(div, data, {});</pre>
74+
75+
<p>Check out the <a href="https://github.com/danvk/dygraphs-es6">dygraphs ES6 sample project</a> for more details on this approach.</p>
6476
</div>
6577

6678
<div class="col-lg-4">
@@ -79,5 +91,5 @@ <h3>Quick Links</h3>
7991
</div>
8092

8193
</div>
82-
94+
8395
<!--#include virtual="footer.html" -->

docs/tutorial.html

+10-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
}
77
</style>
88

9-
<p>To use dygraphs, include the <code><a href="download.html">dygraph-combined-dev.js</a></code> JavaScript file and instantiate a <code>Dygraph</code> object.</p>
9+
<p>To use dygraphs, include the <code><a href="download.html">dygraph.js</a></code> JavaScript file
10+
and <code>dygraph.css</code> CSS file. Then instantiate a <code>Dygraph</code> object.</p>
1011

1112
<p>Here's a basic example to get things started:</p>
1213

@@ -17,7 +18,8 @@ <h3 style="text-align:center">HTML</h3>
1718
&lt;html&gt;
1819
&lt;head&gt;
1920
&lt;script type=&quot;text/javascript&quot;
20-
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
21+
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
22+
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
2123
&lt;/head&gt;
2224
&lt;body&gt;
2325
&lt;div id=&quot;graphdiv&quot;&gt;&lt;/div&gt;
@@ -69,7 +71,8 @@ <h3 style="text-align:center">HTML</h3>
6971
&lt;html&gt;
7072
&lt;head&gt;
7173
&lt;script type=&quot;text/javascript&quot;
72-
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
74+
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
75+
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
7376
&lt;/head&gt;
7477
&lt;body&gt;
7578
&lt;div id=&quot;graphdiv2&quot;
@@ -120,7 +123,8 @@ <h3 style="text-align:center">HTML</h3>
120123
&lt;html&gt;
121124
&lt;head&gt;
122125
&lt;script type=&quot;text/javascript&quot;
123-
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
126+
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
127+
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
124128
&lt;/head&gt;
125129
&lt;body&gt;
126130
&lt;div id=&quot;graphdiv3&quot;
@@ -170,7 +174,8 @@ <h3 style="text-align:center">HTML</h3>
170174
&lt;html&gt;
171175
&lt;head&gt;
172176
&lt;script type=&quot;text/javascript&quot;
173-
src=&quot;combined.js&quot;&gt;&lt;/script&gt;
177+
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
178+
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
174179
&lt;/head&gt;
175180
&lt;body&gt;
176181
&lt;div id=&quot;graphdiv4&quot;

docs/versions.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ <h2>Version History</h2>
2828

2929
<table class="versions">
3030
<tr>
31+
<td>1.1.1<p class="date">2015-06-01</p></td>
32+
<td class="notes">
33+
<ul>
34+
<li>Set <code>this</code> to the dygraph in all callbacks.</li>
35+
<li>Minor bug fixes.</li>
36+
</ul>
37+
</td>
38+
3139
<td>1.1.0<p class="date">2014-12-03</p></td>
3240
<td class="notes">
3341
Highlights include:
@@ -42,7 +50,7 @@ <h2>Version History</h2>
4250
<li>"this" is set to the dygraph in all callbacks.
4351
<li>dygraphs has shrunk, because we moved some stuff into "extras" (133kb→122kb)
4452
</ul>
45-
53+
4654
This will be the last major release to support browsers without a native &lt;canvas&gt; implementation. See <a href="http://blog.dygraphs.com/2014/12/dygraphs-110.html">blog post</a> for more details.
4755
</td>
4856
</tr>

0 commit comments

Comments
 (0)