chartlets
Advanced tools
| import altair as alt | ||
| from chartlets import Component, Input, State, Output | ||
| from chartlets.components import (Tabs, Tab, Typography, Box, | ||
| VegaChart, Table) | ||
| from chartlets.components.table import TableColumn, TableRow | ||
| from server.context import Context | ||
| from server.panel import Panel | ||
| panel = Panel(__name__, title="Panel H") | ||
| @panel.layout(State("@app", "selectedDatasetId")) | ||
| def render_panel( | ||
| ctx: Context, | ||
| selected_dataset_id: str = "", | ||
| ) -> Component: | ||
| dataset = ctx.datasets.get(selected_dataset_id) | ||
| columns: list[TableColumn] = [ | ||
| {"id": "id", "label": "ID", "sortDirection": "desc"}, | ||
| { | ||
| "id": "firstName", | ||
| "label": "First Name", | ||
| "align": "left", | ||
| "sortDirection": "desc", | ||
| }, | ||
| {"id": "lastName", "label": "Last Name", "align": "center"}, | ||
| {"id": "age", "label": "Age"}, | ||
| ] | ||
| rows: TableRow = [ | ||
| ["1", "John", "Doe", 30], | ||
| ["2", "Jane", "Smith", 25], | ||
| ["3", "Peter", "Jones", 40], | ||
| ] | ||
| table = Table(id="table", rows=rows, columns=columns, hover=True) | ||
| info_text = Typography(id="info_text", children=["This is a text."]) | ||
| chart = VegaChart( | ||
| id="chart", chart=( | ||
| alt.Chart(dataset) | ||
| .mark_bar() | ||
| .encode( | ||
| x=alt.X("x:N", title="x"), | ||
| y=alt.Y("a:Q", title="a")) | ||
| .properties(width=290, height=300, title="Vega charts") | ||
| ), style={"flexGrow": 1} | ||
| ) | ||
| tab1 = Tab(id = "tab1", label="Tab 1", children=[table]) | ||
| tab2 = Tab(id = "tab2", label="Tab 2", children=[info_text]) | ||
| tab3 = Tab(id="tab3", label="Tab 3", children=[chart]) | ||
| tabs = Tabs(id = "tabs", value = 0, children=[tab1,tab2,tab3]) | ||
| return Box( | ||
| style={ | ||
| "display": "flex", | ||
| "flexDirection": "column", | ||
| "width": "100%", | ||
| "height": "100%", | ||
| }, | ||
| children=[ tabs ], | ||
| ) | ||
| Metadata-Version: 2.4 | ||
| Name: chartlets | ||
| Version: 0.1.6 | ||
| Version: 0.1.7 | ||
| Summary: Backend for server-configured UI contributions. | ||
@@ -27,9 +27,9 @@ Author: chartlets Development Team | ||
| Classifier: Operating System :: MacOS | ||
| Requires-Python: >=3.10 | ||
| Requires-Python: <3.14,>=3.10 | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE | ||
| Provides-Extra: opt | ||
| Requires-Dist: altair; extra == "opt" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "opt" | ||
| Provides-Extra: dev | ||
| Requires-Dist: altair; extra == "dev" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "dev" | ||
| Requires-Dist: black; extra == "dev" | ||
@@ -49,3 +49,3 @@ Requires-Dist: flake8; extra == "dev" | ||
| Provides-Extra: demo | ||
| Requires-Dist: altair; extra == "demo" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "demo" | ||
| Requires-Dist: pyaml; extra == "demo" | ||
@@ -52,0 +52,0 @@ Requires-Dist: pandas; extra == "demo" |
| [demo] | ||
| altair | ||
| altair<6.0.0,>=5.5.0 | ||
| pyaml | ||
@@ -9,3 +9,3 @@ pandas | ||
| [dev] | ||
| altair | ||
| altair<6.0.0,>=5.5.0 | ||
| black | ||
@@ -27,2 +27,2 @@ flake8 | ||
| [opt] | ||
| altair | ||
| altair<6.0.0,>=5.5.0 |
@@ -52,2 +52,3 @@ LICENSE | ||
| demo/my_extension/my_panel_7.py | ||
| demo/my_extension/my_panel_8.py | ||
| demo/server/__init__.py | ||
@@ -54,0 +55,0 @@ demo/server/app.py |
@@ -1,1 +0,1 @@ | ||
| version = "0.1.6" | ||
| version = "0.1.7" |
@@ -9,2 +9,3 @@ from chartlets import Extension | ||
| from .my_panel_7 import panel as my_panel_7 | ||
| from .my_panel_8 import panel as my_panel_8 | ||
@@ -20,1 +21,2 @@ | ||
| ext.add(my_panel_7) | ||
| ext.add(my_panel_8) |
@@ -42,3 +42,3 @@ from chartlets import Component, Input, Output | ||
| info_text = Typography(id="info_text") | ||
| info_text = Typography(id="info_text", color="grey") | ||
@@ -67,6 +67,6 @@ return Box( | ||
| Output("dialog", "open"), | ||
| Output("info_text", "children"), | ||
| Output("info_text", "text"), | ||
| ) | ||
| def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]: | ||
| return False, ["Okay button was clicked!"] | ||
| def dialog_on_close(ctx: Context, button) -> tuple[bool, str]: | ||
| return False, "Okay button was clicked!" | ||
@@ -78,5 +78,5 @@ | ||
| Output("dialog", "open"), | ||
| Output("info_text", "children"), | ||
| Output("info_text", "text"), | ||
| ) | ||
| def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]: | ||
| return False, ["Not okay button was clicked!"] | ||
| def dialog_on_close(ctx: Context, button) -> tuple[bool, str]: | ||
| return False, "Not okay button was clicked!" |
+5
-5
| Metadata-Version: 2.4 | ||
| Name: chartlets | ||
| Version: 0.1.6 | ||
| Version: 0.1.7 | ||
| Summary: Backend for server-configured UI contributions. | ||
@@ -27,9 +27,9 @@ Author: chartlets Development Team | ||
| Classifier: Operating System :: MacOS | ||
| Requires-Python: >=3.10 | ||
| Requires-Python: <3.14,>=3.10 | ||
| Description-Content-Type: text/markdown | ||
| License-File: LICENSE | ||
| Provides-Extra: opt | ||
| Requires-Dist: altair; extra == "opt" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "opt" | ||
| Provides-Extra: dev | ||
| Requires-Dist: altair; extra == "dev" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "dev" | ||
| Requires-Dist: black; extra == "dev" | ||
@@ -49,3 +49,3 @@ Requires-Dist: flake8; extra == "dev" | ||
| Provides-Extra: demo | ||
| Requires-Dist: altair; extra == "demo" | ||
| Requires-Dist: altair<6.0.0,>=5.5.0; extra == "demo" | ||
| Requires-Dist: pyaml; extra == "demo" | ||
@@ -52,0 +52,0 @@ Requires-Dist: pandas; extra == "demo" |
+4
-4
@@ -16,3 +16,3 @@ [build-system] | ||
| license = {text = "MIT"} | ||
| requires-python = ">=3.10" | ||
| requires-python = ">=3.10,<3.14" | ||
| dependencies = [] | ||
@@ -51,6 +51,6 @@ classifiers = [ | ||
| opt = [ | ||
| "altair", | ||
| "altair>=5.5.0,<6.0.0", | ||
| ] | ||
| dev = [ | ||
| "altair", | ||
| "altair>=5.5.0,<6.0.0", | ||
| "black", | ||
@@ -72,3 +72,3 @@ "flake8", | ||
| demo = [ | ||
| "altair", | ||
| "altair>=5.5.0,<6.0.0", | ||
| "pyaml", | ||
@@ -75,0 +75,0 @@ "pandas", |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
120286
1.88%83
1.22%2801
2.08%