Skip to content

Embed widget should load workspace settings #1964

@bmingles

Description

@bmingles

Some deephaven ui components need formatter settings from the Redux store (e.g. Picker).

As-is, the following query crashes in embed widget:

# import deephaven.ui as ui
# from deephaven.ui import use_state
from deephaven import ui
from deephaven import time_table
from deephaven.plot.figure import Figure
import datetime

default_value=5
initial_row_count=20

column_types = time_table("PT2S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=initial_row_count)).update([
    "Int=new Integer(i)",
    "Double=new Double(i+i/10)",
    "Sin=Math.sin(i)",
    "Cos=Math.cos(i)",
])

@ui.component
def picker():
    value, set_value = ui.use_state(default_value)

    print("Test", value)

    text = ui.text(value, key="text1")

    # Picker for selecting values
    pick = ui.picker(
        column_types,
        key_column="Int",
        label_column="Int",
        label="Picker",
        selection_mode="multiple",
        on_change=set_value,
        selected_key=value,
    )

    # Display picker and output in a flex column
    return ui.flex(
        pick,
        text,
        direction="column",
        margin=10,
        min_height=0, # necessary to avoid overflowing container height
        gap=10,
    )

picker_column_types = picker()

figure = Figure().plot_xy(series_name="Demo", t=column_types, x="Sin", y="Cos").show()
image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions