Skip to content

Commit

Permalink
2.0.0 release fixes (#815)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danvk authored Dec 28, 2016
1 parent 627e054 commit fd6b8da
Show file tree
Hide file tree
Showing 126 changed files with 289 additions and 878 deletions.
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<script type="text/javascript" src="dygraph-combined.js"></script>
<script type="text/javascript" src="dygraph.min.js"></script>
```

do this:

```html
<script type="text/javascript" src="dygraph-combined.dev.js"></script>
<script type="text/javascript" src="dygraph.js"></script>
```

This makes error messages and debugging simpler. The jsfiddle does this automatically.
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<script type="text/javascript" src="dygraph-combined.js"></script>
<script type="text/javascript" src="dygraph.min.js"></script>
```

do this:

```html
<script type="text/javascript" src="dygraph-combined.dev.js"></script>
<script type="text/javascript" src="dygraph.js"></script>
```

This makes error messages and debugging simpler. The jsfiddle does this automatically.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ env
dist
coverage
*.log
*.pyc
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Get help with dygraphs on
```html
<html>
<head>
<script type="text/javascript" src="dygraph-combined.js"></script>
<script type="text/javascript" src="dygraph.js"></script>
<link rel="stylesheet" href="dygraph.css" />
</head>
<body>
<div id="graphdiv"></div>
Expand Down
10 changes: 10 additions & 0 deletions auto_tests/tests/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 0 additions & 4 deletions auto_tests/tests/pathological_cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ it('testCombinations', function() {

var variantOpts = {
none: {},
avoidMinZero: {
avoidMinZero: true,
includeZero: true
},
padded: {
includeZero: true,
drawAxesAtZero: true,
Expand Down
44 changes: 9 additions & 35 deletions auto_tests/tests/range_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.


/**
/**
* @fileoverview Test valueRange and dateWindow changes.
*
* @author konigsberg@google.com (Robert Konigsberg)
Expand All @@ -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() {
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));
});
Expand All @@ -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));
});
Expand All @@ -206,22 +206,22 @@ 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
},
B: {
axis: 'y2'
}
},
},
axes: {
'y2': { includeZero: true }
}
Expand All @@ -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,
Expand All @@ -252,15 +252,6 @@ it('testHugeRange', function() {
assert.closeTo(1, 1.1e230 / g.yAxisRange(0)[1], 0.001);
});

/**
* 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.
*/
Expand Down Expand Up @@ -345,23 +336,6 @@ it('testLogscalePad', function() {
[-10, 30], [5.623, 1778.279]);
});

/**
* 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.
*/
Expand Down
37 changes: 0 additions & 37 deletions bower.json

This file was deleted.

5 changes: 3 additions & 2 deletions docs/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="site.css">
<link rel="stylesheet" href="dygraph.css">

<script src="bootstrap.min.js"></script>
<script type="text/javascript" src="dygraph-combined.js"></script>
<script type="text/javascript" src="dygraph.min.js"></script>
</head>
<body>
<!--
Expand All @@ -28,7 +29,7 @@

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


<!-- Place everything within .navbar-collapse to hide it until above 768px -->
<div class="nav-collapse collapse navbar-responsive-collapse">

Expand Down
16 changes: 14 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h4>dygraphs is a fast, flexible open source JavaScript charting library.</h4>
<div id="demodiv"></div>
</div>
</div>


<script type="text/javascript">
g = new Dygraph(
Expand Down Expand Up @@ -61,6 +61,18 @@ <h3>Getting Started</h3>
<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>

<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>

<p>If you're using npm and a bundler like webpack, browserify or rollup, you can install dygraphs via:</p>

<pre>npm install --save dygraphs</pre>

and use it via:

<pre class="prettyprint">import Dygraph from 'dygraphs';
// or: const Dygraph = require('dygraphs');
const g = new Dygraph(div, data, {});</pre>

<p>Check out the <a href="https://github.com/danvk/dygraphs-es6">dygraphs ES6 sample project</a> for more details on this approach.</p>
</div>

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

</div>

<!--#include virtual="footer.html" -->
15 changes: 10 additions & 5 deletions docs/tutorial.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
}
</style>

<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>
<p>To use dygraphs, include the <code><a href="download.html">dygraph.js</a></code> JavaScript file
and <code>dygraph.css</code> CSS file. Then instantiate a <code>Dygraph</code> object.</p>

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

Expand All @@ -17,7 +18,8 @@ <h3 style="text-align:center">HTML</h3>
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;graphdiv&quot;&gt;&lt;/div&gt;
Expand Down Expand Up @@ -69,7 +71,8 @@ <h3 style="text-align:center">HTML</h3>
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;graphdiv2&quot;
Expand Down Expand Up @@ -120,7 +123,8 @@ <h3 style="text-align:center">HTML</h3>
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;dygraph-combined-dev.js&quot;&gt;&lt;/script&gt;
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;graphdiv3&quot;
Expand Down Expand Up @@ -170,7 +174,8 @@ <h3 style="text-align:center">HTML</h3>
&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;combined.js&quot;&gt;&lt;/script&gt;
src=&quot;dygraph.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; src=&quot;dygraph.css&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;graphdiv4&quot;
Expand Down
10 changes: 9 additions & 1 deletion docs/versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ <h2>Version History</h2>

<table class="versions">
<tr>
<td>1.1.1<p class="date">2015-06-01</p></td>
<td class="notes">
<ul>
<li>Set <code>this</code> to the dygraph in all callbacks.</li>
<li>Minor bug fixes.</li>
</ul>
</td>

<td>1.1.0<p class="date">2014-12-03</p></td>
<td class="notes">
Highlights include:
Expand All @@ -42,7 +50,7 @@ <h2>Version History</h2>
<li>"this" is set to the dygraph in all callbacks.
<li>dygraphs has shrunk, because we moved some stuff into "extras" (133kb→122kb)
</ul>

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.
</td>
</tr>
Expand Down
Loading

0 comments on commit fd6b8da

Please sign in to comment.