Home forums Using CanvasJS How are the viewport attributes formatted when the axis numbers are a time?

This topic contains 2 replies, has 2 voices, and was last updated by  ayy 4 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15702

    ayy
    Member

    I have a graph with the X axis values being a javascript Date object. These are formatted for each data point as “HH:mm:ss.fff” and on the axis it is displayed as “HH:mm”. I would like to zoom in and then use the new values of chart.axisX[0].get(“viewportMinimum”) and chart.axisX[0].get(“viewportMaximum”) for another feature in my app. These values are not the date objects and show values that look like this: “1483281267314.5”. I was wondering how date objects are formatted to get numbers like this so that I may format these numbers in reverse to get the time again.

    #15715

    Indranil Deo
    Member

    @ayy,

    You can use rangeChanging or rangeChanged event to get viewportMinimum and viewportMaximum after zooming / panning.
    And you can use formatDate() to modify the date as per your requirement.

    ————-
    Indranil Deo
    Team CanvasJS

    #15722

    ayy
    Member

    Thank you!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.