@devops-web/cs-chart
Version:
## 更新流程 1. 切换源到npm官方源https://registry.npmjs.org/ 2. npm login 3. npm run lib 4. 修改package.json中的版本号 5. npm publish --access public
76 lines (75 loc) • 1.72 kB
JavaScript
// 环形图
export default {
name: '进度环',
type: 'progress',
option: (data) => ({
series: [
{
type: 'gauge',
startAngle: 90,
endAngle: -270,
pointer: {
show: false,
},
progress: {
show: true,
overlap: false,
roundCap: true,
clip: false,
itemStyle: {
borderWidth: 1,
borderColor: '#464646',
},
},
axisLine: {
lineStyle: {
width: 40,
},
},
splitLine: {
show: false,
distance: 0,
length: 10,
},
axisTick: {
show: false,
},
axisLabel: {
show: false,
distance: 50,
},
data: data.y
.filter((y, index) => index < 3) // 最多显示三个值,多了会乱
.map((y, index) => {
// 1 -> 10
// 2 -> 30
// 3 -> 50
const HEIGHT = 40;
const maxCount = Math.min(3, data.y.length);
const posH = (maxCount / 2 - index) * HEIGHT - 10;
return {
value: y.data[0],
name: data.x[index],
detail: {
valueAnimation: true,
offsetCenter: ['0%', `${posH}%`],
},
title: {
offsetCenter: ['0%', `${posH - 15}%`],
},
};
}),
title: {
fontSize: 14,
},
detail: {
width: 50,
height: 14,
fontSize: 24,
color: 'auto',
formatter: '{value}%',
},
},
],
}),
};