echarts自动选中高亮

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值