Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTHER] Using chart_config #1267

Open
1 of 2 tasks
JosuaCarl opened this issue Jan 19, 2025 · 6 comments
Open
1 of 2 tasks

[OTHER] Using chart_config #1267

JosuaCarl opened this issue Jan 19, 2025 · 6 comments
Labels
Core Related to Taipy Core 📄 Documentation Internal or public documentation 🖰 GUI Related to GUI 🟧 Priority: High Stalls work on the project or its dependents 🔒 Staff only Restricted to CC staff members

Comments

@JosuaCarl
Copy link

What would you like to share or ask?

How can I use chart_config to change the plots in a data_node ? I would like to be able to do scatter plots with only markers, no lines. Is there a way to do this ?
Example:

with tgb.Page(style=style) as visualization:
    tgb.text("## 📊 Data", mode="markdown")
    tgb.data_node("{csv_data_node}", show_owner=True, chart_config={"type": "scatter"})

I don't get how to structure the dictionary, as referenced here: https://docs.taipy.io/en/latest/refmans/reference/pkg_taipy/pkg_gui/pkg_builder/data_node/

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@JosuaCarl
Copy link
Author

A complete example:

import pandas as pd
import taipy as tp
from taipy.gui import Gui
from taipy.gui import builder as tgb


df = pd.DataFrame(
    {"A": [1,2,3], "B": [4,5,6], "C": [7,8,9]}
)
csv_data_node_config = tp.Config.configure_csv_data_node(
    id="csv_data_node", scope=tp.Scope.GLOBAL
)

csv_data_node = tp.create_global_data_node(csv_data_node_config)
csv_data_node.write(df)

with tgb.Page() as visualization:
    tgb.text("## 📊 Data", mode="markdown")
    tgb.data_node("{csv_data_node}", show_owner=True, chart_config={"type": "scatter"})

gui = Gui(page=visualization)

if __name__ == "__main__":
    gui.run(port=4999)

Clarification of what I want: When I click on the chart view, I want to visualize the data as a different plot (i.e. scatter - markers). Ideally while still being able to choose X and Y, but not necessarily.

@FabienLelaquais
Copy link
Member

@JosuaCarl Indeed the chart_config property lacks documentation and examples.
We will handle this quickly. Thanks

@FredLL-Avaiga
Copy link
Member

FredLL-Avaiga commented Jan 22, 2025

the right property is chart_configs
it is a dict based on datanode config id

@JosuaCarl
Copy link
Author

Does this mean there is no general option? So I would have to enter something like:

{"my_data_node":
    {"type": "scatter"}
}

Because this also does nothing.

@jrobinAV jrobinAV transferred this issue from Avaiga/taipy Jan 24, 2025
@jrobinAV jrobinAV added 📄 Documentation Internal or public documentation 🖰 GUI Related to GUI 🟧 Priority: High Stalls work on the project or its dependents Core Related to Taipy Core 🔒 Staff only Restricted to CC staff members labels Jan 24, 2025
@FabienLelaquais
Copy link
Member

FabienLelaquais commented Jan 24, 2025

Does this mean there is no general option? So I would have to enter something like:

{"my_data_node":
{"type": "scatter"}
}
Because this also does nothing.

@JosuaCarl: the property name is wrong in the doc (should be chart_configs as @FredLL-Avaiga said).
This property can hold a dictionary where each key is a data node configuration identifier.
The corresponding value indicates Taipy how to deal with a dataset, should it come from a DataNode issued from that DataNodeConfig.
Many of the entries are arrays, because we need to handle multiple traces.
We are in the process of documenting this entirely. We're not quite there yet.

In your case you may want to try setting the types property of the dict set for your data node config id to an array with the desired trace type. Because you only have one trace, that will be easy: ["scatter"].
I have not tried this though.
Please keep us posted, someone will jump on this.

Thx

@FabienLelaquais
Copy link
Member

FabienLelaquais commented Jan 26, 2025

@JosuaCarl
Small addition for you to go forward waiting for the whole thing.

In your case, the use case you came up with is you want chart that displays the the data node data as markers only.
to achieve this, you would create the data node control configuration dictionary as follows:

data_node_viewer_configs = {
    "csv_data_node": {
        "modes": ["markers"]
    }
}

then use it when building your page:

tgb.data_node("{csv_data_node}", show_owner=True, chart_configs=data_node_viewer_configs )

This should accomplish what you wanted.
Please let us know, cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Related to Taipy Core 📄 Documentation Internal or public documentation 🖰 GUI Related to GUI 🟧 Priority: High Stalls work on the project or its dependents 🔒 Staff only Restricted to CC staff members
Projects
None yet
Development

No branches or pull requests

4 participants