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

相关推荐
OpenTiny社区5 分钟前
我用Vue 100%复制DeepSeek开源的网页App,代码更少,功能还更多!
前端·vue.js·github
乌暮7 分钟前
少写重复 CRUD:用大白话搞懂 MyBatis-Plus
java·开发语言·spring boot·面试·mybatis
MyBili14 分钟前
Chrome开发者工具入门:从看懂页面到高效调试
前端·chrome·谷歌浏览器·开发工具·chrome devtools·网页调式·网络请求分析
不绝19122 分钟前
Lua基础语法入门:注释、变量类型与字符串操作
开发语言·lua
云起SAAS24 分钟前
手机靓号选号商城H5源码 完整前后台可直接运行
前端·javascript·后端
code2cat37 分钟前
JavaScript编程篇之异步请求:切换到待办,为什么又显示了全部任务
前端·javascript
Hhy_11071 小时前
《C++深度解构07》手撕 vector —— 从底层三指针架构到迭代器失效彻底吃透
c语言·开发语言·c++·学习·visual studio
Moment1 小时前
RSI 是怎样让 AI 改进自己的 ❓❓❓
前端·后端·面试
风落青芜1 小时前
链式二叉树的实现与基本操作
c语言·开发语言·数据结构·算法
1-1=01 小时前
Vue 条件渲染和列表渲染
前端·javascript·vue.js