var svg = d3.select('svg');
var nvd3Charts = function() {
var myColors = ["#06A705", "#F7A818", "#00BFDD", "#FF702A", "#DA3610",
"#80CDC2", "#A6D969", "#D9EF8B", "#FFFF99", "#F7EC37", "#F46D43",
"#E08215", "#D73026", "#A12235", "#8C510A", "#14514B", "#4D9220",
"#542688", "#4575B4", "#74ACD1", "#B8E1DE", "#FEE0B6", "#FDB863",
"#C51B7D", "#DE77AE", "#EDD3F2"
];
d3.scale.myColors = function() {
return d3.scale.ordinal().range(myColors);
};
startChart9 = function() {
//Donut chart
nv.addGraph(function() {
var chart = nv.models.pieChart().x(function(d) {
return d.label;
}).y(function(d) {
return d.value;
}).showLabels(true) //Display pie labels
.labelThreshold(.05) //Configure the minimum slice size for labels to show up
.labelType("percent") //Configure what type of data to show in the label. Can be "key", "value" or "percent"
.donut(true) //Turn on Donut mode. Makes pie chart look tasty!
.donutRatio(0.30) //Configure how big you want the donut hole size to be.
.color(d3.scale.myColors().range());
d3.select("#idDiv svg").datum(exampleData()).transition().duration(350).call(chart);
chart.pie.dispatch.on("elementClick", function(pie) {
alert(JSON.stringify(pie, '\n', ' '))
});
return chart;
});
//.on('click', function (i, row) {
// alert(row.label, row.value);
//Pie chart example data. Note how there is only a single array of key-value pairs.
function exampleData() {
return [{
"label": "Enviado",
"value": 56.456875654566
}, {
"label": "Pendente",
"value": 56.456875654566
}];
}
};
function...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.