Echarts的rich使用方法。(附上很多好用的案例网址)

示例图:重点部分是副标题红色和黄色那边

代码:

显示文字通过'{a|有效浏览量:} {b|28%} {c|4%Increase}'写好,然后在api中找关于修改subtext样式的属性,这边是subtextStyle,在里面写上rich即可使用。

​
  var option = {
        title:{
          text:'示例图表',
          subtext:'{a|有效浏览量:} {b|28%} {c|4%Increase}',
            itemGap  : 0,
            left:40,
          textStyle:{
            color:'#fff',
            fontSize:15,
            height:20,
            lineHeight: 10,
          },
          subtextStyle:{
              rich:{
                  a:{

                      color:'red',
                      lineHeight: 0,
                  },
                  b:{
                      lineHeight: 0,
                      color:'red',
                      padding:[0,10,0,0]
                  },
                  c:{
                      padding:[0,5],
                      lineHeight: 0,
                      color:'green',
                      height:20,
                      backgroundColor : '#f81',
                      borderColor : 'green',
                      borderRadius: [5, 5, 5, 5],
                      textVerticalAlign:'top'
                  }
              }
          }

        },

        xAxis: {
          type: 'category',
          data: ['文章阅读量', '文章阅读量', '文章阅读量', '文章阅读量'],
            axisLabel:{
                  color:"#fff"
            }
        },
        yAxis:  {
            type: 'value',
            axisLabel: {
                show: true,
                interval: 'auto',

            },
            show: true
        }
,
        series: [
          {
            data: this.data,
            type: 'bar',
              //label自定义样式
              label: {
                  show: true, // 开启显示
                  rotate: 70, // 旋转70度
                  position: 'right', // 在上方显示
                  distance: 20, // 距离图形元素的距离。当 position 为字符描述值(如 'top'、'insideRight')时候有效。
                  verticalAlign: 'middle',
                  interval: 'auto',
                  formatter: function (i) {
                    console.log(i,'2')
                      },
                  textStyle: { // 数值样式
                      color: 'black',
                      fontSize: 12
                  }
              }

          }
        ]
      };

​

发现一个案例很多网址:本年商场顾客男女人数统计 - category-work,dataZoom区域缩放,grid直角坐标,legend,series-bar柱状图,series-line折线图,title标题,tooltip提示框 - makeapie echarts图表可视化案例

案例网址2:

echarts图表集 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值