|
@@ -24,9 +24,13 @@ export default {
|
24
|
24
|
})
|
25
|
25
|
},
|
26
|
26
|
methods: {
|
|
27
|
+ returnValue (val) {
|
|
28
|
+ return String(val).substring(0, 2).split('').join('.') - 0
|
|
29
|
+ },
|
27
|
30
|
init () {
|
28
|
31
|
var _that = this
|
29
|
32
|
var Shape = G2.Shape
|
|
33
|
+ var aValue = _that.returnValue(_that.data.value)
|
30
|
34
|
// 自定义Shape 部分
|
31
|
35
|
Shape.registerShape('point', 'pointer', {
|
32
|
36
|
drawShape: function drawShape (cfg, group) {
|
|
@@ -65,7 +69,7 @@ export default {
|
65
|
69
|
height: 400,
|
66
|
70
|
padding: [0, 0, 30, 0]
|
67
|
71
|
})
|
68
|
|
- chart.source(_that.data.value)
|
|
72
|
+ chart.source([{ value: aValue }])
|
69
|
73
|
|
70
|
74
|
chart.coord('polar', {
|
71
|
75
|
startAngle: -9 / 8 * Math.PI,
|
|
@@ -122,7 +126,7 @@ export default {
|
122
|
126
|
chart.guide().arc({
|
123
|
127
|
zIndex: 1,
|
124
|
128
|
start: [0, 0.945],
|
125
|
|
- end: [_that.data.value[0].value, 0.945],
|
|
129
|
+ end: [aValue, 0.945],
|
126
|
130
|
style: {
|
127
|
131
|
stroke: '#1890FF',
|
128
|
132
|
lineWidth: 18
|
|
@@ -131,7 +135,7 @@ export default {
|
131
|
135
|
// 绘制指标数字
|
132
|
136
|
chart.guide().html({
|
133
|
137
|
position: ['50%', '100%'],
|
134
|
|
- html: '<div style="width: 300px;text-align: center;">' + '<p style="font-size: 20px; color: #545454;margin: 0;">' + _that.data.title + '</p>' + '<p style="font-size: 36px;color: #545454;margin: 0;">' + _that.data.list[0].value * 10 + '%</p>' + '</div>'
|
|
138
|
+ html: '<div style="width: 300px;text-align: center;">' + '<p style="font-size: 20px; color: #545454;margin: 0;">' + _that.data.title + '</p>' + '<p style="font-size: 36px;color: #545454;margin: 0;">' + aValue * 10 + '%</p>' + '</div>'
|
135
|
139
|
})
|
136
|
140
|
|
137
|
141
|
chart.render()
|