1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | <! DOCTYPE html> < html > < head > < meta charset="utf-8"> < title >ECharts</ title > < script src="./sources/echarts/echarts.min.js"></ script > </ head > < body style="background-color:#151414"> < div id="main" style="width: 100%;height:400px;"></ div > < script type="text/javascript"> // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); var option = { series: [ { type:'gauge', center: ['250px', '50%'], //**调整仪表盘的位置** splitNumber: 10, // 分割段数,默认为5 axisLine: { // 坐标轴线 lineStyle: { // 属性lineStyle控制线条样式 color: [[0.1, '#228b22'],[0.9, '#48b'],[1, '#ff4500']], width: 6 } }, axisTick: { // 坐标轴小标记 splitNumber: 10, // 每份split细分多少段 length :12, // 属性length控制线长 lineStyle: { // 属性lineStyle控制线条样式 color: 'auto' } }, axisLabel: { // 坐标轴文本标签,详见axis.axisLabel textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE color: 'auto' } }, splitLine: { // 分隔线 show: true, // 默认显示,属性show控制显示与否 length :18, // 属性length控制线长 lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式 color: 'auto' } }, pointer : { //指针大小 width : 5 }, title : { show : true, offsetCenter: [0, '-40%'], // x, y,单位px textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE fontWeight: 'bolder' } }, detail : { formatter:'{value}%', textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE color: 'auto', fontWeight: 'bolder'// 下面data数据的字体设置!!!! } }, data:[ { value: 23, name: '百分比1', title:{ show:true, fontSize:16, color:'red', fontWeight:'normal', offsetCenter:[0,'-25%'] } } ] }, { type:'gauge', center: ['700px', '50%'], //**调整仪表盘的位置** splitNumber: 10, // 分割段数,默认为5 axisLine: { // 坐标轴线 lineStyle: { // 属性lineStyle控制线条样式 color: [[0.1, '#228b22'],[0.9, '#48b'],[1, '#ff4500']], width: 6 } }, axisTick: { // 坐标轴小标记 splitNumber: 10, // 每份split细分多少段 length :12, // 属性length控制线长 lineStyle: { // 属性lineStyle控制线条样式 color: 'auto' } }, axisLabel: { // 坐标轴文本标签,详见axis.axisLabel textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE color: 'auto' } }, splitLine: { // 分隔线 show: true, // 默认显示,属性show控制显示与否 length :18, // 属性length控制线长 lineStyle: { // 属性lineStyle(详见lineStyle)控制线条样式 color: 'auto' } }, pointer : { //指针大小 width : 5 }, title : { show : true, offsetCenter: [0, '-40%'], // x, y,单位px textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE fontWeight: 'bolder' } }, detail : { formatter:'{value}%', textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE color: 'auto', fontWeight: 'bolder'// 下面data数据的字体设置!!!! } }, data:[ { value: 67, name: '百分比2', title:{ show:true, fontSize:16, color:'red', fontWeight:'normal', offsetCenter:[0,'-25%'] } } ] } ] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); </ script > </ body > </ html > |
分类:
echarts
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
2022-05-19 typescript https上传文件
2022-05-19 typescript https请求