Skip to content

Commit

Permalink
fix #3225; synced charts tooltip was not working in line and bar combo
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Aug 26, 2024
1 parent 4318a3c commit 39c7e52
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/modules/tooltip/Intersect.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class Intersect {
opt,
})
i = barXY.i
let barHeight = barXY.barHeight
let j = barXY.j

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

// if (w.config.tooltip.shared) {
// this check not needed at the moment
// const yDivisor = w.globals.gridHeight / (w.globals.series.length)
// const hoverY = ttCtx.clientY - ttCtx.seriesBound.top

// j = Math.ceil(hoverY / yDivisor)
// }

const handleXForColumns = (x) => {
if (w.globals.isXNumeric) {
x = cx - bw / 2
Expand Down
13 changes: 11 additions & 2 deletions src/modules/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ export default class Tooltip {

seriesHoverByContext({ chartCtx, ttCtx, opt, e }) {
let w = chartCtx.w
const tooltipEl = this.getElTooltip()
const tooltipEl = this.getElTooltip(chartCtx)

if (!tooltipEl) return

Expand Down Expand Up @@ -515,6 +515,12 @@ export default class Tooltip {
const tooltipEl = this.getElTooltip()
const xcrosshairs = this.getElXCrosshairs()

let syncedCharts = []
if (w.config.chart.group) {
// we need to fallback to sticky tooltip in case charts are synced
syncedCharts = this.ctx.getSyncedCharts()
}

let isStickyTooltip =
w.globals.xyCharts ||
(w.config.chart.type === 'bar' &&
Expand Down Expand Up @@ -548,7 +554,10 @@ export default class Tooltip {
this.ycrosshairs.classList.add('apexcharts-active')
}

if (isStickyTooltip && !this.showOnIntersect) {
if (
(isStickyTooltip && !this.showOnIntersect) ||
syncedCharts.length > 1
) {
this.handleStickyTooltip(e, clientX, clientY, opt)
} else {
if (
Expand Down

0 comments on commit 39c7e52

Please sign in to comment.