echarts 圖表設置默認選中

echarts:https://echarts.apache.org/zh/api.html#events.legendselected

tfjy1997:https://blog.csdn.net/wgf1997/article/details/124815817

數據圖形

設置高亮

this.myChart.dispatchAction({
    type: "highlight",
    //seriesIndex:number | array   系列 index,可以是一個數組指定多個系列
    seriesIndex: 0,
    //dataIndex:number 數據的 index
    dataIndex: 1
})

取消高亮

一般適用於設置默認高亮之後,點擊圖表之後,取消高亮

this.myChart.dispatchAction({
    type: "downplay",
    //seriesIndex:number | array   系列 index,可以是一個數組指定多個系列
    seriesIndex: 0,
    //dataIndex:number 數據的 index
    dataIndex: 1
})

 

圖例

默認選中圖例

dispatchAction({
    type: 'legendSelect',
    // 圖例名稱
    name: string
})

取消選中圖例

dispatchAction({
    type: 'legendUnSelect',
    // 圖例名稱
    name: string
})

切換圖例選中狀態

dispatchAction({
    type: 'legendToggleSelect',
    // 圖例名稱
    name: string
})

控制圖例的滾動

dispatchAction({
    type: 'legendScroll',
    scrollDataIndex: number,
    legendId: string
})

 

提示框 tip

顯示提示框

this.myChart.dispatchAction({
    type: "showTip",
    seriesIndex: 0,
    dataIndex: 1
})

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章