-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
pie chart labels #12174
pie chart labels #12174
Conversation
jenkins, test this |
}; | ||
|
||
const conflicts = []; | ||
let conflictIterations = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this algo is a little dense for me. might help to go over with me in person.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below some initial comments already:
this is genuinely a nice addition. It makes the pie charts a lot more usable.
I particularly like how readable it is, and I love the use of the "elbowed" connector lines. The left-right alignment makes the labels very readable. Pretty great approach IMO!
Most of the below is mainly minor comments. Biggest suggestion is to simplify the conflict detection. FWIW, I'd prefer fewer labels on screen with a more clean consistent layout of the connector-lines, than more labels but with a more complicated connector-lines. Perhaps others have different opinion.
- positioning for a single label doesn't work right. It overlaps with the connector.
- the double-rind pie chart is difficult visually to begin with. But for consitency, I would diplay labels on both sides, not just the right side.
-
can we make the labels and connecting lines the color of the pie-slice?
-
conflict detection:
- the conflict detection discards entire swats of labels. e.g. notice how labels on the entire left side are dropped.
- Is it possible to have just a greedy algorithm that places each label in order. If there is room, it puts the label, if it does not, it does not place it. The current implementation seems to do more complex things.
- Right now, by flipping the orientation the elbow of the connecting-lines, we get overlaps that hurt legibility. IMHO, this complexity isn't necessary. I think part of the cleanliness of the connectors is that because of the elbows, lines going out from all four quadrants never overlap. e.g.: overlapping connector-lines make it look more of a spaghetti
- the conflict detection discards entire swats of labels. e.g. notice how labels on the entire left side are dropped.
-
the truncation parameter is a little bit voodoo. I think mainly because we are using pixels, which isn't all that intuitive.
- can we use char-count iso pixels?
- can we truncate the actual label, instead of replacing it with
...
So e.g.foobar
would becomefo...
and not...
- perhaps we should get rid of the truncation option anyway (?)
thanks for looking into this @thomas ... answers to some of your comments
|
flipping of elbows: we don't flip them ... thats the thing ... elbow is always drawn thru 3 points:
doesn't work well in all scenarios ... but not sure its worth complicating, it will mostly be used for simple charts probably. |
I didn't explain well enough about the "elbows". I mean, the elbow flips when you move labels that connect one quadrant of the pie to another quadrant. that's how you get that overlap. e.g.: when there's a pie slice in the bottom-left quadrant, but position the label in the top-left quadrant, the "elbow" flips, and the connector-line crosses the chart. agreed on preserving the black color, doing otherwise would make it worse |
@thomas i simplified conflict resolution a bit ... now elbows wont 'break' ... simply if label cant be positioned without conflict its skipped .... this will render less labels, and won't prioritize labels with bigger slice size over the labels with smaller slices ... let me know what you think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the below looks really really slick IMO
so lgtm from me, just on look&feel alone.
I would add a textual description of how the algorithm is supposed to work (and does work). That is probably one of the densest, low level pieces of code in Visualize, so it should be documented.
I am running into some issues where the algorithm can be slow and cause the visualization to "hang up" for a minute or so. Granted, these were for some more "academic" layouts (ie. 250 slices), that may not arise in practice.
I haven't tested this on Reporting yet.
8aa8cfb
to
5267d26
Compare
So I see this has been solved, but I do not see the 'how to'. I am new to Kibana, so a little green. Picking up a project dumped by someone else and I need to add labels to the pie slices. Thanks. |
Created #14926 to solve merge issues. |
Close this in favor of #14926 |
5267d26
to
625add6
Compare
@timroes all your comments were addressed (from #14926) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the test passes
CI failed on jenkins, test this |
CI failed on you just have to love our CI :) jenkins, test this |
when merging, could you also add a small |
* pie labels * add simple unit test * fixing dashboard test * fixing basedo on review * simplifying conflict resolution * removing unused code * cleanup code * minor changes based on review * updating option templates to match new design * updating truncate_labels to work with chars instead pixels
* pie labels * add simple unit test * fixing dashboard test * fixing basedo on review * simplifying conflict resolution * removing unused code * cleanup code * minor changes based on review * updating option templates to match new design * updating truncate_labels to work with chars instead pixels
backport 6.x: 0b5052a |
yes @ppisljar!!! 🍻 |
you are right, currently you can only show the percentage value, but not the actual document count. |
Release Notes: Users can now add labels to pie charts.
Resolves #1702
partly addresses: #3686
summary: pie charts can now have labels on them to increase readability