echarts配置记录,一些已经废弃的写法

1、normal,4.0以后无需将样式写在normal中了

改前:

改后:

复制代码
DEPRECATED: 'normal' hierarchy in labelLine has been removed since 4.0. All style properties are configured in labelLine directly now.
2、axisLabel中的文字样式无需使用textStyle包裹。

直接提到最外层即可

复制代码
textStyle hierarchy in axisLabel has been removed since 4.0. All textStyle properties are configured in axisLabel directly now
3、左右(上下)双柱状图的实现,如图所示

实现原理是将另一个维度的数据设置成负数,然后在展示的时候格式化一下,将悬浮和label中的展示效果都显示成绝对值模式。

前提是:两个维度的值都只有正值。

配置片段:

复制代码
option = {
 xAxis: [
    {
      type: 'value',
      axisTick: {
        show: false
      },
      axisLabel: {
        show: true,
        color: '#4E6FA1',
        formatter: function (data) {
          return Math.abs(data);
        }
      },
      max: null, //设置最大值,防止柱状图两侧范围差距过大
    }
  ],
    yAxis: [
      {
        type: 'category',
        axisTick: {
          show: false
        },
        axisLine: {
          show: true,
          lineStyle: {
            color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
              { offset: 0, color: '#fff' }, // 开始颜色
              { offset: 0.5, color: 'blue' }, // 结束颜色
              { offset: 1, color: '#fff' } // 开始颜色
            ])
          }
        },
        axisLabel: {
          color: '#4E6FA1'
        },
        data: []
      }
    ],
series: [
    {
      name: '等待中',
      type: 'bar',
      stack: '总量',
      barWidth: 12,
    },
    // {
    //   name: '生产中',
    //   type: 'bar',
    //   stack: '总量',
    //   barWidth: 12,
    //   data: [-120, -180, -120, -120, -132, -101, -134, -190, -230, -210]
    // }
  ]
}
4、饼图中间放置图片
复制代码
option={
    graphic: {
      elements: [
        {
          type: 'image',
          style: {
            image: logo,
            width: 50,
            height: 50
          },
          left: 'center',
          top: 'center'
        }
      ]
    },
}
特殊备注:一些echarts实例网站收集------

PPChart - 让图表更简单

echarts图表集

数据可视化技术分享-echarts热门组件 - Powered by Discuz!

G6和流程可视化 · 语雀

ECharts 作品集

特殊备注:动画效果网站收集------

Hamburgers by Jonathan Suh

Transition.css - easy transitions with clip-path

相关推荐
k4m7v2pz1 分钟前
用 rust-verb-shell 重写进程管理:从 game.sh 到 .rvs 的迁移实录
开发语言·后端·rust
2603_965896624 分钟前
JavaScript 对象零基础详解|属性、方法、遍历、增删改查
开发语言·javascript·ecmascript
dear_bi_MyOnly9 分钟前
数组字符串深度解析:从入门到卡牌实战
开发语言·c++·学习
天道kabuto13 分钟前
踩坑实录:JS Map迭代器为什么“用完即焚”?兼谈技术知识沉淀
前端
正在走向自律13 分钟前
从 Python 基础到大模型落地:读《深入浅出 Python 人工智能》,吃透 AI 工程化 CRUD 实战
开发语言·人工智能·python·机器学习·知识脉络
字节跳动开源16 分钟前
VisActor全新图可视化开源项目:VGraph
前端·设计模式·开源
打呵欠的猫18 分钟前
前端接口超时从 15s 改到动态值后,用户投诉降了 60%——AI 帮我分析出的方案
前端·ai编程
岁月宁静18 分钟前
二、《从零手撸 Agent》 — 聊聊 LLM 的失忆真相
前端·python·agent
郭邯26 分钟前
用纯前端实现一个代码压缩美化工具,我踩了这三个坑
前端
用户2832096793728 分钟前
从进程线程到 async/await:JS Event-loop事件循环机制底层解析
前端·javascript