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
stackviz

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

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