Search code examples
datetimezingchart

Date-Time on x-axis of ZingChart


I want to plot date-time vs an integer. I tried Date(year,month,day,hours,minutes,seconds) but it is not supporting it. So is it possible to plot date-time on x-axis by using zingChart?


Solution

  • For displaying dates, you can use the transform attribute on your scale-x. It allows you to format your Unix timestamp however you want. Here's an example.

    "scale-x":{
      "transform":{
        "type":"date",
        "all":"%d %M, %h:%i %A"
      }
    }
    

    You can see the rendered chart here

    Here's a link to the docs on the ZingChart site for date-time transformation. I'm on the ZingChart team. Holler if you have more questions.