Skip to content

Commit 656fd4b

Browse files
authored
Merge pull request square#20 from square/margolis/upgrade-to-d3-v4
Upgrade to d3 v4
2 parents 32ce189 + 14159e5 commit 656fd4b

16 files changed

+178
-169
lines changed

_includes/examples/axes.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
</head>
88
<body>
99
<script type="text/javascript"
10-
src="{{ "/javascripts/d3.v3.min.js" | prepend: site.baseurl }}"></script>
10+
src="{{ "/javascripts/d3.v4.min.js" | prepend: site.baseurl }}"></script>
1111
<script type="text/javascript">
1212
{% include examples/data.js %}
1313

14-
var x = d3.time.scale()
14+
var x = d3.scaleTime()
1515
.range([50, 250])
1616
.domain(d3.extent(data, function(d) { return new Date(d.date); }));
1717

_includes/examples/axes.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
var xAxis = d3.svg.axis()
2-
.scale(x) // x is the d3.time.scale()
3-
.orient('bottom') // the ticks go below the graph
4-
.ticks(4); // specify the number of ticks
1+
// x is the d3.scaleTime()
2+
var xAxis = d3.axisBottom(x)
3+
.ticks(4); // specify the number of ticks
54

65
var svg = d3.select('body')
76
.append('svg') // create an <svg> element

_includes/examples/dom-styled.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% include examples/dom.html %}
66

77
<script type="text/javascript"
8-
src="{{ "/javascripts/d3.v3.min.js" | prepend: site.baseurl }}"></script>
8+
src="{{ "/javascripts/d3.v4.min.js" | prepend: site.baseurl }}"></script>
99
<script type="text/javascript"
1010
src="{{ "/examples/dom.js" | prepend: site.baseurl }}"></script>
1111
</body>

_includes/examples/ex0.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
</style>
55
</head>
66
<body>
7-
<script src="../javascripts/d3.v3.min.js"></script>
7+
<script src="../javascripts/d3.v4.min.js"></script>
88
</body>
99
</html>

_includes/examples/ex1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
class="fancy" />
3232
</svg>
3333

34-
<script src="../javascripts/d3.v3.min.js"></script>
34+
<script src="../javascripts/d3.v4.min.js"></script>
3535
</body>
3636
</html>

_includes/examples/ex2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
</svg>
2626

2727

28-
<script src="../javascripts/d3.v3.min.js"></script>
28+
<script src="../javascripts/d3.v4.min.js"></script>
2929
</body>
3030
</html>

_includes/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="footer">
2-
&copy; 2014 Square, Inc.
2+
&copy; 2014 &ndash; {{ site.time | date: '%Y' }} Square, Inc.
33
</div>

_includes/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
<link rel="stylesheet" href="{{ "/css/syntax.css" | prepend: site.baseurl }}">
1111
<link rel="stylesheet" href="{{ "/css/graph.css" | prepend: site.baseurl }}">
1212

13-
<script type="text/javascript" src="{{ "/javascripts/d3.v3.min.js" | prepend: site.baseurl }}"></script>
13+
<script type="text/javascript" src="{{ "/javascripts/d3.v4.min.js" | prepend: site.baseurl }}"></script>
1414
</head>

index.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,30 @@ a tutorial — and worth sharing.
1212

1313
### Introduction
1414

15-
The tutorial provides a quick intro to [D3.js](http://d3js.org/), a Javascript
15+
The tutorial provides a quick intro to [d3.js](http://d3js.org/), a Javascript
1616
library for creating data visualizations in the browser. D3 is built on top of
1717
common web standards like HTML, CSS, and SVG.
1818

1919
D3 makes web-based visualizations easier by "automating the hard bits you already
2020
understand," as opposed to "hiding the hard
21-
bits" (hat tip [@andy_matuschak](https://twitter.com/andy_matuschak/status/365547794129358849)).
21+
bits" (hat tip [@andy_matuschak][tweet]).
2222

2323
Again, the tutorial is _not_ a deep dive — we want you to learn _how_ to learn
2424
D3 and gain a high-level understanding of this useful tool.
2525

26+
### Notes
27+
28+
The recent version of d3.js, v4, has some big breaks in the API from the
29+
previous version (see all the details of the [v3-to-v4 transition][v3-v4] in the
30+
D3 wiki). Since we expect this to be the future, and that people coming to learn
31+
d3 would want to be up to date from the beginning, we have updated this tutorial
32+
to work with the v4 version. We tagged the [v3 version][archive-v3] for
33+
posterity.
34+
2635
<a href="{{ "/web-standards/" | prepend: site.baseurl }}" class="giant-button">
2736
Let's get started!
2837
</a>
38+
39+
[tweet]: https://twitter.com/andy_matuschak/status/365547794129358849
40+
[v3-v4]: https://github.com/d3/d3/blob/master/CHANGES.md
41+
[archive-v3]: https://github.com/square/intro-to-d3/releases/tag/archive-v3

javascripts/d3.v3.min.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)