当前位置: 首页 > news >正文

【Echarts】散点图 制作 气泡 类型图表

目录

  • 需求
  • 主要代码
  • 效果展示

需求

需参照设计图画出对应图表
在这里插入图片描述

主要代码

/**** 数据 ****/
this.dataList = [...Array(8).keys()].map((item) => {return {ywlxmc: '业务类型' + (item + 1),sl: item > 4 ? 50 : 70}
})/**** 气泡样式 ****/
const styleList = [{offset: [56, 48],color: ['#4691F6', '#A98BFF']},{offset: [35, 80],color: ['#4691F6', '#6EFFF6']},{offset: [20, 43],color: ['#A98BFF', '#FBA9ED']},{offset: [83, 30],color: ['#FF6B23', '#FF9D2A']},{offset: [36, 20],color: ['#16E2FF', '#3EFFB4']},{offset: [64, 10],color: ['#A98BFF', '#FBA9ED']},{offset: [75, 75],color: ['#FF482A', '#F2842B']},{offset: [88, 62],color: ['#4691F6', '#6EFFF6']}
]/**** 配置项 ****/
options = {title: {show: isArray && !this.dataList.length,text: '暂无数据',left: 'center',top: 'center',textStyle: {color: this[this.theme + 'EchartsNoDataColor']}},tooltip: {trigger: 'item',formatter: '{b}'},grid: {show: false,top: 10,bottom: 10},xAxis: [{gridIndex: 0,type: 'value',show: false,min: 0,max: 100,nameLocation: 'middle',nameGap: 5}],yAxis: [{gridIndex: 0,min: 0,show: false,max: 100,nameLocation: 'middle',nameGap: 30}],series: [{type: 'scatter',symbol: 'circle',symbolSize: 120,label: {normal: {show: true,formatter: '{b}',color: '#fff',textStyle: {fontSize: '20'}}},itemStyle: {normal: {color: '#00acea'}},data: this.dataList.map((dataItem, index) => {var itemToStyle = styleList[index] // 当前气泡对应样式return {name: `${dataItem.ywlxmc}\n${dataItem.sl}`, // 要展示的文字value: itemToStyle.offset, // 气泡位置symbolSize: dataItem.sl, // 气泡大小label: {textStyle: {fontSize: 11, // 展示文字大小lineHeight: 14, // 展示文字行高color: this.theme === 'light' ? '#0C2753' : '#fff' // 展示文字颜色}},itemStyle: {normal: {// 气泡背景渐变颜色color: {type: 'linear',x: 0,y: 0,x2: 0,y2: 1,colorStops: [{offset: 0,color: itemToStyle.color[0] // 0% 处的颜色},{offset: 1,color: itemToStyle.color[1] // 100% 处的颜色}],global: false // 缺省为 false},opacity: 1, // 气泡透明度shadowColor: itemToStyle.color[0], // 气泡阴影颜色shadowBlur: 10 // 气泡阴影范围}}}})}]
}

效果展示

在这里插入图片描述

  • 参考改造:https://www.makeapie.cn/echarts_content/xHymMERhjf.html在这里插入图片描述

  • 类似散点图制作气泡:

    • https://www.makeapie.cn/echarts_content/xNA8-Rj_wd.html 在这里插入图片描述

    • https://www.makeapie.cn/echarts_content/xPQyAxdcyG.html在这里插入图片描述

http://www.lryc.cn/news/385892.html

相关文章:

  • 深入理解Spring Boot的启动过程
  • 【深度学习】卷积神经网络CNN
  • 游戏AI的创造思路-技术基础-深度学习(3)
  • 贪心算法练习题(2024/6/24)
  • 大厂程序员上班猝死成常态?
  • 深度学习 —— 1.单一神经元
  • Android 12.0 通知发送过程源码分析-Framework
  • 提防远程攻击:了解正向 Shell 和反向 Shell 确保服务器安全
  • RabbitMQ中CorrelationData 与DeliveryTag的区别
  • 数据恢复篇:如何在Android上恢复删除的短信
  • 花了大几万的踩坑经验!宠物空气净化器哪个牌子好:希喂、小米、有哈PK
  • 查普曼大学团队使用惯性动捕系统制作动画短片
  • vue 代理
  • [leetcode]24-game
  • 网络爬虫的原理
  • 游戏AI的创造思路-技术基础-机器学习(2)
  • 【深度学习】记录为什么没有调用GPU
  • vite 创建vue3项目 集成 ESLint、Prettier、Sass等
  • 计算机系统基础知识(上)
  • [深度学习]循环神经网络RNN
  • 【C++:list】
  • 解锁 Apple M1/M2 上的深度学习力量:安装 TensorFlow 完全指南
  • Apache Iceberg:现代数据湖存储格式的未来
  • 【离散数学·图论】(复习)
  • 【ONLYOFFICE震撼8.1】ONLYOFFICE8.1版本桌面编辑器测评
  • Shell 脚本编程保姆级教程(上)
  • 凸优化相关文章汇总
  • Java鲜花下单预约系统源码小程序源码
  • 网络变压器和RJ45接线的方法
  • Matlab/simulink三段式电流保护