devexperts / dxcharts-lite

Flexible financial charts based on HTML5 canvas
https://devexperts.com/dxcharts/
Mozilla Public License 2.0
45 stars 8 forks source link

Second-to-last candle is hovered by default #125

Open kokovtsev opened 8 months ago

kokovtsev commented 8 months ago

Duplicates

Latest version

Describe the bug 😯

When the data is initially provided into the chart, I assume that the hover subject should emit the last candle in this dataset.

However, it actually emits the second to last one, or even the 4th-5th one. I guess the Y axis is somehow accounted for incorrectly in the X coordinate calculation.

In other words, the chart reports the initial hover as if the mouse pointer was at X = (xCenter of the last candle) - (Y axis width)

Link to minimal reproduction

https://codepen.io/dmkokovtsev/pen/rNoZJwG

Steps to Reproduce the Bug or Issue 🕹

  1. Wait for the data to appear
  2. Observe the timestamp in the #hover_info div

Expected behavior 🤔

The timestamp of the last candle

Platform

Windows, Chrome

Additional context 🔦

No response