user502052 user502052 - 11 months ago 115
Javascript Question

How to customize the legend of a Morris graph?

I am using the morris.js library and I would like to customize my graphs so to properly format the date-time present in their legend. At this time, when I pass values as-like

(ISO8601) to the
then the generated legend content is the following:

The morris legend

I would like to generate the content of legend so to display the
in a user-friendly way, maybe something like
03:34:41 (2013-07-26)
just now
19 seconds ago

Is it possible? If so, how can I make that?


Use below function and change the body according to your need.

   hoverCallback: function (index, options, content) {
   var row =[index];
   //here row has x and y values