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

Please add support for slice visibility threshold in Pie Chart #14684

Closed
junlincc opened this issue Apr 16, 2021 · 13 comments
Closed

Please add support for slice visibility threshold in Pie Chart #14684

junlincc opened this issue Apr 16, 2021 · 13 comments
Labels
en This issue is in English new-feature stale Inactive for a long time. Will be closed in 7 days. topic: pie

Comments

@junlincc
Copy link
Member

junlincc commented Apr 16, 2021

What problem does this feature solve?

Let’s say that some “slices” of your pie are very small. You might be fine with these options being grouped together so that people reading your report can focus on the big results. The Grouping Percentage Threshold allows you to establish the minimum percentage a portion of the pie chart should have before it gets lumped into an “All Others” category.

Example: In a pie chart “category A” makes up 20% of the pie, as do “category B” and “category C” If we set the Grouping Percentage Threshold to 25%, “category A” “category B”and “category C” would be grouped into one category called “All Others” that took up the collective 60% of the pie.
Screen Shot 2021-04-15 at 11 17 48 PM

@echarts-bot echarts-bot bot added en This issue is in English new-feature labels Apr 16, 2021
@junlincc junlincc changed the title Please add support fo slice visibility threshold in Pie Chart Please add support for slice visibility threshold in Pie Chart Apr 16, 2021
@villebro
Copy link
Member

It could be nice to have to options:

  • labelThreshold: minimum threshold that determines which labels and label lines should be drawn. Similar to the labelThreshold property on NVD3 Pie Chart: https://nvd3.org/examples/pie.html
  • sliceThreshold: minimum threshold that determines which slices should be drawn as separate slices and which should be grouped into an "Other" category.

@junlincc
Copy link
Member Author

@Ovilia if the request is aligned with your product strategy, we(Apache Superset) are happy to contribute this feature :)

@Ovilia
Copy link
Contributor

Ovilia commented Apr 16, 2021

@villebro I think there may also be cases where slices should be merged if the slice amount reachs a threshold. For example, if data values could be 8%, 7%, 7.2%, 7.1%, 6.4%, ... or 53%, 4%, 3.2%, .... and the developer may not have a clue to how these values distribute, it may not be a good idea to set a value threshold in this case. In stead, a slice amount threshold is more helpful. For example, we can show the largest 5 slices and merge the others. I think maybe both the policy should be provided. Your PR may not implement them both, but should give the consideration of API design for such future features.

@Ovilia
Copy link
Contributor

Ovilia commented Apr 16, 2021

Or, would it be helpful if we provide a mergePolicy callback to let developers decide how slices should be merged?

@villebro
Copy link
Member

@villebro I think there may also be cases where slices should be merged if the slice amount reachs a threshold. For example, if data values could be 8%, 7%, 7.2%, 7.1%, 6.4%, ... or 53%, 4%, 3.2%, .... and the developer may not have a clue to how these values distribute, it may not be a good idea to set a value threshold in this case. In stead, a slice amount threshold is more helpful. For example, we can show the largest 5 slices and merge the others. I think maybe both the policy should be provided. Your PR may not implement them both, but should give the consideration of API design for such future features.

Excellent point @Ovilia , and now that you mention it, actually something I've run into.

Or, would it be helpful if we provide a mergePolicy callback to let developers decide how slices should be merged?

Yes, this is an even better design, as it will make it easy to customize. I'll start working on a callback based approach.

@Ovilia
Copy link
Contributor

Ovilia commented Apr 16, 2021

Another consideration is, should "The others" slice have a special color (gray?) or use the color palette by default?
Tooltip and legend should also be taken care of.

@villebro
Copy link
Member

Another consideration is, should "The others" slice have a special color (gray?) or use the color palette by default?
Tooltip and legend should also be taken care of.

I think it could default to grey or some other "downgraded" color, of course with the option to define a custom one. Regarding tooltip/legend, we can experiment with different options and see what looks best (we can potentially ask our design team to come up with a few suggestions if you'd like).

@Ovilia
Copy link
Contributor

Ovilia commented Apr 16, 2021

@villebro Cool! @pissang @100pah would give you some further discussion on this issue.

@villebro
Copy link
Member

I set out to implement labelThreshold, and when I started adding the code I found minShowLabelAngle which essentially does this (it just needs to be converted from percentages to angles). So this feature already exists. Next I'll work on adding slice grouping (the "other" slice for slices that fall below a predefined threshold) as discussed.

@Ovilia
Copy link
Contributor

Ovilia commented Apr 25, 2021

@villebro Yes, minShowLabelAngle does this.
Great! Looking forward to your PR.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it did not have recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this issue.

@github-actions github-actions bot added the stale Inactive for a long time. Will be closed in 7 days. label Apr 25, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@jbest
Copy link

jbest commented Jun 22, 2023

Bump, I needed this feature today, but was able to get the result I needed with a custom query (based on http://www.silota.com/docs/recipes/sql-top-n-aggregate-rest-other.html) the work arounds mentioned in #19182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature stale Inactive for a long time. Will be closed in 7 days. topic: pie
Projects
None yet
Development

No branches or pull requests

4 participants