]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Prototype for hue() & default fillColor to use it.
authorChristopher Weiss <cmweiss@gmail.com>
Tue, 21 Oct 2014 01:49:41 +0000 (21:49 -0400)
committerChristopher Weiss <cmweiss@gmail.com>
Tue, 21 Oct 2014 01:49:41 +0000 (21:49 -0400)
src/Chart.Doughnut.js

index 35de93c7fd606ad844f0ffc9f1c436f29868b546..0dab405c8c3ccf73c450e387bb1ada0d011136e9 100644 (file)
 
        };
 
+       function hue(part, total) {
+               var h, s, v, c, x, m,
+                       r = '00',
+                       g = '00',
+                       b = '00';
+               
+               return '#' + r + g + b;
+       }
 
        Chart.Type.extend({
                //Passing in a name registers this chart in the Chart namespace
                                value : segment.value,
                                outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,
                                innerRadius : (this.options.animateScale) ? 0 : (this.outerRadius/100) * this.options.percentageInnerCutout,
-                               fillColor : segment.color,
+                               fillColor : segment.color || hue(index, this.segments.length),
                                highlightColor : segment.highlight || segment.color,
                                showStroke : this.options.segmentShowStroke,
                                strokeWidth : this.options.segmentStrokeWidth,
                defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
        });
 
-}).call(this);
\ No newline at end of file
+}).call(this);