0

For example I need to select a group of elements by hovering on only one of them. It performs very slow in firefox. Here's the example http://bl.ocks.org/tumoxep/581d939e30361fbe0b44 I hope I made a mistake somwhere.

1 Answer 1

0

Hmm, Performance in firefox of your demo is ok for me... Still I find it odd how you used the groups and the mouse events. When you look at your DOM you will see that all the circles are just inside your group. Has nothing to do with the mouse events instead they are looking for the color of the circle?

Why not make a group consisting of a couple of circles and then apply the mouse event to that group.

Like so:

var svgg = svg.selectAll("g.myGroup")
    .data(myData)
    .enter()
    .append("g");

svgg.each(function (d, i) {

    selection = d3.select(this);
    selection.append("circle")
    // ...
});

svgg.on("mouseover", function(d) {
    // Do what you want here
});

You can find a similar example here: http://jsfiddle.net/77XLD/1/

I am not sure though if that helps performance-wise...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.