AAChartKit
AAChartKit copied to clipboard
大神,请求没有数据的点,在浮标上 ”--“ ,占位字符串如何表示

参考这个问题 :
- https://github.com/AAChartModel/AAChartKit/issues/651
不是为0,服务器返回null 没有数据和0是两个概念
设置的数据是@[null,null,null]
AAOptions *aaOptions = aaChartModel.aa_toAAOptions;
aaOptions.tooltip
.useHTMLSet(true)
.formatterSet(@AAJSFunc(function () {
let wholeContentStr = this.points[0].x + '<br/>';
let length = this.points.length;
for (let i = 0; i < length; i++) {
let thisPoint = this.points[i];
let yValue = thisPoint.y;
if (yValue != 0) {
let prefixStr = '<span style=\"' + 'color:'+ thisPoint.color + '; font-size:13px\"' + '>◉ ';
wholeContentStr += prefixStr + thisPoint.series.name + ': ' + yValue + '<br/>';
}
}
return wholeContentStr;
}))
;
试试将上面的
if (yValue != 0)
改为
if (yValue != 0 && yValue != null) {
看看效果如何
实时上设置成,如上数据源,null 的时候不会进入函数判断

