I have a timeseries chart navigable with a subchart, and I want it to start showing only the last week (and in general, programmatically modify zoom and pan but not by modifying axis range which would affect subchart as well).
Reading c3.js, I don't see any way in which `brush` is exposed, and even if it were - I wouldn't know where to begin implementing this.
1) Is it possible?
2) If I add a feature request, will you make it possible?
Thanks!
Aur
Here is an important example to look at:
https://github.com/masayuki0812/c3/blob/master/htdocs/samples/axes_x_extent.html
You can set the x.axis.extent property when you call c3.generate. Note that it can be a array of Date objects, not just strings.
Then I used the following to remember the "last brush extent". Note that this refers to my widget which the .lastBrushExtent property is hanged onto.
chart.internal.brush.on("brush", $.proxy({self: this, "do": function () {
chart.internal.redrawForBrush(); // apply the brush
this.self.lastBrushExtent = chart.internal.brush.extent(); // remember last extent
}}, "do"));
When I generate a new chart I set .axis.x.extent = this.lastBrushExtent.
This is probably not the full answer to the original question, but it gives you some indication where to start with this.
Filip.