在 angular-nvd3 工具提示中添加其他字段
Add additional fields in angular-nvd3 tooltip
我正在使用 angular-nvd3(例如 http://krispo.github.io/angular-nvd3/#/scatterChart)创建散点图。我可以使用以下函数创建自定义工具提示
tooltip: {
contentGenerator: function(d) { return '<h3>HELLO WORLD</h3>'; }
}
不过,我的要求更为基本,需要在 nvd3 生成的默认工具提示中添加几个附加字段(如果不为空)。
是否可以将图表的数据对象中的文本值 属性 映射到默认的 nvd3 toolip?
{
x: 1460199045.987,
y: 0,
textvalue: "117 test comment"
},
我是通过复制nvd3源代码中的contentGenerator函数(它创建一个html table)然后根据我的要求修改它来实现的。不是最干净的解决方案,但它有效。
我正在使用 angular-nvd3(例如 http://krispo.github.io/angular-nvd3/#/scatterChart)创建散点图。我可以使用以下函数创建自定义工具提示
tooltip: {
contentGenerator: function(d) { return '<h3>HELLO WORLD</h3>'; }
}
不过,我的要求更为基本,需要在 nvd3 生成的默认工具提示中添加几个附加字段(如果不为空)。
是否可以将图表的数据对象中的文本值 属性 映射到默认的 nvd3 toolip?
{
x: 1460199045.987,
y: 0,
textvalue: "117 test comment"
},
我是通过复制nvd3源代码中的contentGenerator函数(它创建一个html table)然后根据我的要求修改它来实现的。不是最干净的解决方案,但它有效。