Added support for labels in pie and doughnut charts #311
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #286
This is draft to enables labels on pie and doughnut charts.
I propose to extend the ISeriesLabel to add options for positioning and a label provider. I happy to discuss alternatives how to integrate it into the existing API.
There are three things that I would love to hear your thoughts:
First, I would love to enable multiple label placements (say the percentage inside the pie slice, the label placed outside). But that does not really fit to the existing ISeriesLabel interface with the get/setter for the ISeriesLabel. One could add a
createAdditionalLabel
method.Second, in PP I am rendering the label color - if placed inside the pie slice - based on the color of the slice (dark slice = white; bright slice = black). Again, I could ignore the Foreground method in the interface, but it is not intuitive as the interface has the method
Third, I am using
Function<Node, String> labelProvider
to not introduce a dependency to JFace. Any better idea?Examples for the use of the new API:
Example charts: