D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
jsutch
Full window
Github gist
Seattle Business Data 2011
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>D3 with SVG Elements</title> <script type="text/javascript" src="https://d3js.org/d3.v3.js"></script> <style type="text/css"> body { background-color: #ddddff; } svg { background-color: white; } </style> </head> <body> <svg height="300" width="700"> <rect x="10" y="40" width="120" height="130" fill="green" /> <circle cx="375" cy="100" r="100" fill="red"></circle> <polygon points="220,10 300,195 170,250 123,234" style="fill:orange;stroke:purple;stroke-width:3" /> <text x="100" y="200" fill="charcoal" font-size="42" font-weight="bold" font-family="Times">Business Data</text> </svg> <script type="text/javascript"> // Your D3 code will go here //Load in contents of CSV file d3.csv("mydata.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); }); d3.select('circle') .transition().duration(5000).attr('fill', 'gray') d3.select('polygon') .transition().duration(200).attr('fill', 'red') .transition().duration(2200).attr('fill', 'purple') .each('end', function() { d3.select('text').text('Visualized').attr('fill', 'black')}); </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js