You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/04/21 15:42:26 UTC

[GitHub] [echarts] leomerel opened a new issue, #16930: [Bug] Tooltip formatter gives wrong values

leomerel opened a new issue, #16930:
URL: https://github.com/apache/echarts/issues/16930

   ### Version
   
   Appeared in v.5.2.0 and still is in latest version (v5.3.2)
   
   ### Link to Minimal Reproduction
   
   https://codepen.io/meredev/pen/OJzqwNg
   
   ### Steps to Reproduce
   
   1. Zoom on the chart with the mouse wheel (to see just a few of the points)
   2. Click somewhere on the chart -> a vertical dashed-line appears (at a given x) and the tooltip shows the right value (for that x)
   3. Pan to the left or the right -> the dashed-line is still where it's supposed to be (at the same x), but the tooltip doesn't show the right value (it shows the value for another x instead).  
     
   Here is a visualization of the steps to follow (click to expand) :
   ![Bug report](https://user-images.githubusercontent.com/41743205/164488315-13832067-48d5-47ac-90d9-f94c27b56ae8.png)
    
   
   ### Current Behavior
   
   The tooltip is not displaying the value it's supposed to (the one along the axisPointer). If you move the chart to a side (=pan), the axisPointer stays on the point (here x=13) BUT the tooltip doesn't display the value of this point. In the screenshot below, we see that it displays y=900 (which is the value of x=15) instead of showing y=377 (which is the value for x=13).    
     
   ![behavior](https://user-images.githubusercontent.com/41743205/164498226-2c316828-5984-400c-ada0-f81688574707.png)
   
   When looking to the `params` object of the formatter function (with console.log), we can clearly see that `axisValue` (which is good) doesn't fit with `value` or `name` ...  
     
   Formatter function `params` object :  
   
   ![Formatter params object](https://user-images.githubusercontent.com/41743205/164497914-3146d72a-7ca0-4b2b-b37e-d4010a823fb6.png)
   
   
   ### Expected Behavior
   
   It should display the value of the point that is on the axisPointer (the vertical dashed-line). If you move the chart to a side (=pan), the axisPointer stays on the point (that already works) BUT the tooltip should display the value of this point.  
   In the `params` object of the formatter function,  `axisValue` should be the same as `name`, and should fit with `data` and `dataIndex`.
   
   ### Environment
   
   ```markdown
   - OS:Windows 10
   - Browser: Chrome
   - Framework: Vue 2
   ```
   
   
   ### Any additional comments?
   
   This worked prior to v5.2.0 (I tried with v.5.0.1 and it worked as expected)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] jiawulin001 commented on issue #16930: [Bug] Tooltip formatter gives wrong values

Posted by GitBox <gi...@apache.org>.
jiawulin001 commented on issue #16930:
URL: https://github.com/apache/echarts/issues/16930#issuecomment-1107786045

   ### Problem locating
   The problem seems to be that when tooltip is only updated by `'click'` event, the value of `dataByCoordSys` here stays the same all the time.
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/tooltip/TooltipView.ts#L263-L272
   But after that it is treated as a **relative position** on axis. So when axis extent changes, the same relative position sits a totally **different value**. Here `cbParams` tries to get the value on a relative position `dataIndex` of the axis extent.
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/tooltip/TooltipView.ts#L565
   
   ### Solution
   Since the code of getting value of relative solution is a well-wrapped and widely used by all kinds of other chart. It would be better to play a trick here by preventing Echarts from updating tooltip unless item is clicked when `triggerOn` is set to `click`. 
   So my plan is to add a check at:
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/tooltip/TooltipView.ts#L270
   And return a `null` as `dataByCoordSys` so Echarts wouldn't update tooltip untill another click.
   However I also see a function that might be useful:
   https://github.com/apache/echarts/blob/3961cefc0329cfa8782602fc2aea46cc76c3f50e/src/component/tooltip/TooltipView.ts#L952
   But I am not sure what it is used for and can use some help here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[GitHub] [echarts] pissang closed issue #16930: [Bug] Tooltip formatter gives wrong values

Posted by GitBox <gi...@apache.org>.
pissang closed issue #16930: [Bug] Tooltip formatter gives wrong values
URL: https://github.com/apache/echarts/issues/16930


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org