Skip to content

Instantly share code, notes, and snippets.

@tripp
Last active December 28, 2015 05:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripp/7453544 to your computer and use it in GitHub Desktop.
Save tripp/7453544 to your computer and use it in GitHub Desktop.
donutchart.js
var myDataValues = [
{day:"Monday", taxes:2000},
{day:"Tuesday", taxes:50},
{day:"Wednesday", taxes:4000},
{day:"Thursday", taxes:200},
{day:"Friday", taxes:2000}
],
getDonutChart = function(cfg)
{
var pieGraph = new Y.Chart(cfg),
graphic = pieGraph.get("graph").get("graphic"),
w = graphic.get("width"),
h = graphic.get("height"),
hole,
holeRadius = w/4;
hole = graphic.addShape({
type: "circle",
radius: holeRadius,
x: holeRadius,
y: holeRadius,
fill: {
color: "#fff"
},
stroke:{
weight: 0
}
});
graphic._redraw();
return pieGraph;
},
myDonutChart = getDonutChart({
type: "pie",
render: "#mychart",
categoryKey:"day",
seriesKeys:["taxes"],
dataProvider: myDataValues
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment