What I want to do:
I have a barChart where the x axis represents time. One can select a period of time by selecting it with the mouse and all the charts correctly adjust to the selection.
However, sometimes it's hard to go from exact dates to exact dates, I would like to add a calendar where one could select those dates.
Ideally, selecting dates on the calendar should have the same effect as selecting the time period with the mouse on the barChart.
Tried but don't like:
I tried to create a second time dimension and make the calendar select on that. However, this makes the barChart min and max values adjust to that selection The barChart does not cover the full dimension of the time dimension, but only the selected period on the calendar. This is what I'd like to avoid.
How can I simulate exactly the selection on the chart itself?
Thanks a lot.
EDIT:
I tried to understand the suggestions made on the comments. Let me show you some code.
I have a barChart:
var moveChart = dc.barChart("#move-chart","chart2");
which is the one that one brushes on to perform time filters.
moveChart
.width(700)
...
.dimension(timeDim)
.group(foo)
Now, lets say I do on the console:
timeDim.filterRange([minTime,maxTime]);
dc.renderAll("chart2");
This makes the other charts reflect the selection, but not the moveChart.
I also tried to implement Gordon's comment but I'm not I understand it. In the console I can see that moveChart.filters. does not implement any filter like RangedFilter or TwoDimensionalFilter, so I'm not sure how to perform the filter function on the brush.
Thanks.
timeDim.filterRange([minTime,maxTime]); moveChart.filter([minTime, maxTime]); dc.renderAll("chart2");
would probably work. This is really going to work a lot better if you create a working example that shows the problem (use JSFiddle or a similar platform). – Ethan Jewett