Home forums Using CanvasJS X Axis : display real system time

This topic contains 2 replies, has 2 voices, and was last updated by  dungeonlegend 3 years, 3 months ago.

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

    dungeonlegend
    Participant

    Is there anyway to display X Axis data points as system time, type hh:mm:ss. My data points is real-time, which mean dynamic chart, getting by 1 second, so I just want to find out it’s possible to display X Axis as system time or not. Please help me !

    • This topic was modified 3 years, 3 months ago by  dungeonlegend.
    #4876

    Sunil Urs
    Keymaster

    Yes, it is possible to show date & time on x axis. Just set the x value to current time just before adding it to the dataPoints array. Below is how it would look.

    chart.options.data[0].dataPoints.push({x: new Date(), y: 5});

    And set valueFormatString to “hh:mm:ss.


    Sunil Urs

    #4877

    dungeonlegend
    Participant

    Thank you so much for helping me out ! I’ll try to fix my code right now !

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

You must be logged in to reply to this topic.