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
})

 

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