Commit 7879266f authored by Almouhannad Hafez's avatar Almouhannad Hafez

Fix hover effect in bars

parent 6a8379cd
......@@ -118,9 +118,8 @@ export class StackedBarChart extends Chart {
const index = this.activeKeys.indexOf(medalType);
if (index != -1)
this.activeKeys.splice(index, 1);
else {
else
this.activeKeys.push(medalType);
}
if (this.activeKeys.length === 0) this.activeKeys = keys; // Reset if none selected
this.updateVis();
......@@ -173,7 +172,9 @@ export class StackedBarChart extends Chart {
.style('top', (event.pageY - 60) + 'px');
// Highlight the hovered stack and less opacity for the others
allLayers.selectAll('rect').filter((di: any) => di !== d).style('opacity', 0.3);
vis.chart.selectAll('rect').filter((di: any) => di !== d).style('opacity', 0.3);
vis.legend.selectAll('rect')
.style('opacity', (_, index) => vis.getLegendItemOpacity(index));
})
.on('mousemove', function (event: any) {
vis.tooltip.style('left', (event.pageX - 20) + 'px')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment