Home Forums Chart Support y Values as time

y Values as time

Viewing 2 posts - 1 through 2 (of 2 total)
  • #39404

    we have datavalues in minutes:
    Examples:
    120
    1,5
    60,25
    Now we want to know, if there is a possibilty to show this values in Indexlabel as timevalues?
    Examples:
    120 will be 02:00:00
    1,5 will be 00:01:30
    60,25 will be 01:15:00
    or can we convert this existing data so, that they will be shown as time in format HH:MM:SS
    thank you for your help

    #39405

    @gbienemannkahle-schule-de,

    You can use the indexLabelFormatter function to display custom index labels as per your requirement. Please take a look at the code-snippet given below.

    indexLabelFormatter: function(e) {
        var s = e.dataPoint.y % 1; s *= 60;
        var m = e.dataPoint.y % 60;
        var h = (e.dataPoint.y - m) / 60;
        return (h < 10 ? "0" : "") + h.toString() + ":" + (m < 10 ? "0" : "") + Math.trunc(m).toString() + ":" + (s < 10 ? "0" : "") + s.toString();
    },


    Thangaraj Raman
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.