Created
August 12, 2018 11:17
-
-
Save bRIMOs/4e33bc48579a387cf9217a3b02b6ad51 to your computer and use it in GitHub Desktop.
Dojox pie chart SO gist
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Tutorial: Pie Chart!</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.13.0/dojo/dojo.js" ></script> | |
</head> | |
<body> | |
<script> | |
require([ | |
'dojo/dom', | |
'dojo/dom-construct', | |
'dojox/charting/Chart', | |
'dojox/charting/themes/Claro', | |
'dojox/charting/plot2d/Pie' | |
], function(dom, domConstruct, Chart, theme, PiePlot) { | |
chartData = [ | |
{ y: 389, text: "data1 " }, | |
{ y: 125, text: "data 2" }, | |
{ y: 285, text: "data 3" }, | |
{ y: 193, text: "data 4" }, | |
{ y: 21, text: "No data" } | |
]; | |
var pieChart = new Chart("chartNode"); | |
// Set the theme | |
pieChart.setTheme(theme); | |
// Add the only/default plot | |
pieChart.addPlot("default", { | |
type: PiePlot, // our plot2d/Pie module reference as type value | |
radius: 200, | |
fontColor: "black", | |
labelOffset: -20 | |
}); | |
// Add the series of data | |
pieChart.addSeries("January", chartData); | |
// Render the chart! | |
pieChart.render(); | |
}); | |
</script> | |
<div id="chartNode" style="width: 550px; height: 550px;"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment