Skip to content

Commit

Permalink
Order colors in hover according to area chart
Browse files Browse the repository at this point in the history
See original problem here morrisjs#534
  • Loading branch information
Pierre Clavequin committed Dec 29, 2017
1 parent 59ee270 commit e40b651
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/morris.line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class Morris.Line extends Morris.Grid
row = @data[index]
content = $("<div class='morris-hover-row-label'>").text(row.label)
content = content.prop('outerHTML')
for y, j in row.y
for y, jj in row.y
j = row.y.length - 1 - jj
if @options.labels[j] is false
continue

Expand Down
7 changes: 4 additions & 3 deletions morris.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,13 +972,14 @@ Licensed under the BSD-2-Clause License.
};

Line.prototype.hoverContentForRow = function(index) {
var content, j, row, y, _i, _len, _ref;
var content, j, jj, row, y, _i, _len, _ref;
row = this.data[index];
content = $("<div class='morris-hover-row-label'>").text(row.label);
content = content.prop('outerHTML');
_ref = row.y;
for (j = _i = 0, _len = _ref.length; _i < _len; j = ++_i) {
y = _ref[j];
for (jj = _i = 0, _len = _ref.length; _i < _len; jj = ++_i) {
y = _ref[jj];
j = row.y.length - 1 - jj;
if (this.options.labels[j] === false) {
continue;
}
Expand Down
Loading

0 comments on commit e40b651

Please sign in to comment.