在 nvd3.js lineWithFocusChart 中设置“焦点"区域 [英] Set 'focus' area in nvd3.js lineWithFocusChart

查看:29
本文介绍了在 nvd3.js lineWithFocusChart 中设置“焦点"区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此处显示的 nvd3 示例中显示的 lineWithFocusChart.js 模型:http://nvd3.org/ghpages/examples.html

I'm usuing the lineWithFocusChart.js model shown in the nvd3 examples shown here: http://nvd3.org/ghpages/examples.html

我希望能够为图表选择一个特定的 x 范围,以便在加载时关注.我以为我可以设置图表中的一个变量来完成此任务.

I want to be able to choose a specific x range for the graph to be focused on at load. I thought there would be a variable in chart that I could set to accomplish this.

推荐答案

假设页面上只有一个 nvd3 生成的图:

Suppose there's only one graph generated by nvd3 on the page:

chart = nv.graphs[0] // how to choose the graph by DOM id?
chart.brushExtent([10,20])
chart.update()

感谢@elsherbini 的评论.

Thank @elsherbini's comment.

这篇关于在 nvd3.js lineWithFocusChart 中设置“焦点"区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆