formatted sunburst chart

This commit is contained in:
Austin Clark 2015-07-15 13:18:04 -06:00
parent 17864ee8b6
commit 0b03d53549
3 changed files with 63 additions and 57 deletions

View File

@ -5,27 +5,30 @@
{% block body %}
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">Latest Results</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<div class="row">
<div class="col-lg-12">
<div id="container" class="row">
<div class="col-lg-5">
<div id="sunburst" class="panel panel-default">
</div>
<div class="col-lg-12">
</div>
<div class="col-lg-5">
<div id="chart" class="panel panel-default">
<p>Jquery me baby</p>
<p>Right there</p>
<p>Oh yeah</p>
</div>
</div>
</div>
<script>
<script>
window.addEventListener('load', function() {
window.addEventListener('load', function() {
var width = 960,
height = 700,
var width = 700,
height = 500,
radius = Math.min(width, height) / 2;
var x = d3.scale.linear()
@ -36,7 +39,7 @@ window.addEventListener('load', function() {
var color = d3.scale.category20c();
var svg = d3.select("body").append("svg")
var svg = d3.select("#sunburst").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
@ -51,7 +54,7 @@ window.addEventListener('load', function() {
.innerRadius(function(d) { return Math.max(0, y(d.y)); })
.outerRadius(function(d) { return Math.max(0, y(d.y + d.dy)); });
d3.json("logs.json", function(error, root) {
d3.json("/static/logs.json", function(error, root) {
if (error) throw error;
var path = svg.selectAll("path")
@ -82,8 +85,10 @@ window.addEventListener('load', function() {
};
}
}, false);
</script>
}, false);
</script>
{% endblock %}

View File

@ -90,6 +90,7 @@
<!-- d3.js -->
<script src="{% static 'components/d3/d3.min.js' %}"></script>
</body>
</html>