Echarts常见效果积累

1、

          tooltip: {
            trigger: "axis",
            backgroundColor: "rgba(255,255,255,0.1)",
            borderColor: "rgba(255,255,255,0.1)",
            axisPointer: {
              type: "shadow",
              label: {
                show: true,
                backgroundColor: "#7B7DDC",
              },
            },
            textStyle: {
              color: "white",
            },
          },

如果只想显示一个属性,注释掉trigger:"axis"即可

2、

        tooltip: {
          trigger: "axis",
          axisPointer: {
            lineStyle: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 0,
                y2: 1,
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(255,255,255,0)", // 0% 处的颜色
                  },
                  {
                    offset: 0.5,
                    color: "rgba(255,255,255,1)", // 100% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "rgba(255,255,255,0)", // 100% 处的颜色
                  },
                ],
                global: false, // 缺省为 false
              },
            },
          },
        },

调整图表内部间距

grid: {
          x: 30, //左侧间距
          y: 15, //顶部间距
          x2: 20, //右部间距
          y2: 25 //底部间距,
          containLabel: true//防止标签看不见。最好添上这一行
        }

工具盒

 toolbox: {
            //可视化的工具箱
            show: true,
            feature: {
              magicType: {
                //动态类型切换
                type: ['bar', 'line']
              }
            }
          },

最大值,平均值

series: [
            {
              markPoint: {
                data: [
                  {
                    type: 'max',
                    name: '最大值'
                  }
                ]
              },
              markLine: {
                // 平均值
                data: [
                  {
                    type: 'average',
                    name: '平均值'
                  }
                ]
              }
            }
          ],

x轴标签不覆盖

xAxis: [
            {
              axisLabel: {
                interval: 0,//标签间距
                hideOverlap: true//标签覆盖隐藏
              }
            }
          ],

防止tooltip超出显示范围-confine: true

        tooltip: {
          confine: true //防止tooltip超出显示范围
        },

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值