Skip to content

Commit d471686

Browse files
committed
Added multiple demos.
1 parent 1ae483b commit d471686

26 files changed

+4234
-24201
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "ece55170-2df8-4765-a5b3-8ea3fb0ed288",
6+
"metadata": {},
7+
"source": [
8+
"# Area Range with Missing Points\n",
9+
"An area chart showing a gap in the data. By default, Highcharts treats ``null`` values (modeled as ``constants.EnforcedNull`` in Highcharts for Python) as missing data, and will allow for gaps in datasets."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"id": "f36d81fd-85d4-4717-b3e4-ee70512d070e",
15+
"metadata": {},
16+
"source": [
17+
"## Import Dependencies"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"id": "a8033a30-4d65-46e0-9fb0-09e80fd2aa81",
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"from highcharts_core.chart import Chart\n",
28+
"from highcharts_core.constants import EnforcedNull\n",
29+
"import requests"
30+
]
31+
},
32+
{
33+
"cell_type": "markdown",
34+
"id": "26d654c8-50ca-4d0a-8fe5-3026939ea48a",
35+
"metadata": {},
36+
"source": [
37+
"## Configure Options"
38+
]
39+
},
40+
{
41+
"cell_type": "code",
42+
"execution_count": null,
43+
"id": "e06df9fa-ce1b-459e-9d2b-737f44daa3ce",
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"options = {\n",
48+
" 'chart': {\n",
49+
" 'type': 'area'\n",
50+
" },\n",
51+
" 'title': {\n",
52+
" 'text': \"Born persons, by boys' name\"\n",
53+
" },\n",
54+
" 'subtitle': {\n",
55+
" 'text': '* Missing data for Yasin in 2019',\n",
56+
" 'align': 'right',\n",
57+
" 'verticalAlign': 'bottom'\n",
58+
" },\n",
59+
" 'legend': {\n",
60+
" 'layout': 'vertical',\n",
61+
" 'align': 'left',\n",
62+
" 'verticalAlign': 'top',\n",
63+
" 'x': 150,\n",
64+
" 'y': 60,\n",
65+
" 'floating': True,\n",
66+
" 'borderWidth': 1,\n",
67+
" 'backgroundColor': '#FFFFFF'\n",
68+
" },\n",
69+
" 'yAxis': {\n",
70+
" 'title': {\n",
71+
" 'text': 'Amount'\n",
72+
" }\n",
73+
" },\n",
74+
" 'plotOptions': {\n",
75+
" 'series': {\n",
76+
" 'pointStart': 2014\n",
77+
" },\n",
78+
" 'area': {\n",
79+
" 'fillOpacity': 0.5\n",
80+
" }\n",
81+
" },\n",
82+
" 'credits': {\n",
83+
" 'enabled': False\n",
84+
" },\n",
85+
" 'series': [{\n",
86+
" 'name': 'Arvid',\n",
87+
" 'data': [10, 9, 11, 11, 8, 13, 12, 14]\n",
88+
" }, {\n",
89+
" 'name': 'Yasin',\n",
90+
" 'data': [13, 9, 10, 10, 8, EnforcedNull, 8, 6]\n",
91+
" }]\n",
92+
"}"
93+
]
94+
},
95+
{
96+
"cell_type": "markdown",
97+
"id": "48067fda-fcfb-4512-87b5-ea7654a95cee",
98+
"metadata": {},
99+
"source": [
100+
"## Assemble and Display Chart"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"id": "f05d003c-a40f-4545-9a28-8f2e1c0f198e",
107+
"metadata": {
108+
"tags": []
109+
},
110+
"outputs": [],
111+
"source": [
112+
"chart = Chart.from_options(options)\n",
113+
"chart.display()"
114+
]
115+
},
116+
{
117+
"cell_type": "code",
118+
"execution_count": null,
119+
"id": "26e6a34f-3eda-44f6-9991-1a6174454858",
120+
"metadata": {},
121+
"outputs": [],
122+
"source": []
123+
}
124+
],
125+
"metadata": {
126+
"kernelspec": {
127+
"display_name": "Python 3 (ipykernel)",
128+
"language": "python",
129+
"name": "python3"
130+
},
131+
"language_info": {
132+
"codemirror_mode": {
133+
"name": "ipython",
134+
"version": 3
135+
},
136+
"file_extension": ".py",
137+
"mimetype": "text/x-python",
138+
"name": "python",
139+
"nbconvert_exporter": "python",
140+
"pygments_lexer": "ipython3",
141+
"version": "3.10.5"
142+
}
143+
},
144+
"nbformat": 4,
145+
"nbformat_minor": 5
146+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "0e8dd158-ee17-4d09-af9f-7063befe8c85",
6+
"metadata": {},
7+
"source": [
8+
"# Stacked Area Chart\n",
9+
"A demo showing a stacked area chart, also sometimes referred to as a mountain chart. In a stacked chart, the data series values are added together to make up a total."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"id": "53867965-78f2-4fb9-b970-df942a8e81ba",
15+
"metadata": {},
16+
"source": [
17+
"## Import Dependencies"
18+
]
19+
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"id": "0afd1804-2196-4b8d-9585-42ede12d7a3f",
24+
"metadata": {},
25+
"outputs": [],
26+
"source": [
27+
"from highcharts_core.chart import Chart"
28+
]
29+
},
30+
{
31+
"cell_type": "markdown",
32+
"id": "9b434d45-a9f7-4068-a598-b9c26fd14aca",
33+
"metadata": {},
34+
"source": [
35+
"## Configure Options and Series"
36+
]
37+
},
38+
{
39+
"cell_type": "code",
40+
"execution_count": null,
41+
"id": "061bc5eb-ddc2-4268-ac1d-62f05fafddf8",
42+
"metadata": {},
43+
"outputs": [],
44+
"source": [
45+
"options = {\n",
46+
" 'chart': {\n",
47+
" 'type': 'area'\n",
48+
" },\n",
49+
" 'title': {\n",
50+
" 'text': 'Greenhouse gases from Norwegian economic activity',\n",
51+
" 'align': 'left'\n",
52+
" },\n",
53+
" 'subtitle': {\n",
54+
" 'text': \"\"\"Source: <a href=\"https://www.ssb.no/en/statbank/table/09288/\" target=\"_blank\">SSB</a>\"\"\",\n",
55+
" 'align': 'left'\n",
56+
" },\n",
57+
" 'yAxis': {\n",
58+
" 'title': {\n",
59+
" 'useHTML': True,\n",
60+
" 'text': 'Million tonnes CO<sub>2</sub>-equivalents'\n",
61+
" }\n",
62+
" },\n",
63+
" 'tooltip': {\n",
64+
" 'shared': True,\n",
65+
" 'headerFormat': '<span style=\"font-size:12px\"><b>{point.key}</b></span><br>'\n",
66+
" },\n",
67+
" 'plotOptions': {\n",
68+
" 'series': {\n",
69+
" 'pointStart': 2012\n",
70+
" },\n",
71+
" 'area': {\n",
72+
" 'stacking': 'normal',\n",
73+
" 'lineColor': '#666666',\n",
74+
" 'lineWidth': 1,\n",
75+
" 'marker': {\n",
76+
" 'lineWidth': 1,\n",
77+
" 'lineColor': '#666666'\n",
78+
" }\n",
79+
" }\n",
80+
" },\n",
81+
" 'series': [{\n",
82+
" 'name': 'Ocean transport',\n",
83+
" 'data': [13234, 12729, 11533, 17798, 10398, 12811, 15483, 16196, 16214]\n",
84+
" }, {\n",
85+
" 'name': 'Households',\n",
86+
" 'data': [6685, 6535, 6389, 6384, 6251, 5725, 5631, 5047, 5039]\n",
87+
"\n",
88+
" }, {\n",
89+
" 'name': 'Agriculture and hunting',\n",
90+
" 'data': [4752, 4820, 4877, 4925, 5006, 4976, 4946, 4911, 4913]\n",
91+
" }, {\n",
92+
" 'name': 'Air transport',\n",
93+
" 'data': [3164, 3541, 3898, 4115, 3388, 3569, 3887, 4593, 1550]\n",
94+
"\n",
95+
" }, {\n",
96+
" 'name': 'Construction',\n",
97+
" 'data': [2019, 2189, 2150, 2217, 2175, 2257, 2344, 2176, 2186]\n",
98+
" }]\n",
99+
"}"
100+
]
101+
},
102+
{
103+
"cell_type": "markdown",
104+
"id": "d8d8d111-f770-4734-a81b-d9629e981706",
105+
"metadata": {},
106+
"source": [
107+
"## Assemble and Display Chart"
108+
]
109+
},
110+
{
111+
"cell_type": "code",
112+
"execution_count": null,
113+
"id": "74baf4b3-b080-49a3-9ef4-73edbecbb599",
114+
"metadata": {
115+
"tags": []
116+
},
117+
"outputs": [],
118+
"source": [
119+
"chart = Chart.from_options(options)\n",
120+
"chart.display()"
121+
]
122+
}
123+
],
124+
"metadata": {
125+
"kernelspec": {
126+
"display_name": "Python 3 (ipykernel)",
127+
"language": "python",
128+
"name": "python3"
129+
},
130+
"language_info": {
131+
"codemirror_mode": {
132+
"name": "ipython",
133+
"version": 3
134+
},
135+
"file_extension": ".py",
136+
"mimetype": "text/x-python",
137+
"name": "python",
138+
"nbconvert_exporter": "python",
139+
"pygments_lexer": "ipython3",
140+
"version": "3.10.5"
141+
}
142+
},
143+
"nbformat": 4,
144+
"nbformat_minor": 5
145+
}

0 commit comments

Comments
 (0)