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

 

posted @   时光凉忆  阅读(1347)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
点击右上角即可分享
微信分享提示