Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tooltip): Provide y position for tooltip position callback #3441

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

netil
Copy link
Member

@netil netil commented Sep 27, 2023

Issue

#3434

Details

Enhance providing y axis position value or function for tooltip.position callback argument

tooltip: {
     position: function(data, width, height, element, pos) {

         // pos: {
         //   x: Current mouse event x position,
         //   y: Current mouse event y position,
         //   xAxis: Current x Axis position (the value is given for axis based chart type only)
         //   yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
         // }

         // yAxis will work differently per data lenghts
         // - a) Single data: `yAxis` will return `number` value
         // - b) Multiple data: `yAxis` will return a function with property value

         // a) Single data:
         // Get y coordinate
         pos.yAxis; // y axis coordinate value of current data point

         // b) Multiple data:
         // Get y coordinate of value 500, where 'data1' scales(y or y2).
         // When 'data.axes' option is used, data can bound to different axes.
         // - when "data.axes={data1: 'y'}", wil return y value from y axis scale.
         // - when "data.axes={data1: 'y2'}", wil return y value from y2 axis scale.
         pos.yAxis(500, "data1"); // will return y coordinate value of data1

         pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
         pos.yAxis(500, null, "y2"); // get y coordinate with value of 500, using y2 axis scale

         return {
           top: 0,
           left: 0
         }
     }
}

@netil netil added the feature label Sep 27, 2023
@netil netil self-assigned this Sep 27, 2023
Enhance providing y axis position value or function for tooltip.position
callback argument

Ref naver#3434
@coveralls
Copy link

coveralls commented Sep 27, 2023

Coverage Status

coverage: 94.326% (-0.01%) from 94.337% when pulling dc472bf on netil:tooltipPos#3434 into 19a6e1c on naver:master.

@netil netil merged commit a793a2e into naver:master Sep 27, 2023
5 checks passed
@netil netil deleted the tooltipPos#3434 branch September 4, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants