Handle possibility of a undefined arc element in the doughnut chart

This commit is contained in:
Evert Timberg
2016-07-30 09:41:35 -04:00
parent 4279b202f4
commit 51518a7149

View File

@@ -46,7 +46,7 @@ module.exports = function(Chart) {
var meta = chart.getDatasetMeta(0);
var ds = data.datasets[0];
var arc = meta.data[i];
var custom = arc.custom || {};
var custom = arc && arc.custom || {};
var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;
var arcOpts = chart.options.elements.arc;
var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
@@ -253,6 +253,10 @@ module.exports = function(Chart) {
}
});
/*if (total === 0) {
total = NaN;
}*/
return total;
},