How can I use 2 range sliders at the same time?

80 views
Skip to first unread message

Marek Kozela

unread,
Sep 2, 2017, 7:32:53 PM9/2/17
to dc-js user group
Hi everyone,

I have 2 range sliders (Age and Height) and the table. I want to use these 2 range sliders at the same time, but it seems that they are not working properly.

Also, under the table, there is the text "49 selected out of 49 records". These two numbers are also not changing while using the sliders.

Could you help me with this?

Thank you very much.

Marek


Gordon Woodhull

unread,
Sep 3, 2017, 4:09:47 PM9/3/17
to dc-js-us...@googlegroups.com

Hi Marek,

Nice use of d3.slider.js - I haven't seen that used with dc.js before.

At a quick glance, I see two problems here. First, you're using one dispatch for both sliders, so both sliders are filtering the age, since that's the dimension of the table. You'd probably want to create another dimension for filtering by height, and you don't really need to attach that to a chart.

Second, instead of just redrawing the chart with dataTable.redraw(), you probably want to call dataTable.redrawGroup() so that all charts in its chart group get redrawn, including the dataCount.

In the future, it would be helpful to put your example in a jsFiddle or bl.ock, since I'm able to see your code and make some guesses about what's going wrong, but I'm not able to fork it to test hypotheses.

Cheers,
Gordon

--
You received this message because you are subscribed to the Google Groups "dc-js user group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dc-js-user-gro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dc-js-user-group/728bde76-e5d5-44e6-b073-c4bf4f5fa555%40googlegroups.com.

Marek Kozela

unread,
Sep 4, 2017, 4:55:12 AM9/4/17
to dc-js user group
Hi Gordon,

could you, please, help me with this? I put the example in the Plunker:


Thank you very much.

Gordon Woodhull

unread,
Sep 4, 2017, 5:50:58 AM9/4/17
to dc-js-us...@googlegroups.com
Sure, I answered on SO because the code formatting is better. Thanks, your example should be useful to a lot of people.

https://stackoverflow.com/questions/46024705/how-can-i-use-2-range-sliders-at-the-same-time/46034395#46034395

Marek Kozela

unread,
Sep 4, 2017, 6:17:26 AM9/4/17
to dc-js user group
Thank you very much for your time and help in answering my question :)
Reply all
Reply to author
Forward
0 new messages