2
votes

I created a grouped-stacked composite chart using dc.js. I am wondering if I can add a filterHandler to a composite chart.

I want to filter on each stacks.

1
Well, not exactly at the moment. There is ambiguity about which chart should actually do the filtering, and right now, the composite chart delegates to the children. So you would instead set a filterHandler for each child. Hopefully you can find examples of filtering by stack, if not, let me know.Gordon

1 Answers

1
votes

It seems that, there is no straight forward way to build a composite chart and hook the parent chart to the volumeChart that would filter all the individual child components at once via dc.js, as Gordon suggested. I came up with a solution for one of my dashboards which is not so modular but works fine & also keep in mind the downsides to this approach pointed out below. plot[1]

For the above dashboard to work, I defined 3 barCharts and 3 lineCharts overlaid on top the barCharts and chaining them all together linearly to volumeChart.

Although this works fine with a fixed y-axis scale, lineChart fails to align with the barCharts when the I set elasticY(true) on all of them, since the lineChart components seem to pic its own yMax and when I pass the yMax value as window.value from barCharts to the lineChart via .on('renderlet'..., again I fail to read these values due the misalignment of individual chart render times. And of course when I overlay the lineCharts I intrinsically loose/block the interaction with the barCharts and use the line moving average tooltips to view bar data.

I have not tried this yet but found a better way to do the same from Scott Miller - https://stackoverflow.com/a/25188909/5743716

Hope it helps!