Echart常用属性

grid(图表位置)

grid: { // 图表位置
        left: '40px',
        right: '30px',
        top: '80px',
        bottom: '40px'
      },

tooltip(鼠标移入显示)

tooltip: {
          trigger: 'axis',
          formatter: '{b0}:00 <br /> {c0}ml',
          backgroundColor: "#071f50", //设置背景颜色
          textStyle: {
            color: "white" //设置文字颜色
          },
          borderColor: "#09548b", //设置边框颜色
        },

title(标题)

title: {
	text: '并发呼叫', // 主标题 
	textStyle: { // 标题样式
      color: '#000',
      fontSize: 15,
    },
    top: '20px',
    left: '20px'
},

legend

legend: {
  data: ['增长', '活跃'],
  top: '10px',
  right: '10px',
  icon: 'circle',
  itemHeight: 10, // 控制小圆点的大小
  orient: 'horizontal', // 排列方式 horizontal(水平) vertical(垂直) 
  textStyle: {
    color: '#C4E5FA', // 文字颜色
    fontSize: 14,
  },
  padding: 50, // 整体padding
  itemGap: 20 // 每项间距
},

yAxis(y轴)

yAxis: {
    show: false, // 显示隐藏 true false
    name: '信道',// 坐标轴名称
    interval: 2 / 5, // 强制设置坐标轴分割间隔
    splitNumber: 5, // 坐标轴的分割段数
    max: 2,
    boundaryGap: false // 不留白,从原点开始
    axisLine: { // 坐标轴
      lineStyle: { // 坐标轴样式
        color: '#ddd'
      }
    },
    axisLabel: {
      interval: 0, // 为了让轴上显示全
      rotate: 15, //显示全后重叠,调整角度
      textStyle: {
        color: 'rgba(0,0,0,.8)',  //更改坐标轴文字颜色
      }
    },
    splitLine: { // 网格线
      show: false, // 显示隐藏 ture false
      lineStyle: { // 网格线样式
         type: 'dashed' // solid dashed dotted
      }
    },
    axisTick: { // 刻度
       show: false // 控制刻度的显示与隐藏
    },
}

折线图

series: [{
   data: dataData,
   type: 'line',
   smooth: false, // 光滑曲线或折线
   symbol: 'circle', // 设定为实心点
   itemStyle: {
     normal: {
       color: '#DB586A', // 改变折线点的颜色
     },
   },
   lineStyle: {
     width: 1, // 折线粗细
     color: '#DB586A', // 折线颜色
   }
   areaStyle: { // 阴影区域
     opacity: 0.8,
     color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
       offset: 0,
       color: 'rgba(158, 175, 239, 0.5)'
     }, {
       offset: 1,
       color: 'rgba(158, 175, 239, 0.1)'
     }])
   },
 }]

柱状图

series: [{
  data: [4, 5, 2, 6, 4],
  type: 'bar',
  barWidth: 6,
  label: { // 在柱状条上显示数字
    show: true,
    position: 'insideTop'
  },
  itemStyle: {
    normal: {
      barBorderRadius: [0, 20, 20, 0], // 柱状图圆角
      color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // 柱状图渐变色
        offset: 0,
        color: 'rgba(69, 176, 255, 0.2)'
      }, {
        offset: 1,
        color: '#45B0FF'
      }]),
    }
  },
}]

环形图

title: { // 用title显示环中间固定的文字
   text: `隐患排查总量\n183处`, // \n 换行
   subtext: '预警总数', // 子标题
   textAlign: 'center', // 字体居中对齐
   top: 'center',
   left: 'center',
   textStyle: {
     color: '#fff',
     fontSize: 14,
     lineHeight: 20
   }
   subtextStyle: { // 子标题样式
   	 color: '#fff',
     fontSize: 14,
   }
},
series: [
          {
            type: 'pie',
            radius: ['45%', '70%'],
            center: ['30%', '50%'], // 环形图中心点
            label: {
              show: false, // 隐藏环形中间的文字
            },
            silent: 'ture', //图形是否不响应和触发鼠标事件,默认为 false,即响应和触发鼠标事件。
	        },
            data: [
              { value: 1048, name: '套餐一(38%)' },
              { value: 735, name: '套餐二(38%)' },
              { value: 580, name: '套餐三(38%)' },
              { value: 484, name: '套餐四(38%)' },
              { value: 300, name: '套餐五(38%)' }
            ]
          }
        ]
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值