Home forums Using CanvasJS Broken date/time

This topic contains 1 reply, has 2 voices, and was last updated by  Vishwas R 3 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26069

    Hello,

    I’m trying to use CanvasJS. At first, everything seemed easy but configuring date/time has been very difficult.

    For one thing, I apparently need to append “000” to Unix timestamps? Otherwise, they are wrong. Is that right?

    Second, the example I was looking at has the X-axis format under data. However, this doesn’t work:

                data: [{
                    type: "area",
                    xValueType: "dateTime",
                    xValueFormatString: "DDD HH:mm:ss",
    

    It only works when I have this:

    
                axisX: {
                    title: "Date/Time",
                    valueFormatString: "DDD HH:mm:ss"
    

    I am using the latest “canvasjs.min.js” but xValueFormatString does not seem to work at all, even when I copy one of the examples, directly.

    #26085

    @andenjs,

    For one thing, I apparently need to append “000” to Unix timestamps? Otherwise, they are wrong. Is that right?

    Unix Timestamp is the number of seconds that has elapsed since January 1, 1970 whereas JavaScript timestamp is the number of milliseconds that has elapsed since January 1, 1970. Multiplying unix timestamp by 1000 gives you JavaScript timestamp.

    Second, the example I was looking at has the X-axis format under data. However, this doesn’t work

    xValueFormatString is used to define the the format of x-value that appears in toolTip and indexLabel whereas valueFormatString is used to define the format of the value that appears in axis. Setting valueFormatString should work fine in your case.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.