D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
oneryandunn
Full window
Github gist
DWP Benefit Data
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Loading CSV Data with D3</title> <script src="https://d3js.org/d3.v3.js" > </script> <style type="text/css"> body { background-color: white; font-family: Helvetica, Arial, sans-serif; } svg { background-color: lightblue; } </style> </head> <body> <svg width="500" height="200"> <!-- cloud --> <circle cx="100" cy="75" r="30" fill="white" /> <circle cx="75" cy="75" r="20" fill="white" /> <circle cx="75" cy="82" r="19" fill="white" /> <circle cx="125" cy="70" r="18" fill="white" /> <circle cx="125" cy="85" r="18" fill="white" /> <circle cx="57" cy="75" r="11" fill="white" /> <circle cx="140" cy="82" r="13" fill="white" /> <circle cx="140" cy="75" r="13" fill="white" /> <circle cx="150" cy="75" r="7" fill="white" /> <!-- rainbow --> <circle cx="250" cy="175" r="100" fill="red" /> <circle cx="250" cy="175" r="90" fill="orange" /> <circle cx="250" cy="175" r="80" fill="yellow" /> <circle cx="250" cy="175" r="70" fill="green" /> <circle cx="250" cy="175" r="60" fill="blue" /> <circle cx="250" cy="175" r="50" fill="indigo" /> <circle cx="250" cy="175" r="40" fill="#7F00FF" /> <circle cx="250" cy="175" r="30" fill="lightblue" /> <!-- grass --> <rect x="0" y="175" width="500" height="25" fill="lightgreen"/> <!-- sun --> <circle cx="500" cy="0" r="50" fill="orange" /> <line x1="500" y1="0" x2="490" y2="170" stroke="orange" stroke-width="1" /> <line x1="500" y1="0" x2="345" y2="60" stroke="orange" stroke-width="1" /> <line x1="500" y1="0" x2="330" y2="10" stroke="orange" stroke-width="1" /> <line x1="500" y1="0" x2="385" y2="112" stroke="orange" stroke-width="1" /> <line x1="500" y1="0" x2="435" y2="150" stroke="orange" stroke-width="1" /> <!-- tree --> <rect x="420" y="135" width="15" height="50" fill="brown"/> <circle cx="425" cy="120" r="30" fill="green" /> <circle cx="405" cy="125" r="20" fill="green" /> <circle cx="405" cy="110" r="20" fill="green" /> <circle cx="445" cy="125" r="20" fill="green" /> <circle cx="445" cy="110" r="20" fill="green" /> <circle cx="425" cy="105" r="20" fill="green" /> <!-- text --> <text x="5" y="22" fill="darkgrey" font-size="24" font-family="Helvetica">see my data in the console</text> </svg> <script type="text/javascript"> //Load in contents of CSV fil //Now CSV contents have been transformed into //an array of JSON objects. //Log 'data' to the console, for verification. // console.log(data); d3.csv("DWPBenefitData.csv", function(data) { console.log(data); }); </script> </body> </html>
Modified
http://d3js.org/d3.v3.js
to a secure url
https://d3js.org/d3.v3.js