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
+32-28Lines changed: 32 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,7 +181,8 @@ Great way to spearate the style from the actual content. In addition, the select
181
181
182
182
Good overview of CSS Selectors: https://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048
183
183
184
-
Most important selectors explained in an example ([Open in CodePen](https://codepen.io/thinkh/pen/rybJVE)):
184
+
Most important selectors explained in an example
185
+
[![Open in CodePen][codepen]](https://codepen.io/thinkh/pen/rybJVE):
185
186
186
187
```html
187
188
<!DOCTYPE html>
@@ -309,7 +310,8 @@ JavaScript can be used with imperative/procedural, object-oriented, and function
309
310
310
311
It is a dynamically typed language, which can be strange for developers who mainly work with strongly typed languages such as C/C++ and Java.
311
312
312
-
**Note** To follow the examples below, you can open the Developer Tools’s JavaScript console on a browser window, and type the examples to see what they do. Or [open in CodePen](http://codepen.io/thinkh/pen/qrwxdb?editors=0012).
313
+
**Note** To follow the examples below, you can open the Developer Tools’s JavaScript console on a browser window, and type the examples to see what they do. Or
314
+
[![Open in CodePen][codepen]](https://codepen.io/thinkh/pen/qrwxdb).
[Open in CodePen](https://codepen.io/sgratzl/pen/POVKRj)
416
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/POVKRj)
415
417
416
418
The function come in different shapes: as setter (previous examples) as in a getter version. In the later case the value of the first element in the list will be returned. e.g. `circle.attr('cx')`
417
419
@@ -429,7 +431,7 @@ body
429
431
d3.select("svg").remove();
430
432
```
431
433
432
-
[Open in CodePen](https://codepen.io/sgratzl/pen/YEBxaW)
434
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/YEBxaW)
[Open in CodePen](https://codepen.io/sgratzl/pen/poozzga)
490
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/poozzga)
489
491
490
492
Common shortcut:
491
493
@@ -499,7 +501,7 @@ d3.select("svg")
499
501
.attr("cy", (d, i) => i *50);
500
502
```
501
503
502
-
[Open in CodePen](https://codepen.io/sgratzl/pen/oNNvvxv)
504
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/oNNvvxv)
503
505
504
506
Even shorter:
505
507
@@ -514,7 +516,7 @@ d3.select("svg")
514
516
.attr("cy", (d, i) => i *50);
515
517
```
516
518
517
-
[Open in CodePen](https://codepen.io/sgratzl/pen/GRRKKZq)
519
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/GRRKKZq)
518
520
519
521
**Notes**
520
522
@@ -526,15 +528,15 @@ d3.select("svg")
526
528
527
529
**INTERACTIVE**
528
530
529
-
Creating a bar chart: [barchart01_initial.html](examples/barchart01_initial.html)([Open in CodePen](https://codepen.io/sgratzl/pen/xRrrgp))
531
+
Creating a bar chart: [barchart01_initial.html](examples/barchart01_initial.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/xRrrgp)
530
532
531
533
---
532
534
533
535
### Nested Selections and Nested Data Joins
534
536
535
537
Nested selections can be used for adding inner elements. A common approach is creating one `g` element for each data item and add several sub DOM elements. The sub element will be created during the enter-phase and updated using `select`. By using `select` function the data-join remains using `selectAll` a nested data join will be created. Nested data joins are useful for hierarchical data.
536
538
537
-
Nested data join ([Open in CodePen](https://codepen.io/sgratzl/pen/yLLBBOj)):
539
+
Nested data join [![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/yLLBBOj):
538
540
539
541
```js
540
542
// hierarchical data
@@ -560,7 +562,7 @@ const circles = groups
560
562
circles.attr("r", d=> d *2).attr("cy", (d, i) => i *20);
561
563
```
562
564
563
-
Nested selection ([Open in CodePen](https://codepen.io/sgratzl/pen/VwwZZjY)):
565
+
Nested selection [![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/VwwZZjY):
Adding a title attribute: [barchart02_title.html](examples/barchart02_title.html)([Open in CodePen](https://codepen.io/sgratzl/pen/PooYYzb))
589
+
Adding a title attribute: [barchart02_title.html](examples/barchart02_title.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/PooYYzb)
588
590
589
591
---
590
592
@@ -626,7 +628,7 @@ See also: https://github.com/d3/d3-request/blob/master/README.md#csv for formatt
626
628
627
629
**INTERACTIVE**
628
630
629
-
Loading [weather.json](examples/weather.json): [barchart03_json.html](examples/barchart03_json.html)([Open in CodePen](https://codepen.io/sgratzl/pen/poozzbL))
631
+
Loading [weather.json](examples/weather.json): [barchart03_json.html](examples/barchart03_json.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/poozzbL)
630
632
631
633
---
632
634
@@ -709,13 +711,13 @@ const axis_container = d3
709
711
axis_container.call(axis);
710
712
```
711
713
712
-
[Open in CodePen](https://codepen.io/sgratzl/pen/zPedpX)
714
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/zPedpX)
713
715
714
716
---
715
717
716
718
**INTERACTIVE**
717
719
718
-
Adding linear and ordinal scale: [barchart04_scale.html](examples/barchart04_scale.html)([Open in CodePen](https://codepen.io/sgratzl/pen/oNNvvzv))
720
+
Adding linear and ordinal scale: [barchart04_scale.html](examples/barchart04_scale.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/oNNvvzv)
719
721
720
722
---
721
723
@@ -745,15 +747,15 @@ const circles = d3
745
747
);
746
748
```
747
749
748
-
[Open in CodePen](https://codepen.io/sgratzl/pen/zYYOOKe)
750
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/zYYOOKe)
749
751
750
752
Commonly used events: `click`, `mouseover/mouseout`, `mouseenter/mouseleave`, `change`, `input`
751
753
752
754
---
753
755
754
756
**INTERACTIVE**
755
757
756
-
Filter US cities: [barchart05_interactive.html](examples/barchart05_interactive.html)([Open in CodePen](https://codepen.io/sgratzl/pen/JjjPPRQ))
758
+
Filter US cities: [barchart05_interactive.html](examples/barchart05_interactive.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/JjjPPRQ)
757
759
758
760
---
759
761
@@ -788,7 +790,7 @@ circles
788
790
.attr("r", 20);
789
791
```
790
792
791
-
[Open in CodePen](https://codepen.io/sgratzl/pen/QWWLLGa)
793
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/QWWLLGa)
792
794
793
795
D3 is rather dumb when it comes to mapping data items to DOM elements. It doesn't take the order into account. So, if element 'a' was previously at the first position and now on the third it will bind it to the third element. However, this hampers animations, i.e. animated sorting. By using the _key_ argument of the `data` function, one can force that the same DOM element is bound to the same data item regardless of the item order.
794
796
@@ -832,21 +834,21 @@ setTimeout(() => {
832
834
}, 2000);
833
835
```
834
836
835
-
[Open in CodePen](https://codepen.io/sgratzl/pen/ExxYYNM)
837
+
[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/ExxYYNM)
836
838
837
839
---
838
840
839
841
**INTERACTIVE**
840
842
841
-
Animated filter: [barchart06_animation.html](examples/barchart06_animation.html)([Open in CodePen](https://codepen.io/sgratzl/pen/dyybbNP))
843
+
Animated filter: [barchart06_animation.html](examples/barchart06_animation.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/dyybbNP)
842
844
843
845
---
844
846
845
847
---
846
848
847
849
**INTERACTIVE**
848
850
849
-
Final results [barchart07_final.html](examples/barchart07_final.html)([Open in CodePen](https://codepen.io/sgratzl/pen/NWWKKda))
851
+
Final results [barchart07_final.html](examples/barchart07_final.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/NWWKKda)
850
852
851
853
---
852
854
@@ -919,7 +921,7 @@ Besides this functional approach an object oriented way is an valid alternative.
919
921
920
922
**INTERACTIVE**
921
923
922
-
MCV Inital Setup: [mcv01_initial.html](examples/mcv01_initial.html)([Open in CodePen](https://codepen.io/sgratzl/pen/bQzNBO))
924
+
MCV Inital Setup: [mcv01_initial.html](examples/mcv01_initial.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/bQzNBO)
923
925
924
926
---
925
927
@@ -937,7 +939,7 @@ A pie-layout is a simple layout algorithm. It takes the data and a way to sort/c
937
939
938
940
---
939
941
940
-
SEE: [pie.html](examples/pie.html)([Open in CodePen](https://codepen.io/sgratzl/pen/BaaBBdZ))
942
+
SEE: [pie.html](examples/pie.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/BaaBBdZ)
941
943
942
944
---
943
945
@@ -949,13 +951,13 @@ A force layout is a graph layout algorithm, which uses a simulation for position
949
951
950
952
---
951
953
952
-
SEE: [miserables.html](examples/miserables.html)([Open in CodePen](https://codepen.io/sgratzl/pen/poozzrK))
954
+
SEE: [miserables.html](examples/miserables.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/poozzrK)
953
955
954
956
---
955
957
956
958
**INTERACTIVE**
957
959
958
-
Pie chart layout: [mcv02_piechart.html](examples/mcv02_piechart.html)([Open in CodePen](https://codepen.io/sgratzl/pen/abbooyg))
960
+
Pie chart layout: [mcv02_piechart.html](examples/mcv02_piechart.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/abbooyg)
959
961
960
962
---
961
963
@@ -969,7 +971,7 @@ So far the visualizations doesn't influence each other and the user can only fil
969
971
970
972
**INTERACTIVE**
971
973
972
-
Interactive Visualizations: [mcv03_interaction.html](examples/mcv03_interaction.html)([Open in CodePen](https://codepen.io/sgratzl/pen/QWWLLqm))
974
+
Interactive Visualizations: [mcv03_interaction.html](examples/mcv03_interaction.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/QWWLLqm)
973
975
974
976
---
975
977
@@ -983,7 +985,7 @@ An advantage of our code structure is that we can use the factory methods to cre
983
985
984
986
**INTERACTIVE**
985
987
986
-
Reuse Visualizations: [mcv04_morevisses.html](examples/mcv04_morevisses.html)([Open in CodePen](https://codepen.io/sgratzl/pen/VVgYqx))
988
+
Reuse Visualizations: [mcv04_morevisses.html](examples/mcv04_morevisses.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/VVgYqx)
987
989
988
990
---
989
991
@@ -1005,15 +1007,15 @@ The biggest flexibility is to specify how attributes or styles should be tweened
1005
1007
1006
1008
**INTERACTIVE**
1007
1009
1008
-
Custom Transition: [mcv05_transitions.html](examples/mcv05_transitions.html)([Open in CodePen](https://codepen.io/sgratzl/pen/WNNeeXM))
1010
+
Custom Transition: [mcv05_transitions.html](examples/mcv05_transitions.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/WNNeeXM)
1009
1011
1010
1012
---
1011
1013
1012
1014
---
1013
1015
1014
1016
**INTERACTIVE**
1015
1017
1016
-
Final Outcome: [mcv06_final.html](examples/mcv06_final.html)([Open in CodePen](https://codepen.io/sgratzl/pen/yLLBBPx))
1018
+
Final Outcome: [mcv06_final.html](examples/mcv06_final.html)[![Open in CodePen][codepen]](https://codepen.io/sgratzl/pen/yLLBBPx)
1017
1019
1018
1020
---
1019
1021
@@ -1104,3 +1106,5 @@ free and commerical charting library.
0 commit comments