Toggle navigation
动态旋转
By
s***5
2020-12-14 03:03:19
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
let angle = 0; //角度,用来做简单的动画效果的 let value = 80; option = { backgroundColor: '#000E1A', title: [{ text: '75%', x: '50%', y: '40%', textAlign: 'center', textStyle: { fontSize: '70', fontWeight: '100', color: '#79ffff', textAlign: 'center', }, }, ], polar: { radius: ['85%', '81%'], center: ['50%', '50%'], }, angleAxis: { max: 100, show: false, startAngle: 0, }, radiusAxis: { type: 'category', show: true, axisLabel: { show: false, }, axisLine: { show: false, }, axisTick: { show: false }, }, series: [ // 紫色 { name: "ring5", type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { return { type: 'arc', shape: { cx: api.getWidth() / 2, cy: api.getHeight() / 2, r: Math.min(api.getWidth(), api.getHeight()) / 2 * 0.9, startAngle: (0 + angle) * Math.PI / 180, endAngle: (90 + angle) * Math.PI / 180 }, style: { stroke: "#8383FA", fill: "transparent", lineWidth: 1.5 }, silent: true }; }, data: [0] }, { name: "ring5", //紫点 type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { let x0 = api.getWidth() / 2; let y0 = api.getHeight() / 2; let r = Math.min(api.getWidth(), api.getHeight()) / 2 * 0.9; let point = getCirlPoint(x0, y0, r, (90 + angle)) return { type: 'circle', shape: { cx: point.x, cy: point.y, r: 4 }, style: { stroke: "#8450F9", //绿 fill: "#8450F9" }, silent: true }; }, data: [0] }, // 蓝色 { name: "ring5", type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { return { type: 'arc', shape: { cx: api.getWidth() / 2, cy: api.getHeight() / 2, r: Math.min(api.getWidth(), api.getHeight()) / 2 * 0.9, startAngle: (180 + angle) * Math.PI / 180, endAngle: (270 + angle) * Math.PI / 180 }, style: { stroke: "#4386FA", fill: "transparent", lineWidth: 1.5 }, silent: true }; }, data: [0] }, { name: "ring5", // 蓝色 type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { let x0 = api.getWidth() / 2; let y0 = api.getHeight() / 2; let r = Math.min(api.getWidth(), api.getHeight()) / 2 * 0.9; let point = getCirlPoint(x0, y0, r, (180 + angle)) return { type: 'circle', shape: { cx: point.x, cy: point.y, r: 4 }, style: { stroke: "#4386FA", //绿 fill: "#4386FA" }, silent: true }; }, data: [0] }, { name: "ring5", type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { return { type: 'arc', shape: { cx: api.getWidth() / 2, cy: api.getHeight() / 2, r: Math.min(api.getWidth(), api.getHeight()) / 2 * 0.95, startAngle: (270 + -angle) * Math.PI / 180, endAngle: (40 + -angle) * Math.PI / 180 }, style: { stroke: "#0CD3DB", fill: "transparent", lineWidth: 1.5 }, silent: true }; }, data: [0] }, // 橘色 { name: "ring5", type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { return { type: 'arc', shape: { cx: api.getWidth() / 2, cy: api.getHeight() / 2, r: Math.min(api.getWidth(), api.getHeight()) / 2 * 0.95, startAngle: (90 + -angle) * Math.PI / 180, endAngle: (220 + -angle) * Math.PI / 180 }, style: { stroke: "#FF8E89", fill: "transparent", lineWidth: 1.5 }, silent: true }; }, data: [0] }, { name: "ring5", type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { let x0 = api.getWidth() / 2; let y0 = api.getHeight() / 2; let r = Math.min(api.getWidth(), api.getHeight()) / 2 * 0.95; let point = getCirlPoint(x0, y0, r, (90 + -angle)) return { type: 'circle', shape: { cx: point.x, cy: point.y, r: 4 }, style: { stroke: "#FF8E89", //粉 fill: "#FF8E89" }, silent: true }; }, data: [0] }, { name: "ring5", //绿点 type: 'custom', coordinateSystem: "none", renderItem: function(params, api) { let x0 = api.getWidth() / 2; let y0 = api.getHeight() / 2; let r = Math.min(api.getWidth(), api.getHeight()) / 2 * 0.95; let point = getCirlPoint(x0, y0, r, (270 + -angle)) return { type: 'circle', shape: { cx: point.x, cy: point.y, r: 4 }, style: { stroke: "#0CD3DB", //绿 fill: "#0CD3DB" }, silent: true }; }, data: [0] }, { name: '', type: 'bar', roundCap: true, barWidth: 60, showBackground: true, backgroundStyle: { color: '#464451', }, data: [75], coordinateSystem: 'polar', itemStyle: { normal: { color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{ offset: 0, color: '#0ff' }, { offset: 1, color: '#02aeff' }]), } } }, { type: 'pie', radius: ['75%', '76%'], center: ['50%', '50%'], data: [{ hoverOffset: 1, value: 100, name: '', itemStyle: { color: '#ff6189', }, label: { show: false }, labelLine: { normal: { smooth: true, lineStyle: { width: 0 } } }, hoverAnimation: false, }, { label: { show: false }, labelLine: { normal: { smooth: true, lineStyle: { width: 0 } } }, value: 100 - 75, hoverAnimation: false, itemStyle: { color: '#3c3a48', }, } ] }, ] }; //获取圆上面某点的坐标(x0,y0表示坐标,r半径,angle角度) function getCirlPoint(x0, y0, r, angle) { let x1 = x0 + r * Math.cos(angle * Math.PI / 180) let y1 = y0 + r * Math.sin(angle * Math.PI / 180) return { x: x1, y: y1 } } function draw() { angle = angle + 3 myChart.setOption(option, true) //window.requestAnimationFrame(draw); } setInterval(function() { //用setInterval做动画感觉有问题 draw() }, 100);