Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #103369
    salasidis
    Participant

    I see there is a format function on the axes.

     

    Is it possible to see an example somewhere of how this is implemented. I could output my dates as (modified from the area Range Line Demo)

     

    { Date: new Date(“2019/3/1 17:00”), Low: -5, High: 3 },
    { Date: new Date(“2019/3/1 18:00”), Low: 0, High: 1 },
    { Date: new Date(“2019/3/1 19:00”), Low: 0, High: 5 },
    { Date: new Date(“2019/3/1 20:00”), Low: -4, High: 4 },
    { Date: new Date(“2019/3/1 21:00”), Low: -7, High: -1 },
    { Date: new Date(“2019/3/1 22:00”), Low: -8, High: -3 },
    { Date: new Date(“2019/3/1 23:00”), Low: -9, High: -1 },

     

     

    however, in the standard format, the times are printed as 17.0.0 instead of 17:00 or 17:00:00.

     

    I could potentially use the same formatting tool for my other chart as well.

     

    Thanks

     

    #103380

    Hi,

    The format function accepts the value.  You can modify it as you want and then return it.

    Here is an example of formatting the date in the area Range Line Demo to hh:mm
    https://codepen.io/svetoslavb04/pen/oNqBRXe

    formatFunction: (value) => {
    
    const hours = value.getHours().toString().padStart(2, 0);
    
    const minutes = value.getMinutes().toString().padStart(2, 0);
    
    return hours + ':' + minutes;
    
    }

    Should you need any further assistance, please do not hesitate to contact us.

    Best Regards,
    Svetoslav Borislavov

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.