-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Peter Cook
committed
Nov 6, 2013
1 parent
186c3b7
commit f0b7cb6
Showing
4 changed files
with
217 additions
and
66 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Radial Bar Chart example</title> | ||
<style> | ||
|
||
#chart { | ||
font-family: "Helvetica Neue", Helvetica, sans-serif; | ||
font-size: 14px; | ||
} | ||
#chart path { | ||
fill: none; | ||
} | ||
|
||
/* layers */ | ||
#chart .layer-0 path { | ||
fill: steelblue; | ||
} | ||
#chart .layer-1 path { | ||
fill: white !important; | ||
opacity: 0.3; | ||
stroke-width: 2px; | ||
stroke: #999; | ||
} | ||
|
||
/* Outer circle, tick-circles and spokes */ | ||
#chart circle.outer { | ||
stroke: #aaa; | ||
stroke-dasharray: 4, 4; | ||
} | ||
#chart .tick-circles circle { | ||
stroke: #ddd; | ||
stroke-dasharray: 2, 2; | ||
} | ||
#chart .spokes line { | ||
stroke: #666; | ||
stroke-width: 0.2; | ||
} | ||
|
||
/* Axis */ | ||
#chart .axis text { | ||
font-size: 11px; | ||
} | ||
#chart .axis path { | ||
stroke: #999; | ||
shape-rendering: crispEdges; | ||
} | ||
#chart .axis line { | ||
stroke: #999; | ||
shape-rendering: crispEdges; | ||
} | ||
|
||
/* Labels */ | ||
#chart .labels text { | ||
fill: #333; | ||
font-size: 10px; | ||
font-weight: 500; | ||
} | ||
|
||
/* update button */ | ||
#update { | ||
width: 100px; | ||
height: 30px; | ||
cursor: pointer; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
<button type="button" id="update">Update</button> | ||
<div id="chart"></div> | ||
|
||
<script src="js/d3.v3.min.js"></script> | ||
<script src="js/radialBarChart.js"></script> | ||
<script> | ||
|
||
var data = null; | ||
var keys = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; | ||
|
||
function initData() { | ||
data = [{data: {}}]; | ||
for(var i=0; i<keys.length; i++) | ||
data[0].data[keys[i]] = Math.random() * 10; | ||
}; | ||
|
||
function update() { | ||
initData(); | ||
|
||
d3.select('#chart') | ||
.datum(data) | ||
.call(chart); | ||
} | ||
|
||
d3.select('#update') | ||
.on('click', update); | ||
|
||
var chart = radialBarChart() | ||
.barHeight(250) | ||
.reverseLayerOrder(true) | ||
.capitalizeLabels(true) | ||
.barColors(['#B66199', '#9392CB', '#76D9FA', '#BCE3AD', '#FFD28C', '#F2918B']) | ||
.domain([0,10]) | ||
.tickValues([1,2,3,4,5,6,7,8,9,10]) | ||
.tickCircleValues([1,2,3,4,5,6,7,8,9]); | ||
|
||
update(); | ||
|
||
</script> | ||
</body> | ||
</html> |