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

echarts画一个饼图

饼图1

var myChart = echarts.init(document.getElementById('eqp-pie-chart'));option = {tooltip: {trigger: 'item'},legend: {data: ['状态A', '状态B', '状态C', '状态D'],//textStyle: {//    //color: '#ff0000', // 文字颜色//    fontSize: 14 // 文字大小//},textStyle: {rich: {a: {color: 'rgba(0, 23, 58, 1)',fontSize: 18,fontWeight: 'bold'},b: {color: 'blue',fontSize: 16}},},formatter: function (name) {//var value = echarts.getInstanceByDom(document.getElementById('eqp-pie-chart')).getModel().getComponent('series', '系列1').getData().get('y', 0);return `{a|${100}}\n${name}`;},itemGap: 20, // 图例每项之间的间隔itemWidth: 5, // 图例标记的图形宽度itemHeight: 36, // 图例标记的图形高度padding: [5, 10], // 图例容器内边距borderRadius: 2, // 图例容器边框圆角borderColor: '#ccc' // 图例容器边框颜色},//legend: {//    show: false,//    //top: '5%',//    //left: 'center'//},title: {show: true,text: '1090',subtext: '总量',x: 'center', //水平安放位置,默认为'left',可选为:'center' | 'left' | 'right' | {number}(x坐标,单位px)y: '40%',textStyle: {color: '#00173A', // 字体颜色fontSize: 27   // 字体大小},subtextStyle: {color: '#33333399', // 字体颜色fontSize: 18   // 字体大小}},series: [{type: 'pie',radius: ['0%', '45%'],label: {show: false,position: 'center'},data: [{value: 1090, name: 'Total', itemStyle: {color: 'rgba(64,124,252,0.05)'}},]},{name: '设备状态统计',type: 'pie',radius: ['57%', '65%'],padAngle: 19,avoidLabelOverlap: false,padAngle: 5,itemStyle: {borderRadius: 5},label: {show: false,position: 'center'},emphasis: {label: {show: true,fontSize: 40,fontWeight: 'bold'}},labelLine: {show: false},data: [{value: 432, name: '状态A', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(64, 125, 252, 1)' // 起始颜色}, {offset: 0,color: 'rgba(64, 104, 252, 1)' // 结束颜色}])}},{value: 159, name: '状态B', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(1, 209, 94, 1)' // 起始颜色}, {offset: 0,color: 'rgba(1, 190, 205, 1)' // 结束颜色}])}},{value: 159, name: '状态C', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(247, 121, 0, 1)' // 起始颜色}, {offset: 0,color: 'rgba(247, 174, 0, 1)' // 结束颜色}])}},{value: 99, name: '状态D', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(247, 1, 1, 1)' // 起始颜色}, {offset: 0,color: 'rgba(250, 93, 93, 1)' // 结束颜色}])}}]},{name: '设备状态统计阴影',type: 'pie',radius: ['64%', '72%'],padAngle: 19,avoidLabelOverlap: false,padAngle: 5,itemStyle: {borderRadius: 5},label: {show: false,position: 'center'},emphasis: {label: {show: true,fontSize: 40,fontWeight: 'bold'}},labelLine: {show: false},data: [{value: 432, name: '状态A', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(64, 125, 252, 0.15)' // 起始颜色}, {offset: 0,color: 'rgba(64, 104, 252, 0.15)' // 结束颜色}])}},{value: 159, name: '状态B', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(1, 209, 94, 0.15)' // 起始颜色}, {offset: 0,color: 'rgba(1, 190, 205, 0.15)' // 结束颜色}])}},{value: 159, name: '状态C', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(247, 121, 0, 0.15)' // 起始颜色}, {offset: 0,color: 'rgba(247, 174, 0, 0.15)' // 结束颜色}])}},{value: 99, name: '状态D', itemStyle: {color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{offset: 1,color: 'rgba(247, 1, 1, 0.15)' // 起始颜色}, {offset: 0,color: 'rgba(250, 93, 93, 0.15)' // 结束颜色}])}}]}]
};
myChart.setOption(option);

在这里插入图片描述

http://www.dtcms.com/a/461235.html

相关文章:

  • 基于改进YOLO算法的果园环境中障碍物识别与检测技术研究
  • 三元锂电池和磷酸铁锂电池:从原子晶格到应用哲学的深度解析
  • vscode-background 扩展的原理、配置和使用
  • 2100AI相亲(三)
  • 时钟服务器主地址
  • 瑞安学校网站建设口碑好网站建设价格
  • 自己做的网站访问不了建设网站哪些公司好
  • SpringMVC启动流程
  • HTTP 请求方法与参数上传形式的关系
  • 如何减少 Elasticsearch 集群中的分片数量
  • 当通过API发送请求的方式自动触发Jenkins job报错HTTP Status 403 – Forbidden的解决办法
  • 一个网站如何工作流程建立网站需要哪些手续
  • H3C网络设备 实验二:搭建两个局域网,使两个局域网相互通信(路由器,固定ip)
  • 临平房产做网站的公司wordpress屏蔽功能org
  • Skywalking 的本地开发配置
  • iOS 上架 App 全流程实战,应用打包、ipa 上传、App Store 审核与工具组合最佳实践
  • JavaScript核心构成与基础语法详解2
  • 邹平网站建设公司淘宝网站开始怎么做
  • fs 文件系统:Node.js 操作磁盘的 “万能工具”
  • Android + iOS 手机抓包 App 实操教程
  • 智慧新零售时代:施易德系统平衡技术与人力,赋能门店运营
  • 标准编码与算法
  • Python获取变量名本身​​——varname库
  • 专业站全返利网站建设
  • 网站设计提案安阳市建设工程领域网站
  • 鸿蒙(OpenHarmony)声明式 UI 开发入门:从「智慧校园」项目学基础语法
  • js移动开发框架
  • 【腾讯拥抱开源】Youtu-Embedding:基于CoDiEmb的一个协作而独特的框架,用于信息检索与语义文本相似性中的统一表征学习
  • 西蔵自治区建设厅网站wordpress防盗链插件
  • VSCode中使用conda activate 虚拟环境,没报错,但没进入环境