fix: 看板参数可能为null编译检查不过

This commit is contained in:
TsMask
2024-04-01 16:41:13 +08:00
parent edabd9a104
commit 1e0e3a89cf

View File

@@ -98,7 +98,7 @@ const optionData: EChartsOption = {
itemStyle: {
color: function (params) {
// 红色
if (+params.value >= 70) {
if (params.value && +params.value >= 70) {
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: '#fff1f0' },
{ offset: 0.5, color: '#ffa39e' },
@@ -106,7 +106,7 @@ const optionData: EChartsOption = {
]);
}
// 蓝色
if (+params.value >= 30) {
if (params.value && +params.value >= 30) {
return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
{ offset: 0, color: '#f0f5ff' },
{ offset: 0.5, color: '#adc6ff' },
@@ -161,9 +161,9 @@ const optionData: EChartsOption = {
label: {
formatter: params => {
var text = `{a| ${params.value}%} `;
if (+params.value >= 70) {
if (params.value && +params.value >= 70) {
text = `{c| ${params.value}%} `;
} else if (+params.value >= 30) {
} else if (params.value && +params.value >= 30) {
text = `{b| ${params.value}%} `;
}
return text;