Not Getting Position of X, Y for tooltip
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.4k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 1
Description
I want to integrate new tooltip format, but the issue is that i don't found x, y position value of current focus block.
## Following is the Screen shot of my tooltip issue

## Following is the code for position
``` javascript
position: function (data, width, height, element) {
console.log(document.getElementsByClassName('c3-tooltip-container'));
var chartOffsetX = document.querySelector('#chart' + chartId).getBoundingClientRect().left,
graphOffsetX = document.querySelector('#chart' + chartId + " g.c3-axis-y").getBoundingClientRect().right,
tooltipWidth = document.getElementById('tooltip').clientWidth,
tooltipHeight = document.getElementById('tooltip').clientHeight;
x = parseInt(element.getAttribute('cx')) + graphOffsetX - chartOffsetX - Math.floor(tooltipWidth / 2);
y = parseInt(element.getAttribute('cy')) - parseInt(tooltipHeight);
y = y - height - 14;
return {top: y, left: x}
}
```
Contributor guide
Research direction
Start with the tooltip position callback shown in the issue and inspect the data, width, height, and element arguments, along with the SVG element offsets it reads. Done means the position callback can obtain the focused block’s x and y values for the requested tooltip format.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3, javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100