echart折线图信息配置及点击事件

多条折线

## 图例信息配置
legend: {
        x:'right', //x轴的位置 left center 55
        y:'center', //y轴位置 top bottom 55
		data:['人数'] ,//显示的名称
		orient: 'horizontal',  //方向,横向和纵向
        icon: "rect", //图例样子 circle rect等
 },

整体位置设置

grid: {
        left: '25',
        right: '25',
        bottom: '24',
        top: '75',
        containLabel: true
    },

横纵坐标轴颜色设置

axisLine: {
   lineStyle: {
      type: 'solid',
      color: '#EEEEF1',//左边线的颜色
      width:'1'//坐标线的宽度
   }
}

坐标轴字体颜色及大小

axisLabel: {
      color: '#999',
      textStyle: {
          fontSize: 12
      },
  },

横纵坐标网格线

splitLine: {
   lineStyle: {
      color: "#EEEEF1"
   }
},

设置数据

//需要几条线就加几个数据
 series: [{
            name: '订单总笔数',
            type: 'line',
            smooth: true,
            data: [13,1,4,44,45,322,76]
        },
        {
            name: '钱包笔数',
            type: 'line',
            smooth: true,
            data: [13,54,34,344,35,53]
        },
        {
            name: '借呗笔数',
            type: 'line',
            smooth: true,
            data: [13,2,2,32,123,23,136]
        }
    ]

添加点击事件

//引入
import echarts from 'echarts'
//设置option
let option ={...}

let line = echarts.init(document.getElemnetById('id'))
line.on('click',(params)=>{
console.log(params)
})
line.setOption(option)

如果对您有用,请帮我点个赞,鼓励一下呗

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值