Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Created August 11, 2017 16:13
Show Gist options
  • Save manashmandal/ea112efa58e5749f5be22b6ad653bc58 to your computer and use it in GitHub Desktop.
Save manashmandal/ea112efa58e5749f5be22b6ad653bc58 to your computer and use it in GitHub Desktop.
viz
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>D3plus 1.0 Example</title>
<!-- Adding D3 and D3plus Libraries -->
<script src="https://d3plus.org/js/d3.js"></script>
<script src="https://d3plus.org/js/d3plus.js"></script>
</head>
<body>
<div id="viz">
<!-- Visualization Will Be Added Here -->
</div>
</body>
<script>
// Dummy Dataset
var data = [
{"year": 1991, "name":"alpha", "value": 15},
{"year": 1991, "name":"beta", "value": 10},
{"year": 1991, "name":"gamma", "value": 5},
{"year": 1991, "name":"delta", "value": 50},
{"year": 1992, "name":"alpha", "value": 20},
{"year": 1992, "name":"beta", "value": 10},
{"year": 1992, "name":"gamma", "value": 10},
{"year": 1992, "name":"delta", "value": 43},
{"year": 1993, "name":"alpha", "value": 30},
{"year": 1993, "name":"beta", "value": 40},
{"year": 1993, "name":"gamma", "value": 20},
{"year": 1993, "name":"delta", "value": 17},
{"year": 1994, "name":"alpha", "value": 60},
{"year": 1994, "name":"beta", "value": 60},
{"year": 1994, "name":"gamma", "value": 25},
{"year": 1994, "name":"delta", "value": 32}
];
// Creating the Bar Plot
var visualization = d3plus.viz()
.container("#viz")
.data(data)
.type("bar")
.id("name")
.x("year")
.y("value")
.draw();
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment