0

I'm creating a scatter chart using angular-nvd3 (e.g. http://krispo.github.io/angular-nvd3/#/scatterChart). I can create a custom tooltip using the below function

tooltip: {
  contentGenerator: function(d) { return '<h3>HELLO WORLD</h3>'; }
}

My requirement however is more basic and to add a couple of additional fields (if not null) in the default tooltip generated by nvd3.

Is it possible to map the textvalue property in the graph's data object to the the default nvd3 toolip?

{
x: 1460199045.987,
y: 0,
textvalue: "117 test comment"
},
4

1 回答 1

0

我通过从 nvd3 源代码(创建一个 html 表)中复制 contentGenerator 函数,然后根据我的要求对其进行修改来实现。不是最干净的解决方案,但它有效。

https://github.com/novus/nvd3/blob/master/src/tooltip.js

于 2016-09-01T10:11:43.210 回答