Search code examples
hovertooltipjqplotformat-stringjqplot-highlighter

jqplot format tooltip values


I want to have a tooltip hover highlight thingy in jqplot. The problem is that I want it to give more detail then on the axes. So the formatter should be different. I can't get it to display the seconds to:

There's a JS fidle here!

I want the timestamp to display as hours:minutes:seconds, which would be format string '%H:%M:%S' or '%T' or '%X'. But how do I do that?

    highlighter: {
        show: true,
        sizeAdjust: 3,
        //useAxesFormatters: false,
        //tooltipFormatString: '%H:%M:%S',
        formatString: '<table class="jqplot-highlighter"><tr><td>tijd:</td><td>%s</td></tr><tr><td>snelheid:</td><td>%s</td></tr></table>',
    },

Solution

  • This question is old, but I was looking for the same and there is an options (even in the version used here) to do it:

    http://jsfiddle.net/coma/DWFTb/151/

    highlighter: {
        show: true,
        sizeAdjust: 3,
        tooltipContentEditor: function(str, seriesIndex, pointIndex, jqPlot) {
    
            return series[seriesIndex][pointIndex][0];
    
        }
    }...
    

    I hope this help others.