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

相关推荐
ZC跨境爬虫几秒前
3D 地球卫星轨道可视化平台开发 Day6(SEC数据接口扩展实现)
前端·microsoft·3d·html·json·交互
qq_12084093719 分钟前
Three.js 工程向:EffectComposer 后处理链路与色彩管理
开发语言·前端·javascript
|晴 天|10 分钟前
评论系统与情感分析
前端·ai·typescript
沉默中爆发的IT男16 分钟前
BGP基础配置实验总结
linux·服务器·前端
朝阳3918 分钟前
前端学习方法(含前端成神之路)
前端·学习方法
张元清27 分钟前
head.tsx 就是一个 React 组件:用 loader 数据动态生成 SEO meta
前端·javascript·面试
Hello--_--World28 分钟前
ES16:Set 集合方法增强、Promise.try、迭代器助手、JSON 模块导入 相关知识
开发语言·javascript·json
lemon_yyds32 分钟前
Element UI 实践踩坑- date-picker 组件 定制化type="daterange"
前端·css
Alice-YUE34 分钟前
ai对话平台中的functioncalling+mcp
前端·笔记·学习·语言模型
StockTV44 分钟前
韩国市场API技术对接指南,涵盖实时行情、历史数据、指数信息、公司详情等功能
java·开发语言·python·php