Skip to content

Commit 39c7e52

Browse files
committed
fix #3225; synced charts tooltip was not working in line and bar combo
1 parent 4318a3c commit 39c7e52

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/modules/tooltip/Intersect.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ class Intersect {
160160
opt,
161161
})
162162
i = barXY.i
163-
let barHeight = barXY.barHeight
164163
let j = barXY.j
165164

166165
w.globals.capturedSeriesIndex = i
@@ -277,14 +276,6 @@ class Intersect {
277276
i = parseInt(bar.parentNode.getAttribute('data:realIndex'), 10)
278277
}
279278

280-
// if (w.config.tooltip.shared) {
281-
// this check not needed at the moment
282-
// const yDivisor = w.globals.gridHeight / (w.globals.series.length)
283-
// const hoverY = ttCtx.clientY - ttCtx.seriesBound.top
284-
285-
// j = Math.ceil(hoverY / yDivisor)
286-
// }
287-
288279
const handleXForColumns = (x) => {
289280
if (w.globals.isXNumeric) {
290281
x = cx - bw / 2

src/modules/tooltip/Tooltip.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ export default class Tooltip {
432432

433433
seriesHoverByContext({ chartCtx, ttCtx, opt, e }) {
434434
let w = chartCtx.w
435-
const tooltipEl = this.getElTooltip()
435+
const tooltipEl = this.getElTooltip(chartCtx)
436436

437437
if (!tooltipEl) return
438438

@@ -515,6 +515,12 @@ export default class Tooltip {
515515
const tooltipEl = this.getElTooltip()
516516
const xcrosshairs = this.getElXCrosshairs()
517517

518+
let syncedCharts = []
519+
if (w.config.chart.group) {
520+
// we need to fallback to sticky tooltip in case charts are synced
521+
syncedCharts = this.ctx.getSyncedCharts()
522+
}
523+
518524
let isStickyTooltip =
519525
w.globals.xyCharts ||
520526
(w.config.chart.type === 'bar' &&
@@ -548,7 +554,10 @@ export default class Tooltip {
548554
this.ycrosshairs.classList.add('apexcharts-active')
549555
}
550556

551-
if (isStickyTooltip && !this.showOnIntersect) {
557+
if (
558+
(isStickyTooltip && !this.showOnIntersect) ||
559+
syncedCharts.length > 1
560+
) {
552561
this.handleStickyTooltip(e, clientX, clientY, opt)
553562
} else {
554563
if (

0 commit comments

Comments
 (0)