-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
'marker+text' mode for bar charts #34
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
Comments
having |
I would use with |
Ah, great points! That's a sweet idea! |
related: plotly/plotly.py#356 |
Cool - thanks for the |
This is a productivity boost. |
In fact more pieces of the pie chart text functionality should be replicated here - like |
Perhaps bar charts with |
@jackparmer @cldougl The PR for #80 is almost completed. I'm planning to work on this issue now. |
@etpinard @alexcjohnson I have a PR that implements this feature ready for review on my repo. |
Thanks @n-riesco I'll take at your PR before days end. Cheers 🍻 |
Done in #1159 |
Dear alexcjohnson and etpinard, |
@PPPW here's a working version: https://codepen.io/etpinard/pen/RgvJPK?editors=0010
|
Dear @etpinard , I wonder could you take a look at this case: it seems if we got a lot of bars, then the font size will be too small: https://codepen.io/anon/pen/weNjVP?editors=0010 You can change the first line to change the number of bars in the plot. In my example, the font becomes too small. It'll be nice if the font can be as large as the bar, or more visible or tunable. Thanks! |
@PPPW The issue is these lines: https://github.com/plotly/plotly.js/blob/master/src/traces/bar/plot.js?utf8=%E2%9C%93#L352-L354 They constrain the text bounding box to be no larger than the bar, which in this case is a bit too restrictive. If there's a way around it, it's not clear to me. Perhaps this constraint should not be applied if you've explicitly provided a font size. Since the bounding box size isn't known at supply-default-time, I think that would require storing the presence of (or another attribute, obv: |
Seems reasonable. We could also probably 🔪 the text padding for outside bars, and in the case of a single trace or grouped bars, allow outside text to expand up to the full bar spacing (including the gap between bars). If we did those two, the text in this case (omitting |
Currently, we have to make annotations for bar charts because 'markers+text' mode (Reference: https://plot.ly/javascript/reference/#scatter-mode) does not extend to bar charts like this one:
https://plot.ly/javascript/bar-charts/#bar-chart-with-direct-labels
This can be tedious for a large number of bars, especially if someone is using the Web App. It would be nice if 'markers+text' mode existed for horizontal and vertical bar charts.
The text was updated successfully, but these errors were encountered: