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

echarts自定义图表--仪表盘

在这里插入图片描述
基于仪表盘类型的自定义表盘
在这里插入图片描述

上图为3层结构组成

  • 正常一个仪表盘配置
  • 要在外圈和内圈之间制造一条缝隙间隔 再创建一个仪表盘配置 背景透明 进度条拉满 进度条颜色和数据的背景相同
  • 开始处的线 又一个仪表盘配置 数值固定一个比较小的值
<!DOCTYPE html>
<html><head><meta charset="utf-8" /><script src="https://cdn.jsdelivr.net/npm/echarts@5"></script><style>#main {width: 200px;height: 200px;margin: 100px auto;}</style><style>/* 在 CSS 文件中定义自定义字体 */@font-face {font-family: "MyCustomFont"; /* 自定义字体名称 */src: url("public/只含数字.ttf");font-weight: normal;font-style: normal;}</style></head><body><div id="main"></div><script>var chart = echarts.init(document.getElementById("main"));const bgColor = "#1F1316";chart.setOption({backgroundColor: "black",series: [{type: "gauge",startAngle: 0,endAngle: 360,itemStyle: {// shadowColor: "#fff",// shadowBlur: 10,},progress: {show: true,width: 8,// roundCap: true,overlap: true,itemStyle: {// borderColor: "#fff",// borderWidth: 1,// opacity: 1,// borderType: [5, 10],// borderDashOffset: 5,color: {type: "linear",x: 0,y: 0,x2: 1,y2: 1,colorStops: [{ offset: 0, color: "#f20075" }, // 渐变起始色{ offset: 1, color: "#ff6666" }, // 渐变结束色],},// shadowColor: "#f20075",// shadowBlur: 10,},},axisLine: {lineStyle: {width: 10,// color: [[1, "#1F1016"]], // 背景圆环color: [[1, bgColor]], // 背景圆环},},pointer: {show: false,},axisTick: {show: false,},splitLine: {show: false,},axisLabel: {show: false,},detail: {valueAnimation: true,formatter: "{value}\n%",fontSize: 24,fontFamily: "MyCustomFont",color: "#fff",textShadowColor: "#CB3359",textShadowBlur: 10,textBorderColor: "#CB3359",textBorderWidth: 1,offsetCenter: [0, "0%"],},data: [{value: 49,},],z: 1,},// 紧贴外圈与背景同色 利用遮蔽下层颜色产生间隔效果{type: "gauge",startAngle: 0,endAngle: 360,itemStyle: {color: "",},progress: {show: true,width: 2,itemStyle: {color: bgColor,},},pointer: {show: false,},axisLine: {show: false,},axisTick: {show: false,},splitLine: {show: false,},axisLabel: {show: false,},detail: {show: false,},data: [{value: 100,},],z: 2,},// 开始处齐点{type: "gauge",startAngle: 0,endAngle: 360,itemStyle: {color: "",},progress: {show: true,width: 10,itemStyle: {// borderColor: "#fffae5",// borderWidth: 1,// borderType: [5, 10],// borderDashOffset: 5,color: "#fffae5",shadowColor: "#fff",shadowBlur: 5,},},pointer: {show: false,},axisLine: {show: false,},axisTick: {show: false,},splitLine: {show: false,},axisLabel: {show: false,},detail: {show: false,},data: [{value: 0.5,},],z: 3,},],});</script></body>
</html>
http://www.xdnf.cn/news/196705.html

相关文章:

  • 【机器学习】人工智能在电力电子领域的应用
  • 反射与注解实现动态功能扩展案例-插件系统
  • 模型上下文协议(MCP)深度解析:大模型从“思考者“进化为“行动者“
  • 总账主数据——Part 2 科目-4
  • 优先队列和单调队列(双端队列实现的)
  • stm32wb55rg (1) 基于IAR 创建stm32 工程模板
  • 序列密码算法ShanLooog512设计原理详解
  • DeepSearch复现篇:QwQ-32B ToolCall功能初探,以Agentic RAG为例
  • React速通笔记
  • 初识Python
  • 【Keil5-开发指南】
  • Java实现基数排序算法
  • 机器学习day2
  • 深入理解链表:从基础操作到高频面试题解析
  • 省哲学社科基金项目申请书(论证活页)模版框架参考
  • 013几何数学——算法备赛
  • web技术与Nginx网站服务
  • word2Vec与GloVe的区别
  • LeetCode 1482. 制作 m 束花所需的最少天数
  • 【SpringMVC】详解参数传递与实战指南
  • MANIPTRANS:通过残差学习实现高效的灵巧双手操作迁移
  • 策略模式:灵活的算法封装与切换
  • 实验研究 | 千眼狼高速摄像机驱动精密制造创新
  • 9.学习笔记-springboot(P90-P104)
  • Spring MVC 基础 - 从零构建企业级Web应用
  • 从零到一MCP详细教程——入门
  • 深度相机(一)——深度相机模型及用途介绍
  • vuex刷新数据丢失解决方案-vuex-persist
  • 软考-软件设计师中级备考 6、数据结构 图
  • springboot 实现敏感信息脱敏