AAChartCore
AAChartCore copied to clipboard
您好,我想修改tooltip弹出的数字格式,还起大佬帮忙
tooltip: {
formatter: function () {
var s = '<b>' + this.x + '</b>';
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.y + 'm';
});
return s;
},
shared: true
}
如上面这种格式,我使用如下没用生效
.formatter("function () {\n" +
" var s = '<b>' + this.x + '</b>';\n" +
" $.each(this.points, function () {\n" +
" s += '<br/>' + this.series.name + ': ' +\n" +
" this.y + 'm';\n" +
" });\n" +
" return s;\n" +
"}")
还请大佬帮忙
如上图所示,我想在java代码中使用这种效果,需要如何处理
tooltip: {
formatter: function () {
var s = '<b>' + this.x + '</b>';
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.y + 'm';
});
return s;
},
shared: true
}
这段代码使用了$.each JQuery 的写法, 但是 AAChartCore 中没有对 JQuery 的依赖, 所以你可以将这里的写法改成不依赖 JQuery 的纯原生 JavaScript 方法,再试试.
您好,我尝试使用如下方法,但是没有生效
formatter: function () {
var s = '<b>' + this.x + '</b>';
for (i = 0; i < this.points.length; i++) {
s += '<br/>' + this.series.name + ': ' +
this.y + 'm';
}
return s;
},
请问一下有什么问题么
您好,还有一个疑问辛苦大佬解答一下
就是自定义tooltip后前面的圆点样式需要如何加上
您好,不好意思,js的方法上面是我写错了
formatter: function () {
var s = '<b>' + this.x + '</b>';
for (i = 0; i < this.points.length; i++) {
s += '<br/>' + this.points[i].series.name + ': ' +
this.points[i].y;
}
return s;
}
如上写法已经解决了,就不知道前面的圆点显示需要如何加上