0
我想从一个指标记录最新的数据(实际上是为了更新div),但下面的虚拟代码只会记录下“undefined”。我如何获得立体派指标的最新价值
var context, cube, metric;
context = cubism.context().step("1e4").size(1080);
cube = context.cube(CUBE_SERVER);
metric = cube.metric("median(sar(value).eq(key,'ldavg_15').eq(host,'myserver'))");
metric.on("change", function(start, stop) {
console.log("changing");
if (typeof this.valueAt !== "undefined") {
console.log(this, this.valueAt(-1));
}
});
谁能告诉我的valueAt功能有一定的工作代码?与其他地方使用绘制水平图的方式相同的度量标准确实起作用。