Created
January 31, 2014 16:08
-
-
Save mkurian/8735149 to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>dc.js - Bar Chart Example</title> | |
<meta charset="UTF-8"> | |
<link rel="stylesheet" type="text/css" href="../css/dc.css"/> | |
</head> | |
<body> | |
<div id="test"></div> | |
<script type="text/javascript" src="../js/d3.js"></script> | |
<script type="text/javascript" src="../js/crossfilter.js"></script> | |
<script type="text/javascript" src="../js/dc.js"></script> | |
<script type="text/javascript"> | |
var chart = dc.barChart("#test"); | |
d3.csv("morley.csv", function(error, experiments) { | |
experiments.forEach(function(x) { | |
x.Speed = +x.Speed; | |
}); | |
var ndx = crossfilter(experiments), | |
runDimension = ndx.dimension(function(d) {return +d.Run;}), | |
speedSumGroup = runDimension.group().reduceSum(function(d) {return d.Speed * d.Run / 1000;}); | |
chart | |
.width(768) | |
.height(480) | |
.x(d3.scale.linear().domain([6,20])) | |
.brushOn(false) | |
.yAxisLabel("This is the Y Axis!") | |
.dimension(runDimension) | |
.group(speedSumGroup); | |
chart.render(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment