We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart: get millisonds from JS Date with Datetime Axis in axisLabelRender event

Thread ID:





142694 Feb 15,2019 10:24 AM UTC Feb 20,2019 01:42 PM UTC Angular - EJ 2 1
Tags: Chart
Christophe Giordano
Asked On February 15, 2019 10:24 AM UTC

I'm configuring a Chart with a DateTime Axis by giving a JS Date in the datasource and I tried to configure the LabelFormat to get milliseconds from this Date but the value I get in the xisLabelRender event is without ms.
I tried:
could you tell me please what should I use to get milliseconds ?
thank you

Kalaimathi Chellaiah [Syncfusion]
Replied On February 20, 2019 01:42 PM UTC

Hi Christophe, 
Greetings from Syncfusion. 
We have analyzed your query. Currently, we don’t have support for milliseconds label format. In work around using axisLabelRender event, you can customize axis label. We have achieved this using the DateTimeCategory axis, but this is behave like category axis. Please find below sample and code snippet. 
Code Snippet: 
axis = (args: IAxisLabelRenderEventArgs) => { 
    if(args.axis.orientation === 'Horizontal') {   
       for(var i=0; i< args.axis.series.length; i++) 
         for(var j=0; j<args.axis.series[i].points.length; j++){ 
           if(args.axis.series[i].points[j].xValue === args.value){ 
               args.text = args.text + ':' + (new Date(+args.axis.series[i].points[j].x).getMilliseconds()).toString(); 
 Here we have shown the customized label format(hours:minutes:seconds:milliseconds), 
Hope this helps. 




This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon