Home forums Using CanvasJS CanvasJS – Get Current Time Range

This topic contains 4 replies, has 2 voices, and was last updated by  patricia.krupa 3 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14998

    Hallo,

    i need to write a chart that deals with a large number of datapoints collected on a device, more then a million after after a year. For that i am writing a dynamic fetching mechanismus that gets more detailed data after zooming. Is there a way to get the current start and end date of a rendered chart ? (The Values on X-Axis are Dates)

    I found the “intervalStartPosition”, which would be close to the “enddate”, far right axis point, however i dont see a value with contains the other end.

    Is there a way to access those informations ?

    Thank you very much

    #15000

    Suyash Singh
    Moderator

    @patricia-krupa,

    Please have a look at viewPortMinimum, viewPortMaximum, minimum, maximum.

    Also you can go through rangeChanged and rangeChanging events which are triggered after/before viewportMinimum or viewPortMaximum are updated while zooming, panning, or reset.
    ___
    Suyash Singh
    Team CanvasJS

    #15003

    However, those values are some Integers, how can i get the Date values ? Can i set somewhere the type to Date ?

    My options object looks like this:
    {
    zoomEnabled: true,
    title: {
    text: “Temperature History”
    },
    rangeChanged: null,
    data: [
    {
    type: “line”,
    showInLegend: true,
    name: “Temperature”,
    legendText: “Temperature”,
    lineThickness: 1,
    markerType: “circle”,
    //markerSize: 3,
    legendMarkerType: “circle”,
    dataPoints: [ ]
    },
    {
    type: “line”,
    legendText: “Temperature Set”,
    name: “TemperatureSet”,
    showInLegend: true,
    lineThickness: 1,
    markerType: “triangle”,
    //markerSize: 3,
    legendMarkerType: “triangle”,
    dataPoints: []
    }
    ]
    }

    #15007

    Suyash Singh
    Moderator

    @patricia-krupa,

    You can pass x-values as either timestamp or in valid date format to use date-time over axisX. Also to set the type of the axisX interval you can use intervalType.

    If this doesn’t solve your requirement, can you kindly create a jsfiddle so that we can look into it and help you out better.

    ___
    Suyash Singh
    Team CanvasJS

    #15008

    Setting intervalType to minute solved it! Thank you!

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

You must be logged in to reply to this topic.