Skip to content

Commit

Permalink
re-add getFirstActiveXArray method in tooltip utils
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Dec 17, 2024
1 parent 7daf768 commit 6213f39
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/tooltip/Position.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ export default class Position {
cx = pointsArr[activeSeries][j][0]
cy = pointsArr[activeSeries][j][1]
}
if (isNaN(cx)) {
return
}

let points = ttCtx.tooltipUtil.getAllMarkers()

Expand Down
21 changes: 21 additions & 0 deletions src/modules/tooltip/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,27 @@ export default class Utils {
}
}

getFirstActiveXArray(Xarrays) {
const w = this.w
let activeIndex = 0

let firstActiveSeriesIndex = Xarrays.map((xarr, index) => {
return xarr.length > 0 ? index : -1
})

for (let a = 0; a < firstActiveSeriesIndex.length; a++) {
if (
firstActiveSeriesIndex[a] !== -1 &&
w.globals.collapsedSeriesIndices.indexOf(a) === -1 &&
w.globals.ancillaryCollapsedSeriesIndices.indexOf(a) === -1
) {
activeIndex = firstActiveSeriesIndex[a]
break
}
}
return activeIndex
}

closestInMultiArray(hoverX, hoverY, Xarrays, Yarrays) {
const w = this.w

Expand Down

0 comments on commit 6213f39

Please sign in to comment.