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

added simple path to external labels functionality on pie charts #986

Closed
wants to merge 6 commits into from

Conversation

alan-unravel
Copy link
Contributor

Requires externalLabels to have a value. Should probably also require radius otherwise the labels will get cut off very frequently. Not as fancy as the initial example, will have to work on that
pathed_pie

@alan-unravel alan-unravel changed the title added simple path to external labels functionality on pie charts added simple path to external labels functionality on pie charts [WIP] Aug 13, 2015
@alan-unravel alan-unravel changed the title added simple path to external labels functionality on pie charts [WIP] added simple path to external labels functionality on pie charts Aug 31, 2015
@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Sep 14, 2015
centroid = d3.svg.arc()
.outerRadius(_radius + _externalLabelRadius)
.innerRadius(_radius + _externalLabelRadius)
.centroid(d);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

centroid is never used.

@gordonwoodhull
Copy link
Contributor

Thanks @alan-unravel, I am merging this and making a few improvements:

  • implementing the transition cases
  • removing the unused centroid noted above
  • applying the arc to the interpolated angle rather than the final angle
  • making lines to zero-sized wedges invisible

As you can see on this test page, there are many problems with pie transitions:
http://dc-js.github.io/dc.js/transitions/pie-external-label-transitions.html
.. but these path transitions are mostly better behaved at this point.

I think the position of the line could still be improved. Right now it's drawing from the center of the wedge to the center of a ring segment with the label on the outer radius. IMO it would be nicer to draw it directly to the label, but clip it at the label or a slight margin away from the label. I have code for that elsewhere but this is good enough for now.

gordonwoodhull added a commit that referenced this pull request Oct 31, 2015
gordonwoodhull added a commit that referenced this pull request Oct 31, 2015
gordonwoodhull added a commit that referenced this pull request Oct 31, 2015
@gordonwoodhull
Copy link
Contributor

Merged in 2.0.0 beta 20

@alan-unravel
Copy link
Contributor Author

Thanks @gordonwoodhull let me know if I can be of any help, the original lines from the example I put in gitter were nice but I didn't have the time to generalize the concept.

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

Successfully merging this pull request may close these issues.

None yet

2 participants