🌷 图加点击事件
const that = this
this.chart.on('click', function(param) {
If (that.propData.name === 'networkEquipment') {
if (param.dataType === 'node') {
that.$router.push({ path: 'uploadtuopu' })
} else {
console.log('点击了边' + param.value)
}
}
})
🌷echarts图行点击事件 防止触发多次调用。
this.chart.off(“click”); 重点代码 避免点击事件重复执行
this.chart.off("click"); // 重点代码 避免点击事件重复执行
this.chart.on("click", (param) => {
let val = "";
if (this.id == "business-visits") {
//业务
val = param.data.code;
this.$emit("pieSeclet1", val);
} else {
//服务器
val = param.name;
this.$emit("pieSeclet2", val);
}
});
🌷柱状图倒序排序
inverse: true,//倒叙
yAxis:{
type: 'category',
inverse: true,//倒叙
scale: false,
name: 'Model',
nameTextStyle: {
fontFamily: "Arial",
fontSize: 18
}
}
🌷echarts tooltips数据内容过多超出显示范围
tooltip: { // 提示框
trigger: 'axis',
confine: true // 限制tootip在容器内
}
🌷 轴文字超出省略
axisLabel: {
formatter: function (params) {
if (params.length > 10) {
return params.substring(0, 8) + "...";
} else {
return params;
}
},
textStyle: {
fontSize: 14,
color: "#fff",
fontWeight: 500,
},
rotate: 10,//旋转
interval: 2, //间隔
},