Skip to content

Commit 20d03f8

Browse files
authored
Merge pull request #4373 from rosco54/Legend_add_highlight_yaxis_on_hover
Extension of the legend hover series highlighting to include the reference Y axis
2 parents b7293ca + 80e1d7e commit 20d03f8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/modules/Series.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,15 @@ export default class Series {
133133
if (!targetElement) targetElement = e.target
134134

135135
let allSeriesEls = w.globals.dom.baseEl.querySelectorAll(
136-
`.apexcharts-series, .apexcharts-datalabels`
136+
`.apexcharts-series, .apexcharts-datalabels, .apexcharts-yaxis`
137137
)
138138

139139
if (e.type === 'mousemove') {
140140
let seriesCnt = parseInt(targetElement.getAttribute('rel'), 10) - 1
141141

142142
let seriesEl = null
143143
let dataLabelEl = null
144+
let yaxisEl = null
144145
if (w.globals.axisCharts || w.config.chart.type === 'radialBar') {
145146
if (w.globals.axisCharts) {
146147
seriesEl = w.globals.dom.baseEl.querySelector(
@@ -149,6 +150,10 @@ export default class Series {
149150
dataLabelEl = w.globals.dom.baseEl.querySelector(
150151
`.apexcharts-datalabels[data\\:realIndex='${seriesCnt}']`
151152
)
153+
let yaxisIndex = w.globals.seriesYAxisReverseMap[seriesCnt]
154+
yaxisEl = w.globals.dom.baseEl.querySelector(
155+
`.apexcharts-yaxis[rel='${yaxisIndex}']`
156+
)
152157
} else {
153158
seriesEl = w.globals.dom.baseEl.querySelector(
154159
`.apexcharts-series[rel='${seriesCnt + 1}']`
@@ -173,6 +178,10 @@ export default class Series {
173178
if (dataLabelEl !== null) {
174179
dataLabelEl.classList.remove(this.legendInactiveClass)
175180
}
181+
182+
if (yaxisEl !== null) {
183+
yaxisEl.classList.remove(this.legendInactiveClass)
184+
}
176185
}
177186
} else if (e.type === 'mouseout') {
178187
for (let se = 0; se < allSeriesEls.length; se++) {

0 commit comments

Comments
 (0)