Chart with DateTime Axis - how to show time in a specific TimeZone regardless of the browser's location

Hi,

I am using Chart component and the DateTime Axis. My requirement  is to display the chart, keeping the server provided timezone and time ("2023-01-03T16:00:00-08:00")

However, the chart component will automatically transform the date-time values to my browser's timezone. I could not find any attribute on the DateTime Axis that would allow me to specify a  time zone.


Thanks  



3 Replies

DG Durga Gopalakrishnan Syncfusion Team January 26, 2023 12:00 PM UTC

Hi Cosmin,


Greetings from Syncfusion.


We suggest you to use labelFormat property for datetime axis to display the date time values with hours, minutes, and seconds. You can customize the axis labels in required timezone using axisLabelRender event. Please check with the below sample and screenshot.


public axisLabelRender(args: IAxisLabelRenderEventArgs): void{

        if(args.axis.name == "primaryXAxis"){

           args.text = new Date(args.value).toISOString();

        }

    }



Sample : https://stackblitz.com/edit/angular-pzqujr


Kindly revert us if you have any other concerns.


Regards,

Durga Gopalakrishnan.



CB Cosmin Budac January 26, 2023 06:47 PM UTC

Thanks, this is a good suggestion



DG Durga Gopalakrishnan Syncfusion Team January 30, 2023 05:58 AM UTC

Most Welcome. Please get back to us if you need any further assistance. We are always happy in assisting you.


Loader.
Up arrow icon