Skip to content

Instantly share code, notes, and snippets.

@dimitardanailov
Created March 6, 2017 18:41
Show Gist options
  • Save dimitardanailov/af83d0c0c0ea1ac245f1e2567dd13497 to your computer and use it in GitHub Desktop.
Save dimitardanailov/af83d0c0c0ea1ac245f1e2567dd13497 to your computer and use it in GitHub Desktop.
Simple JSON reader with d3js
license: gpl-3.0

This is an example to demonstrate d3js JSON reader

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v3.min.js"></script>
<script>
d3.json('lines.json', function(data) {
console.log(data[0]);
});
</script>
[
{
"x1": 350,
"y1": 15,
"x2": 250,
"y2": 33
},
{
"x1": 420,
"y1": 420,
"x2": 250,
"y2": 333
},
{
"x1": 140,
"y1": 120,
"x2": 220,
"y2": 220
},
{
"x1": 180,
"y1": 55,
"x2": 330,
"y2": 320
},
{
"x1": 200,
"y1": 260,
"x2": 150,
"y2": 180
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment