D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
martafuster
Full window
Github gist
Module 2: SVG and loading data EU Unemployment rate.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3 Mod2</title> <script src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> body { background-color: white; } svg { background-color: white; } </style> </head> <body> <script type="text/javascript"> //Load in contents of CSV file d3.csv("EU_Unemployment_Rate.csv", function(data) { //Now CSV contents have been transformed into //an array of JSON objects. //Log 'data' to the console, for verification. console.log(data); }); </script> <svg width="600" height="400"> <rect fill="#fff" stroke="#000" stroke-width="1.5" x="154.5" y="77" width="271" height="246" id="svg_1"/> <circle fill="#fff" stroke="#000" stroke-width="1.5" cx="289" cy="200" id="svg_6" r="95"/> <circle fill="#333333" stroke="#000" stroke-width="1.5" cx="289" cy="200" id="svg_2" r="87"/> <circle fill="orange" stroke="#000" stroke-width="1.5" cx="289" cy="200" id="svg_3" r="36"/> <circle fill="#000000" stroke="#333333" stroke-width="1.5" cx="289.00001" cy="200" id="svg_7" r="3.00343"/> <line x1="320.99998" y1="248" x2="398.66544" y2="110.66922" stroke="red" stroke-width="3" id="svg_5"/> <line x1="322.16551" y1="247.16749" x2="334.5794" y2="223.69095" stroke="red" stroke-width="8" id="svg_10"/> <rect fill="#fff" stroke="#000" stroke-width="1.5" x="562" y="452" width="315" height="38" id="svg_8"/> <circle fill="#000000" stroke="#333333" stroke-width="1.5" cx="174" cy="307" id="svg_9" r="3"/> <circle fill="#000000" stroke="#333333" stroke-width="1.5" cx="186" cy="307" id="svg_11" r="3"/> <circle fill="#000000" stroke="#333333" stroke-width="1.5" cx="197" cy="307" id="svg_12" r="3"/> <circle fill="#000000" stroke="#333333" stroke-width="1.5" cx="208" cy="307" id="svg_13" r="3"/> <text x="32" y="32" fill="charcoal" font-size="16" font-weight="bold" font-family="Arial">Playing with SVG, if you want to see more try looking in the console!</text> </svg> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js