Skip to content

time2x returns wrong number when used indexBased #117

@Mohammad-Reza-Karimi

Description

@Mohammad-Reza-Karimi

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

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Make sure this is a NightVision issue and not a framework-specific issue.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions