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

Legacy plot titles don't change when they should on rerender #1042

Open
jnumainville opened this issue Nov 25, 2024 · 1 comment
Open

Legacy plot titles don't change when they should on rerender #1042

jnumainville opened this issue Nov 25, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@jnumainville
Copy link
Collaborator

Legacy plot titles don't change when they should.
In the below example, the title never changes from the initial sym

import deephaven.plot.express as dx
from deephaven.plot.figure import Figure

stocks = dx.data.stocks()
syms = stocks.view("Sym").select_distinct("Sym")

@ui.component
def plot_with_title():
    sym, set_sym = ui.use_state("LIZARD")
    picker = ui.picker(syms, selected_key=sym, on_change=set_sym)

    plot_line = (
        Figure()
        .plot_xy(series_name="Price", t=stocks, x="Timestamp", y="Price")
        .figure_title(f"Price of {sym}")
        .show()
    )
    return [picker, plot_line]

test = plot_with_title()
Screenshot 2024-11-25 at 3 02 39 PM Screenshot 2024-11-25 at 3 02 53 PM
@jnumainville jnumainville added bug Something isn't working triage labels Nov 25, 2024
@mattrunyon
Copy link
Collaborator

A (not great) workaround is to add a wrapper with key=title. Stan ran into this same issue, but I hadn't opened a ticket for it yet.

The issue is actually in @deephaven/chart where the Chart component does not respond to all changes in the plotly layout. Since the title is in the layout, but has no special handling, it doesn't respond to changes. I think axis labels have the same issue.

So the component isn't re-mounted on the client which is why adding a key prop to a wrapper is a workaround. It forces React to re-mount the component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants