flover如何在悬停时显示x轴值而不是y轴

时间:2015-05-15 22:58:13

标签: javascript jquery flot

我正在研究flot,当我将鼠标悬停在一个点上时,我得到的标签包含y轴上的值。是否可以使用x轴值而不是y轴对应值?

这是我的选择:

           chartOptions = {
               xaxis: {
                   min:0
               },
               yaxis: {
                   ticks : 0
               },
               series: {
                   lines: {
                       show: false,
                       fill: false,
                       lineWidth: 3
                   },
                   points: {
                       show: true,
                       radius: 4,
                       fill: true,
                       lineWidth: 3
                   }
               },
               grid: {
                   hoverable: true,
                   clickable: false,
                   borderWidth: 0
               },
               legend: {
                   show: true, 
               },
               tooltip: true,
               tooltipOpts: {
                   content: '%s: %y'
               },

               colors: App.chartColors
           };

1 个答案:

答案 0 :(得分:3)

假设您正在使用jquery.flot.tooltip插件,这只是一个简单的选择:

/opt/idea-IU-141.1010.3/idea.sh

如果你想获得幻想,你可以提供一个回调函数并为你提供你想要的任何内容。