Search code examples
d3.jszoomingvisualizationbrush

D3: Brushing already zoomed data


I am trying to implement zooming and Linking&Brushing in Bubble chart.

Aplaying linking and brushing while data are still on initial position works just fine. Also zooming alone works just fine. But if I zoom the chart and then i try to select the data, then it's not selecting the right ones. Example:

Brushing while zooming is not applied

Bushing after zooming was applied

I am using brush.extent() to get the position of brushing space. Somehow the position of dots is never updated, while zooming.

I can take under consideration the scale size while I am brushing. But I am asking if there is something which updates the dots position after zooming automatically. Or am I missing something as I am pretty new at using d3.js and also on visualization field.


Solution

  • If anyone is facing the same error, maybe my solution will be helful.

    While brushing I add the translate values to the x and y coordinates.

    d3.event.translate