Skip to content

Commit 82c92eb

Browse files
committed
TODO: new callback onclick test
1 parent 921c50f commit 82c92eb

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

chartlets.js/src/lib/hooks.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@ export function useSignalListeners(
8686
}, [chart]);
8787

8888
const handleClickSignal = useCallback(
89-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
90-
// @ts-expect-error
91-
(signalName: string, value: unknown) => {
89+
(signalName: string, signalValue: unknown) => {
9290
if (id) {
9391
return onChange({
9492
componentType: "Plot",
9593
id: id,
96-
property: "points",
97-
value: value,
94+
property: signalName,
95+
value: signalValue,
9896
});
9997
}
10098
},

chartlets.py/my_extension/my_panel_1.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def make_figure(ctx: Context, selected_dataset: int = 0) -> alt.Chart:
6060
# Create another parameter to handle the click events and send the data as
6161
# specified in the fields
6262
click_param = alt.selection_point(
63-
on="click", name="onClick", fields=["x", variable_name]
63+
on="click", name="points", fields=["x", variable_name]
6464
)
6565
# Create a chart type using mark_* where * could be any kind of chart
6666
# supported by Vega. We can add properties and parameters as shown below.
@@ -81,3 +81,13 @@ def make_figure(ctx: Context, selected_dataset: int = 0) -> alt.Chart:
8181
)
8282

8383
return chart
84+
85+
86+
# # TODO: see if we can get the value of the clicked points from the click params above
87+
# @panel.callback(
88+
# Input("selected_dataset"),
89+
# Output("plot", "chart"),
90+
# )
91+
# def test_callback(
92+
# self,
93+
# ): ...

0 commit comments

Comments
 (0)