我已经阅读了相关文章,但是无法从我的数据集中获取标签以显示在工具提示中。我可能缺少一些简单的东西。
我的数据结构:
$scope.chartData = [values: [{ x: 1, y: 20, label: "timeStamp 1" }, { x: 2, y: 10, label: "timeStamp 2" }, { x: 3, y: 11, label: "timeStamp 3" } ], key : "graph 1"]
选项
$scope.options = {
chart: {
interactiveLayer: {
tooltip: {
contentGenerator: function (d) {
console.log(JSON.stringify(d));
// HERE IS WHAT I SEE in console for series
// {"series":[{"key":"graph 1","value":20} ]}
// return some custom HTML
}
}
}
}
}
控制台输出-> {“系列”:[{“键”:“图形1”,“值”:20}]} 我可以在自定义工具提示中获得每个数据点的“键”和“值”对,但是如何将chartData的“标签”参数也带入块contentGenerator:function(d){}? / p>