Skip to content

Is there a way to receive click events from charts? #299

Answered by FlorianJacta
jzeimen asked this question in Q&A
Discussion options

You must be logged in to vote

You have this option for the majority of charts. The property is called selected but is unavailable for pie charts. I created a quick example to show you how to use it in a bar chart.

Click on the bar until you see it is selected; the table should be refreshed accordingly.

from taipy.gui import Gui, State
import pandas as pd

data = pd.DataFrame({"values":[60, 40],
                     "labels":["Done", "Not Done"]})

data_for_table = data
selected = []

md = """
<|{data}|chart|type=bar|y=values|x=labels|selected={selected}|>

<|{data_for_table}|table|>
"""

def on_change(state: State, var_name: str, var_value):
    if var_name == "selected":
        if len(var_value) == 1:
            label

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jzeimen
Comment options

@FlorianJacta
Comment options

Answer selected by FlorianJacta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants