Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labels are overlapped by slices in pie chart #664

Closed
vadimzv opened this issue Aug 6, 2014 · 5 comments
Closed

Labels are overlapped by slices in pie chart #664

vadimzv opened this issue Aug 6, 2014 · 5 comments
Labels
Milestone

Comments

@vadimzv
Copy link

vadimzv commented Aug 6, 2014

Here it can be reproduced http://vzv.ucoz.ru/dc/pietrouble.html
Click on Deposits on the first chart, the second chart will be filtered, then click on Deposits again so the second chart will be reverted to the original state. Upper label (Contract enforcement) in the second chart is now partially hidden by the slice.
This bug happens because slices (g tags in svg) and labels (text tags) are mixed while all slices must come first and after them must come text tags. To fix it you can add

_g.selectAll("text." + _sliceCssClass).remove();

before

createElements(slices, arc, pieData);

So all labels will be recreated.

@gordonwoodhull
Copy link
Contributor

Or put the labels in another g layer.

Thanks for the report!

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Sep 4, 2014
@maackle
Copy link
Contributor

maackle commented Jun 15, 2016

Is anybody working on this? I tried to quickly add a fix to put labels in a separate g, but saw it wasn't trivial. I might try again, unless there's a solution in the works.

@gordonwoodhull
Copy link
Contributor

Hi @maackle, that would be great. You're right, it is slightly more complicated because it means you need to start two separate select(...).selectAll(...).data(...) roots. But it shouldn't be too difficult.

If you find this too difficult, you could always use a 'preRedraw' event hook to delete any existing text at the beginning of redraw, as a temporary workaround.

https://github.com/dc-js/dc.js/blob/develop/web/docs/api-latest.md#basemixinonevent-listener--basemixin

maackle added a commit to maackle/dc.js that referenced this issue Jun 16, 2016
maackle added a commit to maackle/dc.js that referenced this issue Jun 16, 2016
@maackle
Copy link
Contributor

maackle commented Jun 16, 2016

@gordonwoodhull I made a PR for this. You're right, it was pretty straightforward (after I remembered how d3 works!). There could be some discussion about CSS class names; I wound up giving classes to the new groups as well as adding an extra class to labels~~, though none of that was strictly necessary~~.

EDIT: just added a CSS rule for the new label class, so that one is necessary.

@gordonwoodhull
Copy link
Contributor

Fixed in 2.0 beta 32. Thanks @maackle, @vadimzv!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants