echars里面想要标记x轴或y轴某个范围之内的数据,可以使用图表标域markArea

16 篇文章 0 订阅
6 篇文章 0 订阅

使用series里面的markArea对象即可,而markArea里面的data数据四个二维数组对象

代码如下:

            // 图表标域,常用于标记图表中某个范围的数据,例如标出某段时间投放了广告。
              markArea: {
                // 图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。
                silent: true ,
                //  显示标签,且标签位于区域内部
                label: {
                  show: true,
                  position: 'inside'
                },
                //  二维数组对象,可以理解成为从开始到结束的范围
                data: [ 
                    //    第一个范围
                    [{
                        name: '0130.108.473',
                        xAxis: currentDatetimeb+'00:02',
                        yAxis: 0.1,
                        itemStyle: {
                          color: '#a7f1df',
                        },
                        label:{
                          color:'white'
                        }
                    },
                    {
                        xAxis: currentDatetimeb+'11:55',
                        yAxis:0.9,
                    }],
                    //    第二个范围
                    [{
                        name: '0130.108.472',
                        xAxis: currentDatetimeb+'12:02',
                        yAxis: 0.1,
                        itemStyle: {
                          color: '#70f7d6',
                        },
                        label:{
                          color:'white'
                        }
                    },
                    {
                        xAxis: currentDatetimeb+'20:58',
                        yAxis: 0.9,
                    }], 
                    //    第三个范围
                    [{
                        name: '0130.108.474',
                        xAxis: currentDatetimeb+'21:00',
                        yAxis: 0.1,
                        itemStyle: {
                          color: '#2bf1c0',
                        },
                        label:{
                          color:'white'
                        }
                    }, 
                    {
                        xAxis: currentDatetimeb+'24:00',
                        yAxis: 0.9,
                    }]
                ]
              }

 每天都要收获一点点!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值