-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 insidetext colour by default isn't readable #2951
Comments
Thanks @dsmmcken - this issue also pertains to bars:
Bars already allow array font properties: |
TasksTo summarize, we need to implement two new features and fix one bug:
API changesFrom an API point of view, I believe we need to address how font properties are inherited from Still, I believe users need an option to back away from the new contrasting default. Why? Because there might exist pie and bar charts that set Therefore I suggest to add the new @alexcjohnson and @etpinard, what do you think? Bug in online API reference?The |
This sums up what's at hand very well. Thanks for writing this down!
I agree with you 💯 % here.
Interesting idea. There's #1597, that could offer an alternative solution. I'm not entirely sure what's best going forward. This is something we could talk about during next week's plotly.js meeting.
Good eye. Interestingly though, it is listed properly: plotly.js/src/traces/bar/attributes.js Lines 18 to 22 in 67a05c7
plotly.js/src/traces/bar/attributes.js Lines 85 to 87 in 67a05c7
.. it might be a bug in https://github.com/plotly/documentation/tree/source |
Please, no. Not as a default anyways. While in theory a border on text makes it readable on all colours, it also makes it ugly on all colours. I also dislike the border as used for the same purpose on the hoverlabels, which can't be disabled from the API. I can set a bordercolor: transparent which for whatever reason is then also used for the font colour!?, so now I have to specify that too, but that means now I can't get it to be auto contrasting with the label colour, so now I would have to start manual specifying font colors all because I don't want the border. Alternately, I can kill it with a CSS override, which is what I currently do on all my plots. --Edit: that behaviour should probably be considered a bug and I'll open a separate ticket. If that is the route you want to take on this, can I suggest two things:
|
Thanks @dsmmcken. I think both solutions – let's call them auto-contrasting and text with outline – are valuable in different situations. In the Google Maps scenario (referenced in #1597) where text labels overlay multiple background colors, I think text with outline is the only viable solution. But in other scenarios, like pie charts with homogeneous backgrounds, I'd say auto-contrasting is the more aesthetic solution. Now, do pie or even bar really have homogeneous backgrounds? What if a long pie label overflows its slice and reaches into the neighbor slice with an entirely different bg-color? Then we have a Google Maps like scenario again. In my opinion it boils down to and depends on the use case:
I think Plotly.js should have both modes eventually. The question is, how should the API look like and which mode should be the default.
Should I create a bug report? Or should I just ping @cldougl? |
@rmoestl at first glance it looks like a bug w/ the documentation-- if you can create a report in the doc repo: https://github.com/plotly/documentation/issues and tag me there that would be super helpful! |
Here's a summary of a discussion w/t Alex and Etienne that clarified the questions above:
|
If a user creates a pie chart using all default settings and the text labels default to inside the slice, then some labels become unreadable depending on slice colour (below WCAG guidelines). For inside labels, colour should auto set to contrasting. A plot produced with all default settings should always be usable.
Link to codepen
Furthermore, if a user sets a custom marker colours array, there is no way for them to set the text colour to contrast or set text colours individually.
The text was updated successfully, but these errors were encountered: