In previous version's of nvd3
您可以执行以下操作来访问图表/图表对象。
chart = nv.graphs[0];
然而,在最近的版本中,这似乎已被删除:
nv.graphs -> undefined
nv.graphs[0] -> TypeError: nv.graphs is undefined
是否有其他方法可以访问图表元素?
chart = nv.graphs[0];
a = chart.brushExtent();
这里有一个简单的jsfiddle,你可以在其中看到这个,
答案 0 :(得分:1)
I don't have a real answer, but have found something that may help accessing brushextents:
Rather than declaring chart as a global var, you can declare 2 global var for your extents, and update them when brush is updated, like so:
chart.dispatch.on('brush.update', function(b) {
curve_focus_min = b.extent[0];
curve_focus_max = b.extent[1];
});