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

Bar Legend Stroke Inconsistent after opacity change #1490

Open
mrawdon opened this issue Apr 22, 2022 · 0 comments
Open

Bar Legend Stroke Inconsistent after opacity change #1490

mrawdon opened this issue Apr 22, 2022 · 0 comments

Comments

@mrawdon
Copy link

mrawdon commented Apr 22, 2022

Describe the bug
When changing the bar opacity. The legend text changes, it appears that the stroke property gets added to the text. This causes the text to appear bold.

To Reproduce

import numpy as np
from bqplot import (
    OrdinalScale,
    LinearScale,
    Bars,
    Figure,
    Axis
)

x_ord = OrdinalScale()
y_sc = LinearScale()

bar = Bars(x=np.arange(10),labels=["Bars"], y=np.random.rand(10), scales={"x": x_ord, "y": y_sc},display_legend=True)
ax_x = Axis(scale=x_ord)
ax_y = Axis(scale=y_sc, tick_format="0.2f", orientation="vertical")

def def_legend(src, event):
    bar.visible=not bar.visible
    if bar.visible:
        bar.opacities=[]
    else:
        bar.opacities=[.5]
    
bar.on_legend_click(def_legend) 

Figure(marks=[bar], axes=[ax_x, ax_y], padding_x=0.025, padding_y=0.025)

Click on the legend Text to reproduce

Expected behavior
I would expect the stroke property to remain the same in the legend after clicking Legend Text

Screenshots
image
image

After
image
image

After clicking again(should match first screenshot
image
image

Additional context
Looking at the code, it looks like in draw_legend the stroke property is never set.
In updateColors it appears that the stroke property always gets set.

I believe removing stroke from the legend in updateColors would address this issue. I can create a PR for that if that makes sense.

@mrawdon mrawdon changed the title Bar Legend Stroke Inconsistent after change Bar Legend Stroke Inconsistent after opacity change Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant