Skip to content

Commit

Permalink
Fixed #8532, hover color was ignored in sankey.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbochan authored and TorsteinHonsi committed Jun 29, 2018
1 parent 31f9400 commit 1f559cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 6 additions & 3 deletions js/modules/sankey.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,22 +316,25 @@ seriesType('sankey', 'column', {
return columns;
},


/*= if (build.classic) { =*/
/**
* Return the presentational attributes.
*/
pointAttribs: function (point, state) {

var opacity = this.options.linkOpacity;
var opacity = this.options.linkOpacity,
color = point.color;

if (state) {
opacity = this.options.states[state].linkOpacity || opacity;
color = this.options.states[state].color || point.color;
}

return {
fill: point.isNode ?
point.color :
H.color(point.color).setOpacity(opacity).get()
color :
H.color(color).setOpacity(opacity).get()
};
},
/*= } =*/
Expand Down
15 changes: 14 additions & 1 deletion samples/unit-tests/series-sankey/sankey/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ QUnit.test('Sankey', function (assert) {
color: '#f7a35c'
}],
type: 'sankey',
name: 'Energy in the United States'
name: 'Energy in the United States',
states: {
hover: {
color: '#FF0000'
}
}
});

assert.strictEqual(
Expand All @@ -49,6 +54,14 @@ QUnit.test('Sankey', function (assert) {
'Series successfully added'
);

series.data[0].setState('hover');

assert.strictEqual(
series.data[0].graphic.element.getAttribute('fill'),
'rgb(255,0,0)',
'Hover color correct'
);

series.addPoint({
id: 'C-2',
from: 'C',
Expand Down

0 comments on commit 1f559cc

Please sign in to comment.