]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Update the pie chart to use the default color/highlight if none is specified
authorDamian Silbergleith Cunniff <dcunniff@gmail.com>
Sat, 26 Dec 2015 16:13:33 +0000 (09:13 -0700)
committerDamian Silbergleith Cunniff <dcunniff@gmail.com>
Sat, 26 Dec 2015 16:41:31 +0000 (09:41 -0700)
src/Chart.Doughnut.js

index e63bf9e502dd124fc19aabf5b409e08e2b78ca0d..0073f9e8a7266555585e2930161599a87b875ae6 100644 (file)
                },
                addData : function(segment, atIndex, silent){
                        var index = atIndex !== undefined ? atIndex : this.segments.length;
+                       if ( typeof(segment.color) === "undefined" ) {
+                segment.color = Chart.defaults.global.segmentColorDefault[index];
+                segment.highlight = Chart.defaults.global.segmentHighlightColorDefaults[index];                                
+                       }
                        this.segments.splice(index, 0, new this.SegmentArc({
                                value : segment.value,
                                outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,