panel-extensions / panel-graphic-walker

A project providing a Graphic Walker Pane for use with HoloViz Panel.
13 stars 2 forks source link

✨ Welcome to Panel Graphic Walker

License py.cafe

A simple way to explore your data through a Tableau-like interface directly in your Panel data applications.

panel-graphic-walker-plot

What is Panel Graphic Walker?

panel-graphic-walker brings the power of Graphic Walker to your data science workflow, seamlessly integrating interactive data exploration into notebooks and Panel applications. Effortlessly create dynamic visualizations, analyze datasets, and build dashboards—all within a Pythonic, intuitive interface.

Why choose Panel Graphic Walker?

Pin your version!

This project is in early stages, so if you find a version that suits your needs, it’s recommended to pin your version, as updates may introduce changes.

Installation

Install panel-graphic-walker via pip:

pip install panel-graphic-walker

Usage

Basic Graphic Walker Pane

py.cafe

Here’s an example of how to create a simple GraphicWalker pane:

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)

GraphicWalker(df).servable()

panel-graphic-walker-table panel-graphic-walker-plot

Configuring Fields

py.cafe

You may also configure the fields (data columns) manually:

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)

fields = [
    {
        "fid": "t_county",
        "name": "t_county",
        "semanticType": "nominal",
        "analyticType": "dimension",
    },
    {
        "fid": "t_model",
        "name": "t_model",
        "semanticType": "nominal",
        "analyticType": "dimension",
    },
    {
        "fid": "t_cap",
        "name": "t_cap",
        "semanticType": "quantitative",
        "analyticType": "measure",
    },
]

GraphicWalker(df, fields=fields).servable()

You can get the full list of fields via GraphicWalker(df).calculated_fields().

Configuring the Appearance

py.cafe

By default, the appearance is determined by the value of pn.config.theme. However, you can manually change this, for example, to dark or media. media corresponds to the user's preference as set in the browser.

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv(
    "https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000
)

GraphicWalker(df, appearance="media").servable()

Additional Configuration

py.cafe

Extra configuration options are available via the Graphic Walker API. For instance, you can change the language to Japanese:

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv(
    "https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000
)

config = {
   "i18nLang": "ja-JP"
}

GraphicWalker(df, config=config).servable()

Export the Chart(s)

py.cafe

You can export the current chart(s) from the client to the server by running the asynchronous export method:

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)

walker = GraphicWalker(df)
exported = pn.pane.JSON(depth=3)

async def export(_):
    exported.object = await walker.export()

pn.Column(
    walker,
    pn.Row(
        pn.widgets.ButtonIcon(icon="download", on_click=export, active_icon='check', toggle_duration=1000),
        exported,
    )
).servable()

Scale with Server-Side Computation

py.cafe

In some environments you may meet message or client side data limits. To handle larger datasets, you can offload the computation to the server.

First you will need to install extra dependencies:

pip install panel-graphic-walker[server]

Then you can use server side computation with server_computation=True:

import pandas as pd
import panel as pn

from panel_gwalker import GraphicWalker

pn.extension()

df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz")

# Enable server-side computation for scalable data processing
walker = GraphicWalker(df, server_computation=True)

pn.Column(
    walker,
    walker.param.server_computation,
).servable()

This setup allows your application to manage larger datasets efficiently by leveraging server resources for data processing.

Please note that if running on Pyodide the computations will always take place on the client.

App Demo

py.cafe Static Badge

Panel Graphic Walker App Demo

API

Parameters

Core

Style

Other

Methods

Vision

Our dream is that this package is super simple to use and supports your use cases:

❤️ Contributions

Contributions and co-maintainers are very welcome! Please submit issues or pull requests to the GitHub repository. Check out the DEVELOPER_GUIDE for more information.