Word cloud is not selected in cross flter

27 views
Skip to first unread message

AAA

unread,
Nov 17, 2017, 12:20:37 PM11/17/17
to dc-js user group
Hi I am new to dc.js. I am implementing word cloud with the bar chart using crossfilter. 
My problem is when I am selecting bar chart it shows respective data in cloud but I am unable to select cloud data so it will show on bar.
Here is my code.


Please help me  .

Gordon Woodhull

unread,
Nov 17, 2017, 2:05:36 PM11/17/17
to dc-js-us...@googlegroups.com
It looks like the library dc-wordcloud which you are using does not have support for selections built in. You'd have to either modify the library or add a click handler after the chart has rendered. Something like (untested):

wordcloudChart.on(‘pretransition’, function(chart) {
    chart.selectAll(‘text’).on(‘click’, function(d) {
        wordDim.filter(d.text);
        dc.redrawAll();
    });
});

--
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/85ada40f-d8c0-43f1-9963-25bbb5fe36e0%40googlegroups.com.

AAA

unread,
Nov 17, 2017, 4:37:06 PM11/17/17
to dc-js user group
Thanks Gordon it really works :) But the only problem is the words having count 1 (means exists once) are not displaying. Where I have to define the size? Your help is highly appreciated  


On Friday, 17 November 2017 19:05:36 UTC, Gordon Woodhull wrote:
It looks like the library dc-wordcloud which you are using does not have support for selections built in. You'd have to either modify the library or add a click handler after the chart has rendered. Something like (untested):

wordcloudChart.on(‘pretransition’, function(chart) {
    chart.selectAll(‘text’).on(‘click’, function(d) {
        wordDim.filter(d.text);
        dc.redrawAll();
    });
});


On Nov 17, 2017, at 12:20 PM, AAA <syeda.sanaezainab@insight-centre.org> wrote:

Hi I am new to dc.js. I am implementing word cloud with the bar chart using crossfilter. 
My problem is when I am selecting bar chart it shows respective data in cloud but I am unable to select cloud data so it will show on bar.
Here is my code.


Please help me  .

--
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-group+unsubscribe@googlegroups.com.

Gordon Woodhull

unread,
Nov 17, 2017, 5:40:38 PM11/17/17
to dc-js-us...@googlegroups.com
Awesome!

Looking at the source for this dc-wordcloud (which I hadn't seen before, thanks for pointing it out), there is this function:

function checkSize(d){

            var x = 0;

            if(d.value <= 0) { 

                x = 0

            } else { 

                x = Math.log(d.value)*_chart.relativeSize();

            }

            return x;

}


which makes sense, to log-scale the sizes. 


But log(1) == 0 so I think you'll need to change the code. And please, when you do, submit a PR or issue with the author and say thanks!


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/57f5691d-c7cd-453c-84f7-fb7b4a59f22b%40googlegroups.com.

AAA

unread,
Nov 17, 2017, 6:39:17 PM11/17/17
to dc-js user group
Thanks 
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/85ada40f-d8c0-43f1-9963-25bbb5fe36e0%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages