Anthony-SMD opened a new issue, #21899:
URL: https://github.com/apache/echarts/issues/21899

   ### What problem does this feature solve?
   
   With `tooltip.trigger: 'axis'`, each mouse move calls 
`SeriesModel.indicesOfNearest` for each series.
   `indicesOfNearest` (src/model/Series.ts) scans all the data of the series 
and calls `axis.dataToCoord`
   for each point. Thus the time of each mouse move grows with the total number 
of points.
   
   Measured in a dashboard chart (ECharts 6.0.0, Chrome, time axis, ascending 
time values):
   
   | Series | Points in total | `indicesOfNearest` per mouse move | Mouse move 
in total |
   |---|---|---|---|
   | 44 | 56,760 | 3.1 ms | 11 to 12 ms |
   | 182 | 218,400 | about 57 ms | about 140 ms |
   
   ### What does the proposed API look like?
   
   No API change. When the values of the axis dimension are in ascending order 
(the usual case for time
   series), the nearest indices can only be in the runs of equal values on each 
side of the target value.
   A binary search finds them in O(log n). The order is checked once for each 
data store and dimension.
   When the values are not in ascending order (or contain NaN), the current 
full scan is used.
   
   The comparison of each candidate is the same code as now, so the result is 
the same, including the
   rule for a value in the middle of two points and the rule that all equal 
values are in the result.
   
   With this change, in the 44-series chart above, `indicesOfNearest` takes 0.1 
ms per mouse move
   (3.1 ms before), and a mouse move takes about 8 ms in total.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to