-
-
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
Modebar aesthetic configurability #3063
Comments
Good idea @jackparmer I suggest we add the following config key: // mode bar style
modeBarStyle: {
orientation: 'h',
backgroundColor: 'rgba(255 ,255 ,255 ,0.7)',
iconColor: 'rgba(0, 31, 95, 0.3);'
}, We should probably turn the icons into a font: it'll then be straightforward to change their color and opacity with CSS. @etpinard, @alexcjohnson What do you think? |
I like it. I'd probably go for
They were a font a long time ago... and in fact that's still how they're given to us when someone designs a new one. but we ditched that and instead just draw them as straight SVG (with a script to pull that out into js) so we have everything encapsulated in the one js bundle. Anyway this is still styled by css, we'll just need to make some pieces of that dynamic. |
Thanks @alexcjohnson ! So I will go with the following for now: modeBarStyle: {
orientation: 'h',
bgcolor: 'rgba(255 ,255 ,255 ,0.7)',
iconColor: 'rgba(0, 31, 95, 0.3)',
logoColor: 'rgba(0, 31, 95, 0.3)',
position: 'right'
}, Let's keep the pipeline for icons the same for now. I guess I just need to crush the logo into a single path. A tool like this may do the job: https://www.enigmeta.com/svgcrush/ . Can you point me to the most up-to-date plot.ly logo in SVG? Thank you again for the all the details :) |
Just wanting to chime in here a bit and request that these be My rationale is that users will often want to control these settings alongside other layout options like the plot background colour and will likely want to drag along these settings in templates etc. If we make these options |
+1 layout
…On Wed, Oct 3, 2018 at 12:55 PM Nicolas Kruchten ***@***.***> wrote:
Just wanting to chime in here a bit and request that these be layout
options and not config options if at all possible... :)
My rationale is that users will often want to control these settings
alongside other layout options like the plot background colour and will
likely want to drag along these settings in templates etc. If we make these
options config-only then people will not be able to e.g. use the editor
to style the modebar, and will not be able to make "dark theme" templates
that can be reused within Chart Studio. Baking these in to layout will
also likely make things easier for DDK...
/cc @chriddyp <https://github.com/chriddyp> @wbrgss
<https://github.com/wbrgss>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3063 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABx4aiaJAl5FmC9DLRiiboZ4vR5CL8ODks5uhOwbgaJpZM4XClrg>
.
|
Thanks @nicolaskruchten, |
Thank you for your input @nicolaskruchten! |
Nice, thanks for the flexibility, sorry to give this feedback so late :) Next ask: any way to make some of the behaviour automatic? especially with respect to the figure background? would be great to have the modebar either transparent or match the plot background by default, and to have the icon colours somehow maintain contrast... Even if that's hidden behind a flag I think it would be a nice option that would be turned on by default in the editor :) |
I think that would be fine, and I wouldn't consider that a breaking change as long as our solution is legible on any plot. Ideal would be to have |
I decided to wait before implementing the automatic behavior described above by @nicolaskruchten and @alexcjohnson. I definitely love the idea though. It could be applied to every bit of text on a figure: title, axes and so on. For example, as of right now, choosing |
@antoinerg I'd really like this default behaviour for the modebar background at least... Just because we can't do it everywhere doesn't mean we shouldn't do it in some places: we already do handle automatic contrasting text in places like hovertext, where the foreground color is automatically set based on the background :) |
Sure thing! I didn't know we already had the logic to do that in the codebase :) |
It's here: plotly.js/src/components/color/index.js Lines 64 to 82 in 97cb217
and see example for hover label text: plotly.js/src/components/fx/hover.js Lines 795 to 811 in 97cb217
|
Thanks @etpinard ! @nicolaskruchten's request was super easy to implement with this 😊 Sorry @nicolaskruchten for not realizing how easy this was to do! I'm still learning 😄 |
There's never any need to apologize for learning :) Happy that it turned out to be easy! |
@nicolaskruchten Do you think we should now do the same for the title, axes and so on ie. provide a better font color by default ? |
I'd call that a breaking change. |
Should I expect this to work with Dash ? I've tried passing it in the plotly config but doesn't seem to have an effect. |
@zoohair It should work with Dash if you are using plotly.js version For reference: https://github.com/plotly/plotly.js/releases/tag/v1.42.0 |
@antoinerg : I'm on Dash 0.39 which seems to be using plotly-1.45.0.min.js But still no effect when passing modeBarStyle parameters (e.g. Is there a codepen / minimum example somewhere that illustrates the proper use of modeBarStyle in conjunction with Dash? |
@zoohair The style of the modebar is controlled by attribute dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization',
'modebar': {
'orientation': 'v',
'bgcolor': 'rgba(0,0,0,0.5)'
}
}
}
) |
Thanks @antoinerg : it is a bit confusing since this github issue mentions modeBarStyle, and other modebar configuration (visible icons, hover) is done through the dcc.Graph(config=...) not the layout. I'm struggling though to find which setting makes it possible for the modebar to be transparent (both my This issue only appeared in more recent Dash updates (likely due to an update to plotly.js - it worked on 1.42.2 but not working on 1.45.0). I remember seeing this reported as an issue in github somewhere but for the life of me I can't find it again 😞 |
@antoinerg have we checked in the latest version of Dash that it's possible to set the modebar background to 100% transparent? I've been seeing a lot of semi-transparent modebar backgrounds in various Dash apps recently. |
@nicolaskruchten I confirm that it is possible to set the modebar background to 100% transparent by setting @zoohair the fourth number in a rgba color is the opacity so setting it to 0 should make the modebar transparent. Can you send me the list of layout attributes you're using so I can assist you further? |
@antoinerg : my apologies ; As I tried to put together a minimum working example I traced down the issue to a css that was included that was overriding the bgcolor using It's odd because I've had that there for a while, but things worked as expected (i.e. the background-color did not appear until the mdoebar was hovered on) but not in the new version of plotly.js. |
I'm still confused similarly to zoohair.... Thanks. |
@tcados commenting on closed issues isn't the best way to ask for help for this project. Please use https://community.plot.ly/c/plotly-js - that way other plotly.js users will be able to help out or be helped from your questions. Thank you! |
How can I put watermark in plotly graph? |
Any new thoughts on? : |
Would like the modebar to have a few more programmatic options, especially for extremely styled Dash apps:
Programmatic ability to set the modebar in a vertical orientation. Bokeh does a nice job with this:
Programmatic ability to set the background bar color, background bar opacity, and icon colors:
While we're at it, update the plotly logo in the modebar
Related:
#2171
https://github.com/plotly/streambed/issues/9699
(Perhaps we should create a plotly/plotly.js "modebar" label?)
The text was updated successfully, but these errors were encountered: