|
1 | 1 | # Highcharts for Python Demos
|
2 |
| -This is a collection of demonstrations of the Highcharts for Python toolkit. |
3 |
| -Fundamentally, they are a Python port of the fantastic demos that Highsoft has |
4 |
| -already published for their |
5 |
| -[Highcharts JavaScript library](https://www.highcharts.com/demo). |
| 2 | +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](https://www.highcharts.com/demo). |
| 3 | + |
| 4 | +## Overview |
| 5 | + |
| 6 | +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: |
| 7 | + |
| 8 | + * **Direct instantiation**. They create Python instances of objects using Python constructors like ``LineSeries(...)`` directly. |
| 9 | + * ``.from_js_literal()``. They create ``HighchartsOptions`` instances by taking a string of a JS literal option configuration using the ``.from_js_literal()`` method. |
| 10 | + * ``.from_dict()``. They create Python instances using the Highcharts for Python ``.from_dict()`` convenience method. |
| 11 | + * other demo-specific techniques, which may vary from demo to demo |
| 12 | + |
| 13 | +Each demo ultimately demonstrates one or more visualizations using one of the techniques mentioned above. The basic pattern we use is to: |
| 14 | + |
| 15 | + 1. Import the needed dependencies. |
| 16 | + 2. Assemble the options. |
| 17 | + 3. Assemble the chart. |
| 18 | + 4. Visualize the chart. |
| 19 | + |
| 20 | +**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.** |
6 | 21 |
|
7 | 22 | ## How to Use the Demos
|
8 |
| -First, clone this Github repo: |
9 | 23 |
|
10 |
| -``` |
11 |
| -$ git clone [email protected]:highcharts-for-python/highcharts-for-python-demos.git |
12 |
| -``` |
| 24 | +### Organization |
| 25 | +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. |
| 26 | + |
| 27 | +The repository is organized into folders for each of the Highcharts for Python libraries: |
| 28 | + |
| 29 | + * ``highcharts-core`` contains demos of the [Highcharts Core for Python](https://core-docs.highchartspython.com) library |
| 30 | + * ``highcharts-stock`` contains demos of the [Highcharts Stock for Python](https://stock-docs.highchartspython.com) library |
| 31 | + * ``highcharts-maps`` contains demos of the [Highcharts Maps for Python](https://maps-docs.highchartspython.com) library |
| 32 | + * ``highcharts-gantt`` contains demos of the [Highcharts Gantt for Python](https://gantt-docs.highchartspython.com) library |
| 33 | + |
| 34 | +Within each of these folders, you will find sub-folders grouping demos into a particular category. For example: |
| 35 | + |
| 36 | + * the ``highcharts-core/line-charts`` folder contains Jupyter Notebooks which demonstrate different line chart functionality. |
| 37 | + * the ``highcharts-core/python-features`` folder contains Notebooks which demonstrate some Python-specific features |
| 38 | + |
| 39 | +### Using the Demos via MyBinder.org |
| 40 | + |
| 41 | +The easy way to use or review the demos is to launch a MyBinder session using the following buttton: [](https://mybinder.org/v2/gh/highcharts-for-python/highcharts-for-python-demos/HEAD) |
| 42 | + |
| 43 | +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. |
| 44 | + |
| 45 | +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``. |
| 46 | + |
| 47 | +Then just run the Notebook, and you should see the results. |
| 48 | + |
| 49 | +### Using the Demos Locally |
| 50 | +To use the demos locally, you need to take several additional steps: |
| 51 | + |
| 52 | +1. First, clone this Github repo: |
| 53 | + |
| 54 | + ``` |
| 55 | + $ git clone [email protected]:highcharts-for-python/highcharts-for-python-demos.git |
| 56 | + ``` |
| 57 | +
|
| 58 | +2. Next, navigate to its directory: |
| 59 | +
|
| 60 | + ``` |
| 61 | + $ cd highcharts-for-python-demos |
| 62 | +
|
| 63 | + highcharts-for-python-demos/ (master) |
| 64 | + $ |
| 65 | + ```` |
| 66 | +
|
| 67 | +3. Create a virtual environment: |
| 68 | +
|
| 69 | + ``` |
| 70 | + highcharts-for-python-demos/ (master) |
| 71 | + $ python -m venv .venv |
| 72 | + ``` |
| 73 | +
|
| 74 | +4. Then activate your virtual environment: |
| 75 | +
|
| 76 | + ``` |
| 77 | + highcharts-for-python-demos/ (master) |
| 78 | + $ source .venv/Scripts/activate |
| 79 | +
|
| 80 | + (.venv) |
| 81 | + highcharts-for-python-demos/ (master) |
| 82 | + $ |
| 83 | + ``` |
| 84 | +
|
| 85 | +5. And install the requirements: |
| 86 | +
|
| 87 | + ``` |
| 88 | + (.venv) |
| 89 | + highcharts-for-python-demos/ (master) |
| 90 | + $ pip install -r requirements.txt |
| 91 | + ``` |
| 92 | +
|
| 93 | +6. And finally, open up Jupyter Lab: |
| 94 | +
|
| 95 | + ``` |
| 96 | + (.venv) |
| 97 | + highcharts-for-python-demos/ (master) |
| 98 | + $ jupyter-lab |
| 99 | + ``` |
| 100 | +
|
| 101 | +You should now see the set of notebooks included in the repo, along with relevant data files and other details. |
| 102 | +
|
| 103 | +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``. |
| 104 | +
|
| 105 | +Then just run the Notebook, and you should see the results. |
| 106 | +
|
| 107 | +## Contributing to the Demos |
| 108 | +
|
| 109 | +If you wish to contribute demos to this library: |
| 110 | +
|
| 111 | +1. First, clone this Github repo: |
| 112 | +
|
| 113 | + ``` |
| 114 | + $ git clone [email protected]:highcharts-for-python/highcharts-for-python-demos.git |
| 115 | + ``` |
| 116 | +
|
| 117 | +2. Next, navigate to its directory: |
| 118 | +
|
| 119 | + ``` |
| 120 | + $ cd highcharts-for-python-demos |
| 121 | +
|
| 122 | + highcharts-for-python-demos/ (master) |
| 123 | + $ |
| 124 | + ```` |
| 125 | +
|
| 126 | +3. Create a virtual environment: |
13 | 127 |
|
14 |
| -Next, navigate to its directory: |
| 128 | + ``` |
| 129 | + highcharts-for-python-demos/ (master) |
| 130 | + $ python -m venv .venv |
| 131 | + ``` |
15 | 132 |
|
16 |
| -``` |
17 |
| -$ cd highcharts-for-python-demos |
| 133 | +4. Activate your virtual environment: |
18 | 134 |
|
19 |
| -highcharts-for-python-demos/ (master) |
20 |
| -$ |
21 |
| -```` |
| 135 | + ``` |
| 136 | + highcharts-for-python-demos/ (master) |
| 137 | + $ source .venv/Scripts/activate |
22 | 138 |
|
23 |
| -Create a virtual environment: |
| 139 | + (.venv) |
| 140 | + highcharts-for-python-demos/ (master) |
| 141 | + $ |
| 142 | + ``` |
24 | 143 |
|
25 |
| -``` |
26 |
| -highcharts-for-python-demos/ (master) |
27 |
| -$ python -m venv .venv |
28 |
| -``` |
| 144 | +5. Install the requirements: |
29 | 145 |
|
30 |
| -Then activate your virtual environment: |
| 146 | + ``` |
| 147 | + (.venv) |
| 148 | + highcharts-for-python-demos/ (master) |
| 149 | + $ pip install -r requirements.txt |
| 150 | + ``` |
31 | 151 |
|
32 |
| -``` |
33 |
| -highcharts-for-python-demos/ (master) |
34 |
| -$ source .venv/Scripts/activate |
| 152 | +6. Install the pre-commit hook (which strips output from the Jupyter Notebooks on commit): |
35 | 153 |
|
36 |
| -(.venv) |
37 |
| -highcharts-for-python-demos/ (master) |
38 |
| -$ |
39 |
| -``` |
| 154 | + ``` |
| 155 | + (.venv) |
| 156 | + highcharts-for-python-demos/ (master) |
| 157 | + $ pre-commit install |
| 158 | + ``` |
40 | 159 |
|
41 |
| -and install the requirements: |
| 160 | +7. Create a new branch in your repo that you will use for your changes. |
42 | 161 |
|
43 |
| -``` |
44 |
| -(.venv) |
45 |
| -highcharts-for-python-demos/ (master) |
46 |
| -$ pip install -r requirements.txt |
47 |
| -``` |
| 162 | +8. Either edit the existing Jupyter Notebooks or add new ones using the basic conventions and pattern that you'll find in our other demos. |
48 | 163 |
|
49 |
| -And finally, open up Jupyter Lab: |
| 164 | +9. Commit your changes and push them to this Github repo. |
50 | 165 |
|
51 |
| -``` |
52 |
| -(.venv) |
53 |
| -highcharts-for-python-demos/ (master) |
54 |
| -$ jupyter-lab |
55 |
| -``` |
| 166 | +10. File a Pull Request to merge changes from your branch to the ``develop`` branch. |
56 | 167 |
|
57 |
| -You should now see the set of notebooks included in the repo, along with relevant data files and other details. Browse through the repo, and look at the demos that you want to see. It should be fairly self-explanatory! |
| 168 | +And that's it! Thank you for your contributions, they are much appreciated. |
0 commit comments