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

相关推荐
小短腿的代码世界5 分钟前
Qt文件系统与IO深度解析:从QFile到异步文件操作
开发语言·qt
harder3211 小时前
RMP模式的创新突破
开发语言·学习·ios·swift·策略模式
excel1 小时前
如何解决 Nuxt DevTools 中关于 unstorage 包的报错
前端
jinanwuhuaguo1 小时前
OpenClaw工程解剖——RAG、向量织构与“记忆宫殿”的索引拓扑学(第十三篇)
android·开发语言·人工智能·kotlin·拓扑学·openclaw
Rust研习社2 小时前
使用 Axum 构建高性能异步 Web 服务
开发语言·前端·网络·后端·http·rust
C澒2 小时前
AI 生码 - API2Code:接口智能匹配与 API 自动化生码全链路设计
前端·低代码·ai编程
浔川python社2 小时前
HTML头部元信息避坑指南技术文章大纲
前端·html
IT_陈寒2 小时前
SpringBoot配置加载顺序把我坑惨了
前端·人工智能·后端
kyriewen2 小时前
Next.js部署:从本地跑得欢,到线上飞得稳
前端·react.js·next.js
Moment2 小时前
面试官:给 llm 传递上下文,有哪几个身份 role ❓❓❓
前端·后端·面试