Built with blockbuilder.org
Last active
December 11, 2016 14:41
-
-
Save gordonwoodhull/027ab249c86a9370b25eeae5ef5ed2c1 to your computer and use it in GitHub Desktop.
fresh block
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
license: mit |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>Require js</title> | |
<!-- 1. Add these JavaScript inclusions in the head of your page --> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<link rel="stylesheet" href="required.css" /> | |
</head> | |
<body> | |
<!-- 3. Add the container --> | |
<div id="container" style="width: 800px; height: 400px; margin: 0 auto"></div> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.js"></script> | |
<script src='required.js' type='text/javascript'></script> | |
</body> | |
</html> |
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
require.config({ | |
paths: { | |
"crossfilter": "https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.5/crossfilter", | |
"d3": "https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.3/d3", | |
"dc": "https://cdnjs.cloudflare.com/ajax/libs/dc/2.1.0-dev/dc" | |
}, | |
shim:{ | |
'crossfilter':{ | |
exports:'crossfilter' | |
} | |
} | |
}); | |
data = [{ | |
"name":"anmol", | |
"age":"27", | |
"salary": "less" | |
}] | |
require(['crossfilter','d3','dc'], function(crossfilter, d3, dc){ | |
console.log(data); | |
$(document.body).append('<div id="funding-chart"></div>'); | |
var ndx = crossfilter(data); | |
var fundingStatus = ndx.dimension(function(d) { return d.funding_status; }); | |
var projectsByFundingStatus = fundingStatus.group(); | |
var hutu = fundingStatus.top(Infinity); | |
console.log(hutu); | |
var fundingStatusChart = dc.pieChart("#funding-chart"); | |
fundingStatusChart | |
.height(220) | |
//.width(350) | |
.radius(90) | |
.innerRadius(40) | |
.transitionDuration(1000) | |
.dimension(fundingStatus) | |
.group(projectsByFundingStatus); | |
dc.renderAll(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment