1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script src="./lib/dojo/dojo.js" type="text/javascript" djConfig="isDebug: true, parseOnLoad: true">
</script>
<script type="text/javascript">
dojo.require('dojox.charting.Chart2D');
dojo.require('dojox.charting.widget.Chart2D');
dojo.require('dojox.charting.themes.Tom');
/* JSON information */
var json = {
January: [12999, 14487, 19803, 15965, 17290],
February: [14487, 12999, 15965, 17290, 19803],
March: [15965, 17290, 19803, 12999, 14487]
};
/* build pie chart data */
var chartData = [];
dojo.forEach(json['January'], function(item, i){
chartData.push({
x: i,
y: json['January'][i]
});
});
/* resources are ready... */
dojo.ready(function(){
var chart2 = new dojox.charting.Chart2D('chart2').setTheme(dojox.charting.themes.Tom).addPlot('default', {
type: 'Pie',
radius: 70,
fontColor: 'black'
}).addSeries('Visits', chartData).render();
var anim = new dojox.charting.action2d.MoveSlice(chart2, 'default');
chart2.render();
});
</script>
</head>
<body>
<div id="chart2" style="width:200px;height:200px;">
</div>
</body>
</html> |
Partager