Home Forums Chart Support How are the viewport attributes formatted when the axis numbers are a time?

How are the viewport attributes formatted when the axis numbers are a time?

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

    ayy

    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

    @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

    Thank you!

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

You must be logged in to reply to this topic.