project-nv / night-vision

Highly customizable charting library, created for professional traders
https://nightvision.dev
MIT License
242 stars 57 forks source link

time2x returns wrong number when used indexBased #117

Open Mohammad-Reza-Karimi opened 6 months ago

Mohammad-Reza-Karimi commented 6 months ago

Describe the bug

i set "indexBased": "true" and i use custom.navy as custom drawing on chart when i try this ==> "let x = layout.time2x(timestamp);" it returns very big number like this ==> 5608196711811 even if i set "indexBased": "false" still it returns wrong position ==> 5608197201458 when i remove "indexBased": "true" it returns correct x position ==>125776 but i need indexbased chart

Reproduction

https://codesandbox.io/s/playing-around-7-xyquxe?from-embed

Steps to reproduce

I've added "indexBased": "true" to data-1.json like below and it made the bug because of "let x = layout.time2x(p[0])" in custom.navy , line 30

{ "panes": [....], "indexBased": "true" }

Javascript Framework

no-framework (vanilla-js)

Logs

No response

Validations