You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-14Lines changed: 26 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# D3 Tutorial
2
2
3
-
This is a short tutorial introducing the basic elements and concepts of D3. D3 stands for Data-Driven Documents and is a very popular JavaScript library written by [Mike Bostock](http://bost.ocks.org/mike/).
3
+
This is a short tutorial introducing the basic elements and concepts of D3. D3 stands for Data-Driven Documents and is a very popular JavaScript library written by [Mike Bostock](https://bost.ocks.org/mike/).
4
4
5
5
Homepage: https://d3js.org/
6
6
@@ -21,7 +21,7 @@ Download / Include:
21
21
22
22
## Credits
23
23
24
-
This tutorial is based on the work of [Samuel Gratzl](https://github.com/sgratzl/d3tutorial), [Holger Stitz](https://github.com/thinkh/d3tutorial) and [Alexander Lex](https://dataviscourse.net/2016/tutorials/).
24
+
This tutorial is created and maintained by [Samuel Gratzl](https://github.com/sgratzl/d3tutorial), with contributions from [Holger Stitz](https://github.com/thinkh/d3tutorial), and based on a tutorial by[Alexander Lex](https://dataviscourse.net/2016/tutorials/).
25
25
26
26
---
27
27
@@ -56,8 +56,12 @@ Extras
56
56
-[More D3](#more-d3)
57
57
-[D3 Boilerplate](#boilerplate)
58
58
-[What Else Besides D3](#beside-d3)
59
+
60
+
Appendix
61
+
59
62
-[TypeScript and D3][#typescript]
60
63
64
+
61
65
> SURVEY: What do you guys already know?
62
66
63
67
---
@@ -66,7 +70,7 @@ Extras
66
70
67
71
# Development Environment
68
72
69
-
Using a good development environment can save you time and prevent you from pain. Editors like [Visual Studio Code](https://code.visualstudio.com), [Sublime](http://www.sublimetext.com/), or [Atom](https://atom.io) are a good start. Fully fledged integrated development environments such as [WebStorm](https://www.jetbrains.com/webstorm/) or [Eclipse](http://www.eclipse.org/webtools/) may be complex at a first glance but provide a bunch of useful features.
73
+
Using a good development environment can save you time and prevent you from pain. Editors like [Visual Studio Code](https://code.visualstudio.com), [Sublime](https://www.sublimetext.com/), or [Atom](https://atom.io) are a good start. Fully fledged integrated development environments such as [WebStorm](https://www.jetbrains.com/webstorm/) or [Eclipse](https://www.eclipse.org/webtools/) may be complex at a first glance but provide a bunch of useful features.
70
74
71
75
## Chrome Developer Tools
72
76
@@ -133,7 +137,7 @@ HTML elements can be nested:
133
137
The opening tag of an element can contain extra information as attributes:
134
138
135
139
```html
136
-
<ahref="http://www.google.com">A link to Google's main page</a>
140
+
<ahref="https://www.google.com">A link to Google's main page</a>
137
141
```
138
142
139
143
The `a` element (which stood for "anchor") describes a link. The attribute `href` means "HTML reference". The meaning given to each attribute changes from element to element.
@@ -187,7 +191,7 @@ Most important selectors explained in an example
187
191
188
192
```html
189
193
<!DOCTYPE html>
190
-
<html>
194
+
<htmllang="en">
191
195
<head>
192
196
<title>CSS Example</title>
193
197
<style>
@@ -438,7 +442,7 @@ The basic idea of D3 is binding data items to DOM elements and manipulate them a
438
442
439
443

440
444
441
-
For each of the cases we have to tell D3 what to do. e.g. when we have more data items than DOM elements, we are in the _enter_ phase and need to specify a way how to create the remaining ones. Similarly if we more DOM elements than data items we are in the _exit_ phase and need to take care of removing the superfluous ones.
445
+
For each of the cases we have to tell D3 what to do. e.g. when we have more data items than DOM elements, we are in the _enter_ phase and need to specify a way how to create the remaining ones. Similarly if we have more DOM elements than data items we are in the _exit_ phase and need to take care of removing the superfluous ones.
442
446
443
447
Basic workflow:
444
448
@@ -587,7 +591,7 @@ Adding a title attribute: [barchart02_title.html](examples/barchart02_title.html
587
591
588
592
In the current version we have static hard-coded data in our files. D3 provides a bunch of function for loading external files. The most important ones are `d3.json` for loading JSON files and `d3.csv` for CSV files respectively. Both return a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) that will resolve when the file has been loaded.
589
593
590
-
**Important: Data Loading is asynchronous**! That means you won't get the data immediately as a return value. But you get a Promise that will be resolved , as soon as the data are ready. You can't predict when this happens. You have to structure your code accordingly.
594
+
**Important: Data loading is asynchronous**! That means you won't get the data immediately as a return value. But you get a Promise that will be resolved , as soon as the data are ready. You can't predict when this happens. You have to structure your code accordingly.
591
595
592
596
```js
593
597
d3.json("file_to_load.json")
@@ -648,7 +652,7 @@ D3 provides different scales:
648
652
### Colors
649
653
650
654
With version 5 D3 extracted the color schemes to it on repository located at
651
-
https://github.com/d3/d3-scale-chromatic. Including both D3 standard schemes (e.g. `d3.schemeCategory10`) but also the ones from [ColorBrewer](http://colorbrewer2.org/) (e.g. `d3.schemeSet3`). These can be used as `range` for an ordinal scale.
655
+
https://github.com/d3/d3-scale-chromatic. Including both D3 standard schemes (e.g. `d3.schemeCategory10`) but also the ones from [ColorBrewer](https://colorbrewer2.org/) (e.g. `d3.schemeSet3`). These can be used as `range` for an ordinal scale.
@@ -825,7 +829,7 @@ Final results [barchart07_final.html](examples/barchart07_final.html) [ [![Open in CodePen]
990
994
991
995
D3 provides way more that has not been covered in this tutorial including:
[Vega](https://vega.github.io/vega/) is a visualization grammar, a declarative language for creating, saving, and sharing interactive visualization designs. With Vega, you can describe the visual appearance and interactive behavior of a visualization in a JSON format, and generate web-based views using Canvas or SVG.
1026
+
1027
+

1028
+
1019
1029
## Tableau
1020
1030
1021
1031
https://www.tableau.com/
@@ -1024,11 +1034,11 @@ The big player for commercial fat client data visualization.
1024
1034
1025
1035

1026
1036
1027
-
(c) http://www.marketwatch.ro
1037
+
(c) https://www.marketwatch.ro
1028
1038
1029
1039
## Processing
1030
1040
1031
-
https://processing.org/ and http://processingjs.org/ for a web-version
1041
+
https://processing.org/ and https://processingjs.org/ for a web-version
1032
1042
1033
1043
Own programming language for visualizations with OpenGL backend
1034
1044
@@ -1064,15 +1074,17 @@ free and commerical charting library.
1064
1074
1065
1075
## Frameworks on top of D3:
1066
1076
1067
-
- NVD3 (http://nvd3.org/) - reusable plots on top of D3
1077
+
- NVD3 (https://nvd3.org/) - reusable plots on top of D3
1068
1078
- Cubism (https://square.github.io/cubism/) - Time Series Data
1069
1079
- Vega (https://vega.github.io/vega/) - declarative description of plots
1070
1080
- Crossfilter (https://square.github.io/crossfilter/) - Fast Multidimensional Filtering for Coordinated Views
1071
1081
- ...
1072
1082
1073
1083
<aid="typescript"></a>
1074
1084
1075
-
# TypeScript and D3
1085
+
# Appendix
1086
+
1087
+
## TypeScript and D3
1076
1088
1077
1089
[TypeScript](https://www.typescriptlang.org/) is a programming language on top of JavaScript. Foremost it allows to specify types to variables and parameters similar to other typed langugages such as Java, C#, and so on. The TypeScript compiler compiles the TypeScript code to regular JavaScript code and also performs checks on it. Every JavaScript code is valid TypeScript code.
0 commit comments