Skip to main content

A Jupyter Widget for Visa Chart Components

Project description

pyvisacharts

This package wraps @visa/charts web components for use in Python and jupyter notebooks, leveraging the widget-cookiecutter Python package. You can find pyvisacharts on pypi, installation steps provided below.


Installation Steps

  • Using pip:
    $ pip install pyvisacharts
    
  • or conda:
    $ conda install -c conda-forge pyvisacharts
    

Components with Ready status in this bundle

# Use VCC as Python functions


Step 1: Install:

$ pip install pyvisacharts

Step 2: Use component as any other Python function

import pyvisacharts as vcc
import pandas as pd

bar_chart_data = pd.read_json("https://raw.githubusercontent.com/visa/visa-chart-components/main/packages/charts-python/docs/demo_data/bar_chart_data.json")
line_chart_data = pd.read_json("https://raw.githubusercontent.com/visa/visa-chart-components/main/packages/charts-python/docs/demo_data/line_chart_data.json")

vcc.BarChart(
    accessibility={
        "purpose": "Demonstration of a bar chart built with VCC and minimal properties provided.",
        "statisticalNotes": "This chart is using dummy data."
    },
    data=bar_chart_data,
    ordinalAccessor="item",
    valueAccessor="value"
)

vcc.LineChart(
    accessibility={
        "purpose": "Demonstration of a line chart built with VCC and minimal properties provided.",
        "statisticalNotes": "This chart is using dummy data."
    },
    data=line_chart_data, # a pandas data frame
    ordinalAccessor="date",
    valueAccessor="value",
    seriesAccessor="category",
    config={
        "hoverOpacity": 0.25
    }
)

See our VCC Demo Notebook for more examples.


Development Steps

To the python widget locally, you will need to follow the below installation and build steps to symlink the necessary packages across the monorepo.

    $ yarn
    $ yarn dev --i
    $ yarn dev --b
    $ yarn dev --ipy
    $ yarn dev --spy (spins up a local jupyter notebook)
    or
    $ yarn dev --lpy (spins up a local jupyter lab)

After running these commands, the js lib @visa/charts will by symlink'd and a jupyter notebook will be spun up locally for development and testing work. If you update the js build and/or python code you will likely need to restart/refresh the juptyer notebook to see development changes reflected.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyvisacharts-1.0.0.tar.gz (2.1 MB view hashes)

Uploaded Source

Built Distribution

pyvisacharts-1.0.0-py2.py3-none-any.whl (2.8 MB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page