echarts提示框tooltip屬性

tooltip: {
    show: true,    // 是否顯示提示框組件
    trigger: 'axis',    // 觸發(fā)類型('item',數(shù)據(jù)項(xiàng)圖形觸發(fā),主要在散點(diǎn)圖,餅圖等無(wú)類目軸的圖表中使用;'axis',坐標(biāo)軸觸發(fā),主要在柱狀圖,折線圖等會(huì)使用類目軸的圖表中使用;'none',不觸發(fā)。)
    axisPointer: {
      type: 'cross',    // 指示器類型('line' 直線指示器;'shadow' 陰影指示器;'none' 無(wú)指示器;'cross' 十字準(zhǔn)星指示器。)
      snap: false,    // 坐標(biāo)軸指示器是否自動(dòng)吸附到點(diǎn)上。默認(rèn)自動(dòng)判斷。
      label: {
        margin: 10,    // label 距離軸的距離
        color: '#FFF',     // 文字的顏色
        fontStyle: 'normal',    // 文字字體的風(fēng)格('normal',無(wú)樣式;'italic',斜體;'oblique',傾斜字體) 
        fontWeight: 'normal',    // 文字字體的粗細(xì)('normal',無(wú)樣式;'bold',加粗;'bolder',加粗的基礎(chǔ)上再加粗;'lighter',變細(xì);數(shù)字定義粗細(xì)也可以,取值范圍100至700)
        fontSize: '20',    // 文字字體大小
        lineHeight: '50',    // 行高 
        padding = [5, 7, 5, 7],    // 內(nèi)邊距,單位px 
        backgroundColor = 'auto',    // 文本標(biāo)簽的背景顏色
      },
      animation: true,     // 是否開(kāi)啟動(dòng)畫
      animationDuration: 1000,     // 初始動(dòng)畫時(shí)長(zhǎng)
      animationDurationUpdate: 200,    // 數(shù)據(jù)更新動(dòng)畫的時(shí)長(zhǎng)
    }
    showContent: true,     // 是否顯示提示框浮層,默認(rèn)顯示
    alwaysShowContent: true,     // 是否永遠(yuǎn)顯示提示框內(nèi)容,默認(rèn)情況下在移出可觸發(fā)提示框區(qū)域后一定時(shí)間后隱藏
    triggerOn: 'mousemove|click',    // 提示框觸發(fā)的條件('mousemove',鼠標(biāo)移動(dòng)時(shí)觸發(fā);'click',鼠標(biāo)點(diǎn)擊時(shí)觸發(fā);'mousemove|click',同時(shí)鼠標(biāo)移動(dòng)和點(diǎn)擊時(shí)觸發(fā);'none',不在 'mousemove' 或 'click' 時(shí)觸發(fā))
    confine: true,    // 是否將 tooltip 框限制在圖表的區(qū)域內(nèi)
    backgroundColor: 'rgba(50,50,50,0.7)',    // 提示框浮層的背景顏色
    padding: 5,    // 提示框浮層內(nèi)邊距,單位px
    textStyle: {
        color: '#FFF',     // 文字的顏色
        fontStyle: 'normal',    // 文字字體的風(fēng)格('normal',無(wú)樣式;'italic',斜體;'oblique',傾斜字體) 
        fontWeight: 'normal',    // 文字字體的粗細(xì)('normal',無(wú)樣式;'bold',加粗;'bolder',加粗的基礎(chǔ)上再加粗;'lighter',變細(xì);數(shù)字定義粗細(xì)也可以,取值范圍100至700)
        fontSize: '20',    // 文字字體大小
        lineHeight: '50',    // 行高 
    },
    formatter: function (params) {
        var result = ''
        var dotHtml = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:30px;height:30px;background-color:#F1E67F"></span>'    // 定義第一個(gè)數(shù)據(jù)前的圓點(diǎn)顏色
        var dotHtml2 = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:30px;height:30px;background-color:#2BA8F1"></span>'    // 定義第二個(gè)數(shù)據(jù)前的圓點(diǎn)顏色
        result += params[0].axisValue + "</br>" + dotHtml + ' 數(shù)據(jù)名稱 ' + params[0].data + "</br>" + dotHtml2 + ' 數(shù)據(jù)名稱 ' + params[1].data;
        return result
    }
}
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容