Skip to content

Commit c9ab9fe

Browse files
committed
Update callback fn.
1 parent 1b6b9e6 commit c9ab9fe

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

chartlets.py/my_extension/my_panel_1.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import copy
22
from types import NoneType
3+
from typing import Any
34

45
import altair as alt
56
import pandas as pd
@@ -91,7 +92,9 @@ def make_figure(ctx: Context, selected_dataset: int = 0) -> alt.Chart:
9192
State("plot", "chart.encoding"),
9293
Output("plot", "chart.encoding.color"),
9394
)
94-
def get_click_event_points(ctx: Context, points: dict, encoding: dict) -> dict:
95+
def get_click_event_points(
96+
ctx: Context, points: dict[str, Any], encoding: dict[str, Any]
97+
) -> dict[str, Any]:
9598
"""
9699
This callback function shows how we can use the event handlers output
97100
(property="points") which was defined in the `make_figure` callback
@@ -113,10 +116,9 @@ def get_click_event_points(ctx: Context, points: dict, encoding: dict) -> dict:
113116
conditions.append(f"datum.{field} === '{value}'")
114117
else:
115118
conditions.append(f"datum.{field} === {value}")
116-
conditions.append(f"datum.{field} === {repr(value)}")
117119

118120
condition_expr = " && ".join(conditions)
119-
121+
print(condition_expr)
120122
return {
121123
"condition": {
122124
"test": condition_expr,

0 commit comments

Comments
 (0)