Skip to content

Commit eac860a

Browse files
author
jacquesbach
committed
Change hover style for activeIndex
1 parent f57f8e1 commit eac860a

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

static/js/script.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,21 +1171,24 @@ async function loadForecast() {
11711171
}
11721172
},
11731173

1174-
onHover: (event, elements, chart) => {
1175-
if (elements.length) {
1176-
chart.setActiveElements([{
1177-
datasetIndex: 2,
1178-
index: elements[0].index
1179-
}]);
1180-
chart.update('none');
1181-
} else {
1182-
chart.setActiveElements([{
1183-
datasetIndex: 2,
1184-
index: appState.activeIndex
1185-
}]);
1186-
chart.update('none');
1187-
}
1188-
},
1174+
onHover: (event, elements, chart) => {
1175+
if (elements.length) {
1176+
const hoverIndex = elements[0].index;
1177+
if (hoverIndex !== appState.activeIndex) {
1178+
chart.setActiveElements([{
1179+
datasetIndex: 2,
1180+
index: hoverIndex
1181+
}]);
1182+
chart.update('none');
1183+
}
1184+
} else {
1185+
chart.setActiveElements([{
1186+
datasetIndex: 2,
1187+
index: appState.activeIndex
1188+
}]);
1189+
chart.update('none');
1190+
}
1191+
}
11891192
}
11901193
});
11911194

0 commit comments

Comments
 (0)