-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathhvplot_list.py
More file actions
97 lines (72 loc) · 2.85 KB
/
Copy pathhvplot_list.py
File metadata and controls
97 lines (72 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""An app to demo the usage and responses of the hvplot_list tool."""
import panel as pn
import panel_material_ui as pmui
from holoviz_mcp.client import call_tool
ABOUT = """
# hvPlot List Plot Types Tool
The `hvplot_list` tool lists all available hvPlot plot types supported in the current environment.
## Purpose
Discover what plot types you can generate with hvPlot. These are also called "kinds" in the hvPlot API.
## Use Cases
- Explore available visualization options before creating plots
- Understand what plot types are supported in your environment
- Find the right plot type name to use in `df.hvplot.kind()` or `df.hvplot(kind='...')`
## Returns
A sorted list of all plot type names available in hvPlot.
**Examples:** `['area', 'bar', 'box', 'contour', 'line', 'scatter', 'violin', ...]`
## Next Steps
After discovering plot types with this tool, use:
- [`hvplot_get`](./hvplot_get) - Get detailed documentation or function signature for a specific plot type
"""
@pn.cache
async def hvplot_list_plot_types() -> list[str]:
"""Demo the usage and responses of the hvplot_list tool."""
response = await call_tool(
tool_name="hvplot_list",
parameters={},
)
return response.data
async def create_content():
"""Create the styled content displaying hvPlot plot types as chips."""
items = await hvplot_list_plot_types()
count = pmui.Typography(
f"Found {len(items)} plot types",
variant="subtitle1",
sx={"color": "text.secondary", "mb": 2},
)
chips = pmui.FlexBox(
*[pmui.Chip(item, variant="outlined", color="primary", size="small") for item in items],
sizing_mode="stretch_width",
)
return pmui.Column(count, chips, sizing_mode="stretch_width")
def create_app():
"""Create the Panel Material UI app for demoing the hvplot_list tool."""
about_button = pmui.IconButton(
label="About",
icon="info",
description="Click to learn about the hvPlot List Plot Types Tool.",
sizing_mode="fixed",
color="light",
margin=(10, 0),
)
about = pmui.Dialog(ABOUT, close_on_click=True, width=0)
about_button.js_on_click(args={"about": about}, code="about.data.open = true")
github_button = pmui.IconButton(
label="Github",
icon="star",
description="Give HoloViz-MCP a star on GitHub",
sizing_mode="fixed",
color="light",
margin=(10, 0),
href="https://github.com/MarcSkovMadsen/holoviz-mcp",
target="_blank",
)
content = pn.panel(create_content, loading_indicator=True)
main = pmui.Container(about, content)
return pmui.Page(
title="HoloViz-MCP: hvplot_list Tool Demo",
header=[pmui.Row(pn.HSpacer(), about_button, github_button, sizing_mode="stretch_width")],
main=[main],
)
if pn.state.served:
create_app().servable()