jqplot tooltip on bar chart

后端 未结 3 1024
感情败类
感情败类 2020-12-08 16:03

I\'m using the jquery plugin jqplot for plotting some bar charts. on hover, I\'d like to display the tick for the bar and its value on a tooltip. I\'ve tried



        
3条回答
  •  眼角桃花
    2020-12-08 16:22

    I go through jqplot.highlighter.js and find an undocumented property: tooltipContentEditor. I use it to customize the tooltip to display x-axis label.

    Use something like this:

    highlighter:{
            show:true,
            tooltipContentEditor:tooltipContentEditor
        },
    
    function tooltipContentEditor(str, seriesIndex, pointIndex, plot) {
        // display series_label, x-axis_tick, y-axis value
        return plot.series[seriesIndex]["label"] + ", " + plot.data[seriesIndex][pointIndex];
    }
    

提交回复
热议问题