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

Support providing plugin_config to Perspective pane #3814

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions examples/reference/panes/Perspective.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"* **``split_by``** (list): A list of columns to pivot by. e.g. `[\"x\", \"y\"]`\n",
"* **``sort``** (list): List of sorting specs, e.g. `[[\"x\", \"desc\"]]`\n",
"* **``plugin``** (str): The name of a plugin to display the data. For example 'datagrid' or 'd3_xy_scatter'.\n",
"* **``plugin_config``** (dict): Configuration for the PerspectiveViewerPlugin \n",
"* **``toggle_config``** (bool): Whether to show the config menu.\n",
"* **``theme``** (str): The theme of the viewer, available options include `'material'`, `'material-dark'`, `'material-dense'`, `'material-dense-dark'`, `'monokai'`, `'solarized'`, `'solarized-dark'` and `'vaporwave'`\n",
"\n",
Expand All @@ -52,6 +53,29 @@
"pn.pane.Perspective(data, width=1000)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also provide configuration options for the viewer plugins:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"random_df = pd.DataFrame(np.random.randn(20, 2), columns=list('XY'))\n",
"\n",
"pn.pane.Perspective(random_df, width=1000, plugin_config={\n",
" 'columns': {\n",
" 'X': {'gradient': 0.7836544570728833, 'neg_color': '#f07160', 'number_color_mode': 'gradient', 'pos_color': '#7dc3f0'},\n",
" 'Y': {'gradient': 1.5673089141457666, 'neg_color': '#ff9485', 'number_color_mode': 'gradient', 'pos_color': '#607785'}\n",
" }\n",
"})"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
3 changes: 3 additions & 0 deletions panel/pane/perspective.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ class Perspective(PaneBase, ReactiveData):
plugin = param.ObjectSelector(default=Plugin.GRID.value, objects=Plugin.options(), doc="""
The name of a plugin to display the data. For example hypergrid or d3_xy_scatter.""")

plugin_config = param.Dict(default={}, doc="""
Configuration for the PerspectiveViewerPlugin.""")

toggle_config = param.Boolean(default=True, doc="""
Whether to show the config menu.""")

Expand Down