Skip to content

Commit

Permalink
Merge pull request #295 from dannylee8/dannylee8-example-jupyternoteb…
Browse files Browse the repository at this point in the history
…ooks

Upload Jupyter notebooks with ipyvizzu examples
  • Loading branch information
veghdev authored Feb 25, 2024
2 parents 31c0c0b + 443c1a6 commit 1479b60
Show file tree
Hide file tree
Showing 10 changed files with 8,162 additions and 0 deletions.
460 changes: 460 additions & 0 deletions community/ChangeDimension.ipynb

Large diffs are not rendered by default.

906 changes: 906 additions & 0 deletions community/Compare.ipynb

Large diffs are not rendered by default.

848 changes: 848 additions & 0 deletions community/Distribute.ipynb

Large diffs are not rendered by default.

721 changes: 721 additions & 0 deletions community/DrillDown.ipynb

Large diffs are not rendered by default.

450 changes: 450 additions & 0 deletions community/Filter.ipynb

Large diffs are not rendered by default.

1,427 changes: 1,427 additions & 0 deletions community/Miscellaneous.ipynb

Large diffs are not rendered by default.

1,155 changes: 1,155 additions & 0 deletions community/PresetCharts.ipynb

Large diffs are not rendered by default.

442 changes: 442 additions & 0 deletions community/Split.ipynb

Large diffs are not rendered by default.

330 changes: 330 additions & 0 deletions community/StretchToProportion.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "ad10e05f-7087-499b-8b73-3e11583b4e81",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from ipyvizzu import Chart, Data, Config, Style\n",
"\n",
"# To setup:\n",
"# pip install jupyterlab\n",
"# mkdir ipyvizzu\n",
"# cd ipyvizzu\n",
"# pip install virtual env\n",
"# mkdir venv\n",
"# python -m venv venv\n",
"# .\\venv\\Scripts\\activate.bat\n",
"# validate (venv) is prefixing your prompt\n",
"# pip install pandas\n",
"# pip install pyarrow\n",
"# pip install ipyvizzu\n",
"# jupyter lab\n",
"#"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0e70d784-cea2-4b83-bcc2-168101ccaefd",
"metadata": {},
"outputs": [],
"source": [
"###( load dataset 1 )###\n",
"eu_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_eu = Data()\n",
"data_eu.add_df(eu_df)\n",
"\n",
"\n",
"###( load dataset 2 )###\n",
"eu_6_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu_data_6.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_eu_6 = Data()\n",
"data_eu_6.add_df(eu_6_df)\n",
"\n",
"\n",
"###( load dataset 3 )###\n",
"eu_3_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu_data_3.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_eu_3 = Data()\n",
"data_eu_3.add_df(eu_3_df)\n",
"\n",
"\n",
"###( load dataset 4 )###\n",
"eu_4_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu_data_4.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_eu_4 = Data()\n",
"data_eu_4.add_df(eu_4_df)\n",
"\n",
"\n",
"###( load dataset 8 )###\n",
"eu_8_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/chart_types_eu_data_8.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_eu_8 = Data()\n",
"data_eu_8.add_df(eu_8_df)\n",
"\n",
"\n",
"\n",
"###( load dataset Music Industry History - 1 )###\n",
"mih_1_df = pd.read_csv(\n",
" \"https://ipyvizzu.vizzuhq.com/0.17/assets/data/music_industry_history_1.csv\",\n",
" dtype={\n",
" \"Year\": str, \n",
" \"Timeseries\": str\n",
" },\n",
")\n",
"data_mih_1 = Data()\n",
"data_mih_1.add_df(mih_1_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cf63ee32-25ff-4b5c-aeee-962159dbaad6",
"metadata": {},
"outputs": [],
"source": [
"###( Stretch to proportion: Stacked Area )###\n",
"### https://ipyvizzu.vizzuhq.com/latest/examples/analytical_operations/stretch_to_proportion/area_stacked/\n",
"\n",
"chart = Chart()\n",
"chart.animate(data_eu_8)\n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": \"Year\",\n",
" \"y\": [\"Value 2 (+)\", \"Country\"],\n",
" \"color\": \"Country\",\n",
" },\n",
" \"geometry\": \"area\",\n",
" \"title\": \"Stretch to proportion: Stacked Area\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.animate(Config({\"align\": \"stretch\"}))\n",
" \n",
"chart.feature(\"tooltip\", True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "834e2045-0dc8-4e9f-8954-bf79ed99ce3b",
"metadata": {},
"outputs": [],
"source": [
"###( Stretch to proportion: Groupped Column )###\n",
"### https://ipyvizzu.vizzuhq.com/latest/examples/analytical_operations/stretch_to_proportion/column_groupped/\n",
"\n",
"chart = Chart()\n",
"chart.animate(data_eu_4)\n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": [\"Year\", \"Country\"],\n",
" \"y\": \"Value 2 (+)\",\n",
" \"color\": \"Country\",\n",
" },\n",
" \"title\": \"Stretch to proportion: Grouped Column\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": \"Year\",\n",
" \"y\": [\"Country\", \"Value 2 (+)\"],\n",
" },\n",
" \"align\": \"stretch\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.feature(\"tooltip\", True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ade3b02d-692f-4e92-b828-6a9d77d6fa23",
"metadata": {},
"outputs": [],
"source": [
"###( Stretch to proportion: Split Stacked Column )###\n",
"### https://ipyvizzu.vizzuhq.com/latest/examples/analytical_operations/stretch_to_proportion/column_split_stacked/\n",
"\n",
"chart = Chart()\n",
"chart.animate(data_eu_8)\n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": \"Year\",\n",
" \"y\": [\"Country\", \"Value 2 (+)\"],\n",
" \"color\": \"Country\",\n",
" \"label\": \"Value 2 (+)\",\n",
" },\n",
" \"split\": True,\n",
" \"title\": \"Stretch to proportion: Split Stacked Area\",\n",
" }\n",
" ),\n",
" Style(\n",
" {\n",
" \"plot\": {\n",
" \"marker\": {\n",
" \"label\": {\"position\": \"top\", \"fontSize\": \"0.6em\"}\n",
" }\n",
" }\n",
" }\n",
" ),\n",
")\n",
" \n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\"label\": None},\n",
" \"align\": \"stretch\",\n",
" \"split\": False,\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.feature(\"tooltip\", True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94852eb6-63cd-4866-baee-c2249f5bface",
"metadata": {},
"outputs": [],
"source": [
"###( Stretch to proportion: Stacked Column )###\n",
"### https://ipyvizzu.vizzuhq.com/latest/examples/analytical_operations/stretch_to_proportion/column_split_stacked/\n",
"\n",
"chart = Chart()\n",
"chart.animate(data_eu_8)\n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": \"Year\",\n",
" \"y\": [\"Country\", \"Value 2 (+)\"],\n",
" \"color\": \"Country\",\n",
" },\n",
" \"title\": \"Stretch to proportion: Stacked Column\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.animate(Config({\"align\": \"stretch\"}))\n",
" \n",
"chart.feature(\"tooltip\", True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7a432381-81c8-453b-8911-78a784da1639",
"metadata": {},
"outputs": [],
"source": [
"###( Stretch to proportion: Line )###\n",
"### https://ipyvizzu.vizzuhq.com/latest/examples/analytical_operations/stretch_to_proportion/line/\n",
"\n",
"chart = Chart()\n",
"chart.animate(data_eu_8)\n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\n",
" \"x\": \"Year\",\n",
" \"y\": \"Value 2 (+)\",\n",
" \"color\": \"Country\",\n",
" },\n",
" \"geometry\": \"line\",\n",
" \"title\": \"Stretch to proportion: Line\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.animate(\n",
" Config(\n",
" {\n",
" \"channels\": {\"y\": [\"Value 2 (+)\", \"Country\"]},\n",
" \"geometry\": \"area\",\n",
" \"align\": \"stretch\",\n",
" }\n",
" )\n",
")\n",
" \n",
"chart.feature(\"tooltip\", True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8af0b027-b99a-41c5-9f37-d7899a6c27cc",
"metadata": {},
"outputs": [],
"source": [
"###( END )###"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 1479b60

Please sign in to comment.