score:2

i checked in the internet and there is a simple hack to do this, why i use the hack is because if i set the y-axis to date, the graph does not get rendered and throws an error.

please find below the configuration used to achieve date y-axis.

var options = {
    scaleoverride: true,
    scalesteps: 8,
    scalestepwidth: 1800,
    scalestartvalue: 0,
    responsive: true,
    maintainaspectratio: false,
    scalelabel: function(valuepayload) {
        console.log(new date(valuepayload.value  * 1000).toisostring());
      return new date(valuepayload.value  * 1000).toisostring().substr(12, 7);
    },
    multitooltiptemplate: function(valuepayload) {
      return valuepayload.datasetlabel + " " + new date(valuepayload.value * 1000).toisostring().substr(12, 7)
    },
    title: {
        display: false,
        text: 'stat 1'
    }
  };
  var ctx = document.getelementbyid("canvas").getcontext("2d");
  window.myline = new chart(ctx).line(data, options);

the below issue on github contains nifty method to achieve time axis on y-axis.

github issue: here

the below fiddle contains the modified code, where the date y-axis is visible,

jsfiddle: here


Related Query

More Query from same tag