ZingChart: How would I display the local time on my chart's x-axis and in the value boxes?

ZingChart supports Unix time in milliseconds. Although this may depend on the format you are using in the storage of your times, you should be able to generate new Date instances from your times, and then use the getTime() method on each of them to get the Unix time in milliseconds. Please take a look at this example, where I loop through an array of objects that each contain a date, create Date instances from them, and get the date in milliseconds since the epoch time.

Once you've done that, you'll want to add the "transform" object to "scale-x", set the "type" to "date", then use the "all" attribute to configure the format of the date. The tokens that can be used are found here.

You can set the timezone using the `timezone` option, which allows you to set a time offset that will be applied in your chart. For example, if you wanted to display the time in PST, you would set "utc": true, "timezone": -8, as seen in this updated version of the demo I previously sent.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us