This is a collection of demonstrations of the Highcharts for Python toolkit. Fundamentally, they are a Python port of the fantastic demos that Highsoft has already published for their Highcharts JavaScript library.
WARNING: The MyBinder service which we use to provide a convenient demo environment is having some major capacity and infrastructure issues as of April 27th, 2023, mentioned here and described in greater detail here. These issues may cause unstable behavior if trying to launch MyBinder with the demo repo. Hopefully, they will address their infrastructure issues soon. In the meantime, if you are having difficulty launching a binder, you can always use checkout the demo repo and run the demos locally in your environment as described below.
The demos showcase a variety of ways of working with Highcharts for Python to create and visualize data. Because Highcharts for Python provides multiple paths to create your visualizations, we have tried to showcase various methods. Some demos use:
- Direct instantiation. They create Python instances of objects using Python constructors like
LineSeries(...)
directly. .from_js_literal()
. They createHighchartsOptions
instances by taking a string of a JS literal option configuration using the.from_js_literal()
method..from_dict()
. They create Python instances using the Highcharts for Python.from_dict()
convenience method.- other demo-specific techniques, which may vary from demo to demo
Each demo ultimately demonstrates one or more visualizations using one of the techniques mentioned above. The basic pattern we use is to:
- Import the needed dependencies.
- Assemble the options.
- Assemble the chart.
- Visualize the chart.
NOTE!! The demos in this repository are a work in progress, and various demos will be added over time. Please check back periodically to see if new demos have been added.
The demos are organized in Jupyter Notebooks, which make it easy to follow how they work, see their results in action, and experiment with them as needed.
The repository is organized into folders for each of the Highcharts for Python libraries:
highcharts-core
contains demos of the Highcharts Core for Python libraryhighcharts-stock
contains demos of the Highcharts Stock for Python libraryhighcharts-maps
contains demos of the Highcharts Maps for Python libraryhighcharts-gantt
contains demos of the Highcharts Gantt for Python library
Within each of these folders, you will find sub-folders grouping demos into a particular category. For example:
- the
highcharts-core/line-charts
folder contains Jupyter Notebooks which demonstrate different line chart functionality. - the
highcharts-core/python-features
folder contains Notebooks which demonstrate some Python-specific features
SEE WARNING ABOVE related to the current MyBinder infrastructure/capacity/stability issues.
The easy way to use or review the demos is to launch a MyBinder session using the following buttton:
Once the MyBinder launches, you will find yourself in a Jupyter Lab environment within a Docker image. You'll have this full repository available to you, and you can navigate the folders to find the demo you want to run.
For example, to see how Highcharts Core for Python generates a basic line chart, you can open the Notebook at highcharts-core/line-charts/basic-line.ipynb
.
Then just run the Notebook, and you should see the results.
To use the demos locally, you need to take several additional steps:
-
First, clone this Github repo:
$ git clone [email protected]:highcharts-for-python/highcharts-for-python-demos.git
-
Next, navigate to its directory:
$ cd highcharts-for-python-demos highcharts-for-python-demos/ (master) $
-
Create a virtual environment:
highcharts-for-python-demos/ (master) $ python -m venv .venv
-
Then activate your virtual environment:
highcharts-for-python-demos/ (master) $ source .venv/Scripts/activate (.venv) highcharts-for-python-demos/ (master) $
-
And install the requirements:
(.venv) highcharts-for-python-demos/ (master) $ pip install -r requirements.txt
-
And finally, open up Jupyter Lab:
(.venv) highcharts-for-python-demos/ (master) $ jupyter-lab
You should now see the set of notebooks included in the repo, along with relevant data files and other details.
For example, to see how Highcharts Core for Python generates a basic line chart, you can open the Notebook at highcharts-core/line-charts/basic-line.ipynb
.
Then just run the Notebook, and you should see the results.
If you wish to contribute demos to this library:
-
First, clone this Github repo:
$ git clone [email protected]:highcharts-for-python/highcharts-for-python-demos.git
-
Next, navigate to its directory:
$ cd highcharts-for-python-demos highcharts-for-python-demos/ (master) $
-
Create a virtual environment:
highcharts-for-python-demos/ (master) $ python -m venv .venv
-
Activate your virtual environment:
highcharts-for-python-demos/ (master) $ source .venv/Scripts/activate (.venv) highcharts-for-python-demos/ (master) $
-
Install the requirements:
(.venv) highcharts-for-python-demos/ (master) $ pip install -r requirements.txt
-
Install the pre-commit hook (which strips output from the Jupyter Notebooks on commit):
(.venv) highcharts-for-python-demos/ (master) $ pre-commit install
-
Create a new branch in your repo that you will use for your changes.
-
Either edit the existing Jupyter Notebooks or add new ones using the basic conventions and pattern that you'll find in our other demos.
-
Commit your changes and push them to this Github repo.
-
File a Pull Request to merge changes from your branch to the
develop
branch.
And that's it! Thank you for your contributions, they are much appreciated.