How to get True or False status of a checkbox #178
-
Hello, Currently I am working on a plotly graph, the x-axis of the graph is linked with a checkbox. (Since there is no toggle button available, I have to rely on the check box for this) in my code i have defined and linked the CB with state variable like this. "CBYearOrYear": {
"byYr": "Years",
}, and this reflect to the grph x-axis. #this is always true
typeXAxis = "Years" if CBYearOrYear["byYr"] else "Months"
fig = px.histogram(
main_df,
x=typeXAxis,
...... I also tried to toggle the checkbox with on_change() and getting the payload, but it gives weird results. Appreciate your assistance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Beta Was this translation helpful? Give feedback.
Hi,
In Streamsync, the value of a Checkbox Input is an array, since it can contain multiple options, and multiple options can be selected at once (unlike with a radio input, where only one option can be selected).
For example, if you have a Checkbox Input with three options (keys a, b, c), you can set a and b to be checked by binding a state element as shown below.
Hope that helps!