簡體   English   中英

懸停時如何顯示x軸值而不是y軸

[英]flot how to show the x-axis values instead of y-axis when hover

我正在進行浮點運算,當我將鼠標懸停在某個點上時,得到的標簽包含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
           };

假設您正在使用jquery.flot.tooltip插件,這是一個簡單的選項:

tooltip: {
    // ...
    content: "%x"
}

如果您想花哨的話,可以提供一個回調函數並創建所需的小費內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM