设置饼状图默认高亮 // 默认高亮 let myChartReflect = echarts.init(this.$refs.echatsReflectPerson) myChartReflect.setOption(optionReflect) let index = 0; // 高亮索引 myChartReflect.dispatchAction({ type: "highlight", seriesIndex: index, dataIndex: index }); myChartReflect.on("mouseover", function (e) { if (e.dataIndex != index) { myChartReflect.dispatchAction({ type: "downplay", seriesIndex: 0, dataIndex: index }); } }); myChartReflect.on("mouseout", function (e) { index = e.dataIndex; myChartReflect.dispatchAction({ type: "highlight", seriesIndex: 0, dataIndex: e.dataIndex }); }); 设置柱状图各个的颜色 series: [ { name: '直接访问', type: 'bar', barWidth: '30%', data: this.clueValues, itemStyle: { normal: { color: function (params) { var colorList = ['#F7B500', '#44D7B6', '#1CA6DC']; return colorList[params.dataIndex] } } } }, ]