这个信息提示框只能展示1s,是由于频繁修改样式造成的,有没有什么方案能解决一下呢?不能够修改定时任务的步时
option选项
let option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
crossStyle: {
color: "#000",
},
},
// 图例
legend: {
data: ["人员"],
left: "center",
textStyle: {
color: "#fff",
},
},
grid: {
top: "20%",
left: "2%",
right: "5%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
axisLine: {
show: true,
lineStyle: {
color: "#5d606c",
},
},
axisTick: {
show: true,
},
axisLabel: {
formatter: function (value) {
return value.split(",")[0];
},
show: true,
textStyle: {
color: "#fff",
},
},
data: [],
},
yAxis: {
axisLine: {
lineStyle: {
color: "#fff",
},
},
splitLine: {
show: false,
},
type: "value",
},
color:{
type:'linear',
x:1,
y:1,
x2:0,
y2:0,
colorStops:[
{
offset:0,color:'rgba(0,84,170,1)'
},{
offset:0.5,color:'rgba(0,163,212,1)'
},{
offset:1,color:'rgba(0,243,255,0.5)'
}
]
},
dataZoom: [],
series: [
{
name: "人员",
type: "bar",
barGap: "10%",
barWidth: "40",
itemStyle: {
normal: {
// color: "#80E4FF",
barBorderRadius:9,
type:'linear',
x:1,
y:1,
x2:0,
y2:0,
colorStops:[
{
offset:0,color:'rgba(23,142,49,1)'
},{
offset:0.5,color:'rgba(138,193,117,1)'
},{
offset:1,color:'rgba(78,246,119,1)'
}
]
},
},
label: {
normal: {
show: true,
color: "white",
position: "inside",
formatter: "{c}个",
},
},
}
],
}
重新设置修改配置
this.afePeopleEchart = this.$echarts.init(
document.getElementById("afePeopleEchart")
);
var myChart = this.afePeopleEchart;
var count = 0;
this.timer2 = setInterval(function () {
if (count % 2 == 0) {
option.series = option.series.slice(0, 2);
myChart.setOption(option, true);
} else {
option.series.push({
type: "bar",
data: res.data.peoplevalues,
barWidth: 40,
barGap: "-100%",
itemStyle: {
normal: {
barBorderRadius:9,
type:'linear',
x:1,
y:0,
x2:0,
y2:0,
colorStops:[
{
offset:0,color:'rgba(255, 255, 255, 0.3)'
},{
offset:1,color:'rgba(255, 255, 255, 0)'
}
]
},
},
});
myChart.setOption(option, true);
}
count += 1;
}, 1000);