-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
step 4: rendering using pyecharts inside jupyter-notebook
- Loading branch information
Showing
1 changed file
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<script>\n", | ||
" require.config({\n", | ||
" paths: {\n", | ||
" 'echarts':'https://assets.pyecharts.org/assets/echarts.min', 'The Forbidden City':'http://localhost:8000///The-Forbidden-City'\n", | ||
" }\n", | ||
" });\n", | ||
"</script>\n", | ||
"\n", | ||
" <div id=\"971d0ce5a7e746fd82ce6e2fc3120cd5\" style=\"width:900px; height:500px;\"></div>\n", | ||
"\n", | ||
"\n", | ||
"<script>\n", | ||
" require(['echarts', 'The Forbidden City'], function(echarts) {\n", | ||
" var chart_971d0ce5a7e746fd82ce6e2fc3120cd5 = echarts.init(\n", | ||
" document.getElementById('971d0ce5a7e746fd82ce6e2fc3120cd5'), 'white', {renderer: 'canvas'});\n", | ||
" var option_971d0ce5a7e746fd82ce6e2fc3120cd5 = {\n", | ||
" \"color\": [\n", | ||
" \"#c23531\",\n", | ||
" \"#2f4554\",\n", | ||
" \"#61a0a8\",\n", | ||
" \"#d48265\",\n", | ||
" \"#749f83\",\n", | ||
" \"#ca8622\",\n", | ||
" \"#bda29a\",\n", | ||
" \"#6e7074\",\n", | ||
" \"#546570\",\n", | ||
" \"#c4ccd3\",\n", | ||
" \"#f05b72\",\n", | ||
" \"#ef5b9c\",\n", | ||
" \"#f47920\",\n", | ||
" \"#905a3d\",\n", | ||
" \"#fab27b\",\n", | ||
" \"#2a5caa\",\n", | ||
" \"#444693\",\n", | ||
" \"#726930\",\n", | ||
" \"#b2d235\",\n", | ||
" \"#6d8346\",\n", | ||
" \"#ac6767\",\n", | ||
" \"#1d953f\",\n", | ||
" \"#6950a1\",\n", | ||
" \"#918597\"\n", | ||
" ],\n", | ||
" \"series\": [],\n", | ||
" \"legend\": [\n", | ||
" {\n", | ||
" \"data\": [],\n", | ||
" \"selected\": {},\n", | ||
" \"show\": true\n", | ||
" }\n", | ||
" ],\n", | ||
" \"tooltip\": {\n", | ||
" \"show\": true,\n", | ||
" \"trigger\": \"item\",\n", | ||
" \"triggerOn\": \"mousemove|click\",\n", | ||
" \"axisPointer\": {\n", | ||
" \"type\": \"line\"\n", | ||
" },\n", | ||
" \"formatter\": function (params) { return params.name + ' : ' + params.value[2]; },\n", | ||
" \"textStyle\": {\n", | ||
" \"fontSize\": 14\n", | ||
" },\n", | ||
" \"borderWidth\": 0\n", | ||
" },\n", | ||
" \"title\": [\n", | ||
" {\n", | ||
" \"text\": \"The Forbidden City in Beijing\"\n", | ||
" }\n", | ||
" ],\n", | ||
" \"geo\": {\n", | ||
" \"map\": \"The Forbidden City\",\n", | ||
" \"roam\": true,\n", | ||
" \"emphasis\": {}\n", | ||
" }\n", | ||
"};\n", | ||
" chart_971d0ce5a7e746fd82ce6e2fc3120cd5.setOption(option_971d0ce5a7e746fd82ce6e2fc3120cd5);\n", | ||
" });\n", | ||
"</script>\n" | ||
], | ||
"text/plain": [ | ||
"<pyecharts.render.display.HTML at 0x10dd9cfd0>" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"from pyecharts import options as opts\n", | ||
"from pyecharts.charts import Geo\n", | ||
"from pyecharts.datasets import register_url\n", | ||
"\n", | ||
"register_url(\"http://127.0.0.1:8000\")\n", | ||
"\n", | ||
"g = (\n", | ||
" Geo()\n", | ||
" .add_schema(maptype=\"The Forbidden City\")\n", | ||
" .set_global_opts(\n", | ||
" title_opts=opts.TitleOpts(title=\"The Forbidden City in Beijing\"),\n", | ||
" )\n", | ||
")\n", | ||
"g.render_notebook()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.7.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |