Whoops! Fix the donut hover code.

This commit is contained in:
Olly Smith 2012-09-27 10:12:36 +01:00
parent 43019eeeaf
commit bd9f9d5580
3 changed files with 7 additions and 3 deletions

View File

@ -92,7 +92,7 @@ class Morris.Donut
# Select the segment at the given index. # Select the segment at the given index.
select: (idx) => select: (idx) =>
s.deselect() for s in @segments s.deselect() for s in @segments
segment = @segments[idx] if typeof idx is 'number' then segment = @segments[idx] else segment = idx
segment.select() segment.select()
@setLabels segment.data.label, @options.formatter(segment.data.value) @setLabels segment.data.label, @options.formatter(segment.data.value)

View File

@ -158,7 +158,11 @@
s = _ref[_i]; s = _ref[_i];
s.deselect(); s.deselect();
} }
if (typeof idx === 'number') {
segment = this.segments[idx]; segment = this.segments[idx];
} else {
segment = idx;
}
segment.select(); segment.select();
return this.setLabels(segment.data.label, this.options.formatter(segment.data.value)); return this.setLabels(segment.data.label, this.options.formatter(segment.data.value));
}; };

2
morris.min.js vendored

File diff suppressed because one or more lines are too long