var vm = new Vue({
el: "#index",
data(){
return {
isSet1:true,
myChartIndex:-1,
startCharts:null,
}
},
mounted() {
this.init();
},
methods: {
init() {
this.refresh();
},
refresh(){
this.receivingAlarmGet();
},
receivingAlarmGet(){
// let alarmdate =[];
// let alarmNum =[];
// get('alarm/alarmCount').then(res => {
// // console.log(res);
// res.forEach(function (item) {
// alarmdate.push(item.alarmdate)
// alarmNum.push(item.alarmNum)
// })
// this.receivingAlarm(alarmdate,alarmNum,res)
// })
let data = getWeekStartAndEnd(0,0);
let endTime = dataTimes(data[0])
let startTime = dataTimes(data[1])
let alarmdate=nextTime(startTime,endTime)
let alarmNum=[30, 28, 35, 23, 27, 32, 20]
let alarmNum1=[20, 26, 33, 20, 30, 26, 21]
let alarmNum2=[40, 63, 43, 33, 27, 22, 30]
let alarmNum3=[51, 66, 29, 40, 28, 35, 21]
this.$nextTick(()=>{
this.receivingAlarm(alarmdate,alarmNum,alarmNum1,'main')
this.receivingAlarm(alarmdate,alarmNum2,alarmNum3,'main1')
})
},
receivingAlarm(alarmdate,alarmNum,alarmNum1,name){
var myChart = echarts.init(document.getElementById(name));
var option = {
grid:{
left:'1%',
bottom:'5%',
top:'20%',
containLabel:true
// borderWidth:1,
},
tooltip: {
trigger: 'axis',
backgroundColor: 'rgba(26, 65, 136, 0.75)',
textStyle: {
color:"rgba(255, 255, 255, 1)", //设置文字颜色
}
},
xAxis: {
type: 'category',
boundaryGap: false,
name: '天',
show:true,
data:alarmdate,
lineStyle:{
//文字颜色
background: '#0C347C',
// color: 'rgba(235, 235, 235, 1)',
color: '#0C347C',
//字体风格,'normal','italic','oblique'
fontStyle:'normal',
//字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
font
echarts自动选中高亮
最新推荐文章于 2024-04-01 18:05:28 发布