liquidfill水球设置动态data数据怎么不行啊,不支持动态设置data吗?直接写成data[0.5,0.6,0.7]这种就可以,但是设置成动态参数,页面什么也不显示,大神们有这种经历的吗?
比如:
还是不行,一下这两种情况,这种就可以:
methodA(){
var a = [0.44];
option = {
series: [{
...
...
data:a;
}]
}
}
但是这种动态赋值的就不行
methodA(a){ // 调用的时候传入a为[0.44]
option = {
series: [{
...
...
data:a;
}]
}
}
配置项如下
getUtilizationOption(mobikeArray, ofoArray, publicArray) {
let mobikeArrays = mobikeArray;
let ofoArrays = ofoArray;
let publicArrays = publicArray;
let option = {
// backgroundColor: '#fff',
series: [{
type: 'liquidFill',
radius: '30%',
center: ['30%', '30%'],
// data: [0.04, 0.04, 0.04],
data: mobikeArrays,
label: {
normal: {
show: true,
textStyle: {
color: '#294D99',
insideColor: '#fff',
fontSize: 50,
fontWeight: 'bold',
align: 'center',
baseline: 'middle'
},
position: 'inside',
formatter: function(v){
let reverData = v.value * 100;
return '摩拜: ' + reverData + '%';
// return (mobikeArray[0] * 100) + '%';
}
}
},
backgroundStyle: {
color: '#C0C0C0',
borderColor: '#ec8120',
borderWidth: 5,
shadowColor: 'rgba(0, 0, 0, 0.4)',
shadowBlur: 20
},
outline: {show: false},
}, {
type: 'liquidFill',
radius: '30%',
center: ['70%', '30%'],
// data: [0.36, 0.36, 0.36],
data: ofoArrays,
label: {
normal: {
show: true,
textStyle: {
color: '#294D99',
insideColor: '#fff',
fontSize: 50,
fontWeight: 'bold',
align: 'center',
baseline: 'middle'
},
position: 'inside',
formatter: function(v){
let reverData = v.value * 100;
return 'ofo: ' + reverData + '%';
// return (ofoArray[0] * 100) + '%';
}
}
},
backgroundStyle: {
color: '#C0C0C0',
borderColor: '#fdff42',
borderWidth: 5,
shadowColor: 'rgba(0, 0, 0, 0.4)',
shadowBlur: 20
},
outline: {show: false},
}, {
type: 'liquidFill',
radius: '30%',
center: ['50%', '75%'],
// data: [0.63, 0.63, 0.63],
data: publicArrays,
label: {
normal: {
show: true,
textStyle: {
color: '#294D99',
insideColor: '#fff',
fontSize: 50,
fontWeight: 'bold',
align: 'center',
baseline: 'middle'
},
position: 'inside',
formatter: function(v){
let reverData = v.value * 100;
return '哈罗: ' + reverData + '%';
// return (publicArray[0] * 100) + '%';
}
}
},
backgroundStyle: {
color: '#C0C0C0',
borderColor: '#0f8edf',
borderWidth: 5,
shadowColor: 'rgba(0, 0, 0, 0.4)',
shadowBlur: 20
},
outline: {show: false},
}]
};
return option;
}