这就是我覆盖tooltipContentEditorjqplot 函数的方式,效果很好。
highlighter: {
                    show: true,
                    showMarker:true,
                    showTooltip:true,
                    sizeAdjust: 10,
                    tooltipLocation: 'se',
                    tooltipAxes: 'xy',
                    yvalues: 1,
                    formatString:'<table class="jqplot-highlighter"><tr><td>date:</td><td>%s</td></tr><tr><td>PiecesPerHour:</td><td align="right">%s</td></tr></table>',
                    useAxesFormatters: true,
                    tooltipContentEditor: function(str, seriesIndex, pointIndex, plot){
                        var data = plot.series[seriesIndex].data[pointIndex];
                        var label = plot.legend.labels[seriesIndex].indexOf('Target')
                        var format = [];
                        //A little formatting to the data before I join it to the Html string
                        if (that.model.get('groupBy')==='month')
                            format[0] = new Date(data[0] + 1000*60*60*24).format('mmmm yyyy');
                        else
                            format[0] = new Date(data[0] ).format('mmmm dd, yyyy');
                        format[1] = new Number(data[1]).toFixed(1)
                        //join the data to the Html string:
                        str = $.jqplot.sprintf.apply($.jqplot.sprintf, [str].concat(format));
                        return str;
                    }
               }
基本上,您获取 Series 和 Point 数据并使用 sprintf 将其连接到 Html 字符串,然后返回该字符串。