Created
June 4, 2017 13:50
-
-
Save abkunal/d07cf0cf4a0c19f745bee30f3d21b614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
body { | |
text-align: center; | |
} | |
</style> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://dimplejs.org/dist/dimple.v2.0.0.min.js"></script> | |
<script> | |
function Display(data) { | |
"use strict"; | |
var margin = 70, | |
width = 960 - margin, | |
height = 600 - margin; | |
d3.select("body") | |
.append("h1") | |
.text("Sales of US Food Giants (in $ Billions)"); | |
var svg = d3.select("body") | |
.append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.append("g") | |
.attr("class", "chart"); | |
var myChart = new dimple.chart(svg, data); | |
myChart.addCategoryAxis("x", "Brand"); | |
myChart.addMeasureAxis("y", "Sales"); | |
myChart.addSeries(null, dimple.plot.bar); | |
myChart.draw(); | |
} | |
</script> | |
<script>d3.tsv("food.tsv", Display)</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Brand | Sales | |
---|---|---|
McDonald's | 41 | |
Burger King | 11.3 | |
Wendy's | 9.4 | |
KFC | 8.2 | |
Pizza Hut | 8 | |
Starbucks | 4.1 | |
Taco Bell | 4.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment