Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set 'focus' area in nvd3.js lineWithFocusChart

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

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.

like image 220
Chanka Avatar asked Jun 19 '13 17:06

Chanka


1 Answers

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()

Thank @elsherbini's comment.

like image 86
yegle Avatar answered Oct 19 '22 15:10

yegle