Rename strokeColor -> backgroundColor.

This commit is contained in:
Olly Smith 2013-01-24 15:38:49 -08:00
parent 2cce7c43de
commit d87c0ef8ae
4 changed files with 11 additions and 11 deletions

View File

@ -24,7 +24,7 @@ Morris.Donut({
{value: 10, label: 'baz'}, {value: 10, label: 'baz'},
{value: 5, label: 'A really really long label'} {value: 5, label: 'A really really long label'}
], ],
strokeColor: '#ccc', backgroundColor: '#ccc',
formatter: function (x) { return x + "%"} formatter: function (x) { return x + "%"}
}); });
</pre> </pre>

View File

@ -22,7 +22,7 @@ class Morris.Donut
'#052C48' '#052C48'
'#042135' '#042135'
], ],
strokeColor: '#FFFFFF', backgroundColor: '#FFFFFF',
formatter: Morris.commas formatter: Morris.commas
# Create and render a donut chart. # Create and render a donut chart.
@ -72,7 +72,7 @@ class Morris.Donut
@segments = [] @segments = []
for d in @data for d in @data
next = last + min + C * (d.value / total) next = last + min + C * (d.value / total)
seg = new Morris.DonutSegment(cx, cy, w*2, w, last, next, @options.colors[idx % @options.colors.length], @options.strokeColor, d) seg = new Morris.DonutSegment(cx, cy, w*2, w, last, next, @options.colors[idx % @options.colors.length], @options.backgroundColor, d)
seg.render @r seg.render @r
@segments.push seg @segments.push seg
seg.on 'hover', @select seg.on 'hover', @select
@ -115,7 +115,7 @@ class Morris.Donut
# #
# @private # @private
class Morris.DonutSegment extends Morris.EventEmitter class Morris.DonutSegment extends Morris.EventEmitter
constructor: (@cx, @cy, @inner, @outer, p0, p1, @color, @strokeColor, @data) -> constructor: (@cx, @cy, @inner, @outer, p0, p1, @color, @backgroundColor, @data) ->
@sin_p0 = Math.sin(p0) @sin_p0 = Math.sin(p0)
@cos_p0 = Math.cos(p0) @cos_p0 = Math.cos(p0)
@sin_p1 = Math.sin(p1) @sin_p1 = Math.sin(p1)
@ -151,7 +151,7 @@ class Morris.DonutSegment extends Morris.EventEmitter
render: (r) -> render: (r) ->
@arc = r.path(@hilight).attr(stroke: @color, 'stroke-width': 2, opacity: 0) @arc = r.path(@hilight).attr(stroke: @color, 'stroke-width': 2, opacity: 0)
@seg = r.path(@path) @seg = r.path(@path)
.attr(fill: @color, stroke: @strokeColor, 'stroke-width': 3) .attr(fill: @color, stroke: @backgroundColor, 'stroke-width': 3)
.hover(=> @fire('hover', @)) .hover(=> @fire('hover', @))
select: => select: =>

View File

@ -1304,7 +1304,7 @@
Donut.prototype.defaults = { Donut.prototype.defaults = {
colors: ['#0B62A4', '#3980B5', '#679DC6', '#95BBD7', '#B0CCE1', '#095791', '#095085', '#083E67', '#052C48', '#042135'], colors: ['#0B62A4', '#3980B5', '#679DC6', '#95BBD7', '#B0CCE1', '#095791', '#095085', '#083E67', '#052C48', '#042135'],
strokeColor: '#FFFFFF', backgroundColor: '#FFFFFF',
formatter: Morris.commas formatter: Morris.commas
}; };
@ -1351,7 +1351,7 @@
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
d = _ref1[_j]; d = _ref1[_j];
next = last + min + C * (d.value / total); next = last + min + C * (d.value / total);
seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.options.colors[idx % this.options.colors.length], this.options.strokeColor, d); seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.options.colors[idx % this.options.colors.length], this.options.backgroundColor, d);
seg.render(this.r); seg.render(this.r);
this.segments.push(seg); this.segments.push(seg);
seg.on('hover', this.select); seg.on('hover', this.select);
@ -1439,13 +1439,13 @@
__extends(DonutSegment, _super); __extends(DonutSegment, _super);
function DonutSegment(cx, cy, inner, outer, p0, p1, color, strokeColor, data) { function DonutSegment(cx, cy, inner, outer, p0, p1, color, backgroundColor, data) {
this.cx = cx; this.cx = cx;
this.cy = cy; this.cy = cy;
this.inner = inner; this.inner = inner;
this.outer = outer; this.outer = outer;
this.color = color; this.color = color;
this.strokeColor = strokeColor; this.backgroundColor = backgroundColor;
this.data = data; this.data = data;
this.deselect = __bind(this.deselect, this); this.deselect = __bind(this.deselect, this);
@ -1487,7 +1487,7 @@
}); });
return this.seg = r.path(this.path).attr({ return this.seg = r.path(this.path).attr({
fill: this.color, fill: this.color,
stroke: this.strokeColor, stroke: this.backgroundColor,
'stroke-width': 3 'stroke-width': 3
}).hover(function() { }).hover(function() {
return _this.fire('hover', _this); return _this.fire('hover', _this);

2
morris.min.js vendored

File diff suppressed because one or more lines are too long