vue中使用echarts,插入一个饼状图,默认其中一个高亮显示,鼠标移入当前显示高亮,其它的淡出,鼠标移开,默认高亮
安装ecahrts
npm install ecahrts
引入使用ecahrts
import echarts from 'echarts'
Vue.prototype.$echarts = echarts
html
<div id="pieChart" style="width: 600px;height:400px;"></div>
js
export default {
data() {
return {
myChart:null
}
},
methods: {
drawChart() {
// 初始化echarts实例
let myChart = this.$echarts.init(document.getElementById("pieChart"));
// 造图表数据,直接在echarts官网复制过来的数据
let option = {
color:['#ff0000','#67c23a','#409eff','#f56c6c','#c