Jelajahi Sumber

feat: add `pyg2plot` in data visualization

wangweimin 4 tahun lalu
induk
melakukan
a887eb311c

+ 2 - 1
demos/__main__.py

@@ -27,7 +27,8 @@ PyWebIO supports for data visualization with the third-party libraries.
 
  - Use `bokeh` for data visualization [**demos**]({charts_demo_host}/?app=bokeh)
  - Use `plotly` for data visualization [**demos**]({charts_demo_host}/?app=plotly)
- - Use `pyecharts` for data visualization [**demos**]({charts_demo_host}/?app=pyecharts)
+ - Use `pyecharts` to create Echarts-based charts in Python [**demos**]({charts_demo_host}/?app=pyecharts)
+ - Use `pyg2plot` to create G2Plot-based charts in Python [**demos**]({charts_demo_host}/?app=pyg2plot)
  - Use `cutecharts.py` to create hand drawing style charts [**demos**]({charts_demo_host}/?app=cutecharts)
 
 **Screenshots**

+ 12 - 0
docs/libraries_support.rst

@@ -95,6 +95,18 @@ See related demo on :charts_demo_host:`plotly demo </?app=plotly>`
 
 .. image:: https://cdn.jsdelivr.net/gh/wang0618/pywebio-chart-gallery@master/assets/plotly.png
 
+pyg2plot
+^^^^^^^^^^^^^^^^^^^^^^
+
+`pyg2plot <https://github.com/hustcc/PyG2Plot>`_ is a python plotting library which uses `G2Plot <https://github.com/antvis/G2Plot>`_ as underlying implementation.
+
+In PyWebIO, you can use the following code to output the pyg2plot chart instance::
+
+    # `chart` is pyg2plot chart instance
+    pywebio.output.put_html(chart.render_notebook())
+
+See related demo on :charts_demo_host:`plotly demo </?app=pyg2plot>`
+
 cutecharts.py
 ^^^^^^^^^^^^^^^^^^^^^^
 

+ 95 - 60
docs/locales/zh_CN/LC_MESSAGES/libraries_support.po

@@ -7,16 +7,17 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PyWebIO 1.1.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2021-03-14 21:46+0800\n"
-"PO-Revision-Date: 2021-03-14 21:45+0800\n"
+"POT-Creation-Date: 2021-03-14 23:25+0800\n"
+"PO-Revision-Date: 2021-03-14 23:27+0800\n"
 "Last-Translator: WangWeimin <wang0.618@qq.com>\n"
 "Language: zh_CN\n"
 "Language-Team: \n"
-"Plural-Forms: nplurals=1; plural=0\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 2.8.0\n"
+"X-Generator: Poedit 2.4.2\n"
 
 #: ../../libraries_support.rst:2
 msgid "Libraries support"
@@ -28,18 +29,18 @@ msgstr "构建stand-alone App"
 
 #: ../../libraries_support.rst:6
 msgid ""
-"`PyInstaller <https://pyinstaller.readthedocs.io/en/stable/>`_ bundles a "
-"Python application and all its dependencies into a folder or executable. "
-"The user can run the packaged app without installing a Python interpreter"
-" or any modules."
+"`PyInstaller <https://pyinstaller.readthedocs.io/en/stable/>`_ bundles a Python "
+"application and all its dependencies into a folder or executable. The user can "
+"run the packaged app without installing a Python interpreter or any modules."
 msgstr ""
-"`PyInstaller <https://pyinstaller.readthedocs.io/en/stable/>`_  "
-"用于将一个Python应用及其依赖打包到文件夹或可执行文件中,用户可以在不安装Python解释器以及任何模块的情况下运行打包后的应用程序。"
+"`PyInstaller <https://pyinstaller.readthedocs.io/en/stable/>`_  用于将一个Python"
+"应用及其依赖打包到文件夹或可执行文件中,用户可以在不安装Python解释器以及任何模块"
+"的情况下运行打包后的应用程序。"
 
 #: ../../libraries_support.rst:8
 msgid ""
-"You can use PyInstaller to packages PyWebIO application into a stand-"
-"alone executable or folder:"
+"You can use PyInstaller to packages PyWebIO application into a stand-alone "
+"executable or folder:"
 msgstr "可以使用PyInstaller来将PyWebIO应用打包成一个单独的可执行文件或文件夹:"
 
 #: ../../libraries_support.rst:10
@@ -70,8 +71,7 @@ msgstr ""
 
 #: ../../libraries_support.rst:25
 msgid ""
-"Build the application by passing the spec file to the pyinstaller "
-"command::"
+"Build the application by passing the spec file to the pyinstaller command::"
 msgstr "使用spec文件来构建可执行文件::"
 
 #: ../../libraries_support.rst:27
@@ -80,14 +80,16 @@ msgstr ""
 
 #: ../../libraries_support.rst:30
 msgid ""
-"If you want to create a one-file bundled executable, you need pass "
-"``--onefile`` option in first step."
-msgstr "如果你希望生成一个单独的可执行文件而不是文件夹,你需要在第一步时传入 ``—onefile`` 选项。"
+"If you want to create a one-file bundled executable, you need pass ``--"
+"onefile`` option in first step."
+msgstr ""
+"如果你希望生成一个单独的可执行文件而不是文件夹,你需要在第一步时传入 ``—"
+"onefile`` 选项。"
 
 #: ../../libraries_support.rst:32
 msgid ""
-"For more information, please visit: "
-"https://pyinstaller.readthedocs.io/en/stable/spec-files.html"
+"For more information, please visit: https://pyinstaller.readthedocs.io/en/"
+"stable/spec-files.html"
 msgstr ""
 "更多PyInstaller用法请见: https://pyinstaller.readthedocs.io/en/stable/spec-"
 "files.html"
@@ -106,20 +108,21 @@ msgstr ""
 
 #: ../../libraries_support.rst:44
 msgid ""
-"`Bokeh <https://github.com/bokeh/bokeh>`_ is an interactive visualization"
-" library for modern web browsers. It provides elegant, concise "
-"construction of versatile graphics, and affords high-performance "
-"interactivity over large or streaming datasets."
-msgstr "`Bokeh <https://github.com/bokeh/bokeh>`_ 是一个支持创建实时交互的数据可视化库。"
+"`Bokeh <https://github.com/bokeh/bokeh>`_ is an interactive visualization "
+"library for modern web browsers. It provides elegant, concise construction of "
+"versatile graphics, and affords high-performance interactivity over large or "
+"streaming datasets."
+msgstr ""
+"`Bokeh <https://github.com/bokeh/bokeh>`_ 是一个支持创建实时交互的数据可视化库。"
 
 #: ../../libraries_support.rst:46
 msgid ""
 "You can use ``bokeh.io.output_notebook(notebook_type='pywebio')`` in the "
-"PyWebIO session to setup Bokeh environment. Then you can use "
-"``bokeh.io.show()`` to output a boken chart::"
+"PyWebIO session to setup Bokeh environment. Then you can use ``bokeh.io."
+"show()`` to output a boken chart::"
 msgstr ""
-"在 PyWebIO 会话中调用 ``bokeh.io.output_notebook(notebook_type='pywebio')`` "
-"来设置Bokeh输出到PyWebIO::"
+"在 PyWebIO 会话中调用 ``bokeh.io.output_notebook(notebook_type='pywebio')`` 来设"
+"置Bokeh输出到PyWebIO::"
 
 #: ../../libraries_support.rst:49
 msgid ""
@@ -139,23 +142,24 @@ msgstr "相应demo见 :charts_demo_host:`bokeh demo </?app=bokeh>`"
 #: ../../libraries_support.rst:59
 msgid ""
 "In addition to creating ordinary charts, Bokeh can also build the Bokeh "
-"applications by starting the `Bokeh server "
-"<https://docs.bokeh.org/en/latest/docs/user_guide/server.html>`_. The "
-"purpose of the Bokeh server is to make it easy for Python users to create"
-" interactive web applications that can connect front-end UI events to "
-"real, running Python code."
+"applications by starting the `Bokeh server <https://docs.bokeh.org/en/latest/"
+"docs/user_guide/server.html>`_. The purpose of the Bokeh server is to make it "
+"easy for Python users to create interactive web applications that can connect "
+"front-end UI events to real, running Python code."
 msgstr ""
-"除了创建普通图表,Bokeh还可以通过启动Bokeh server来显示Bokeh app,Bokeh "
-"app支持向图表的添加按钮、输入框等交互组件,并向组件注册Python回调,从而创建可以与Python代码交互的图表。"
+"除了创建普通图表,Bokeh还可以通过启动Bokeh server来显示Bokeh app,Bokeh app支持"
+"向图表的添加按钮、输入框等交互组件,并向组件注册Python回调,从而创建可以与Python"
+"代码交互的图表。"
 
 #: ../../libraries_support.rst:61
 msgid ""
-"In PyWebIO, you can also use ``bokeh.io.show()`` to display a Bokeh App. "
-"For the example, see `bokeh_app.py "
-"<https://github.com/wang0618/PyWebIO/blob/dev/demos/bokeh_app.py>`_."
+"In PyWebIO, you can also use ``bokeh.io.show()`` to display a Bokeh App. For "
+"the example, see `bokeh_app.py <https://github.com/wang0618/PyWebIO/blob/dev/"
+"demos/bokeh_app.py>`_."
 msgstr ""
-"在PyWebIO中,你也可以使用 ``bokeh.io.show()`` 来显示一个Bokeh App,代码示例见 `bokeh_app.py "
-"<https://github.com/wang0618/PyWebIO/blob/master/demos/bokeh_app.py>`_。"
+"在PyWebIO中,你也可以使用 ``bokeh.io.show()`` 来显示一个Bokeh App,代码示例见 "
+"`bokeh_app.py <https://github.com/wang0618/PyWebIO/blob/master/demos/bokeh_app."
+"py>`_。"
 
 #: ../../libraries_support.rst:63
 msgid "Bokeh App currently is only available in the default Tornado backend"
@@ -167,9 +171,9 @@ msgstr ""
 
 #: ../../libraries_support.rst:70
 msgid ""
-"`pyecharts <https://github.com/pyecharts/pyecharts>`_  is a python "
-"plotting library which uses `Echarts "
-"<https://github.com/ecomfe/echarts>`_ as underlying implementation."
+"`pyecharts <https://github.com/pyecharts/pyecharts>`_  is a python plotting "
+"library which uses `Echarts <https://github.com/ecomfe/echarts>`_ as underlying "
+"implementation."
 msgstr ""
 "`pyecharts <https://github.com/pyecharts/pyecharts>`_ 是一个使用Python创建 "
 "`Echarts <https://github.com/ecomfe/echarts>`_ 可视化图表的库。"
@@ -179,8 +183,8 @@ msgid ""
 "In PyWebIO, you can use the following code to output the pyecharts chart "
 "instance::"
 msgstr ""
-"在 PyWebIO 中使用 `put_html() <pywebio.output.put_html>` 可以输出 pyecharts "
-"库创建的图表::"
+"在 PyWebIO 中使用 `put_html() <pywebio.output.put_html>` 可以输出 pyecharts 库创"
+"建的图表::"
 
 #: ../../libraries_support.rst:74
 msgid ""
@@ -198,16 +202,15 @@ msgstr ""
 
 #: ../../libraries_support.rst:86
 msgid ""
-"`plotly.py <https://github.com/plotly/plotly.py>`_ is an interactive, "
-"open-source, and browser-based graphing library for Python."
+"`plotly.py <https://github.com/plotly/plotly.py>`_ is an interactive, open-"
+"source, and browser-based graphing library for Python."
 msgstr ""
-"`plotly.py <https://github.com/plotly/plotly.py>`_ "
-"是一个非常流行的Python数据可视化库,可以生成高质量的交互式图表。"
+"`plotly.py <https://github.com/plotly/plotly.py>`_ 是一个非常流行的Python数据可"
+"视化库,可以生成高质量的交互式图表。"
 
 #: ../../libraries_support.rst:88
 msgid ""
-"In PyWebIO, you can use the following code to output the plotly chart "
-"instance::"
+"In PyWebIO, you can use the following code to output the plotly chart instance::"
 msgstr "PyWebIO 支持输出使用 plotly 库创建的图表。使用方式为在PyWebIO会话中调用::"
 
 #: ../../libraries_support.rst:90
@@ -222,33 +225,65 @@ msgid "See related demo on :charts_demo_host:`plotly demo </?app=plotly>`"
 msgstr "相应demo见 :charts_demo_host:`plotly demo </?app=plotly>`"
 
 #: ../../libraries_support.rst:99
-msgid "cutecharts.py"
+msgid "pyg2plot"
 msgstr ""
 
 #: ../../libraries_support.rst:101
 msgid ""
+"`pyg2plot <https://github.com/hustcc/PyG2Plot>`_ is a python plotting library "
+"which uses `G2Plot <https://github.com/antvis/G2Plot>`_ as underlying "
+"implementation."
+msgstr ""
+"`pyg2plot <https://github.com/hustcc/PyG2Plot>`_  是一个使用Python创建 `G2Plot "
+"<https://github.com/antvis/G2Plot>`_ 可视化图表的库。"
+
+#: ../../libraries_support.rst:103
+msgid ""
+"In PyWebIO, you can use the following code to output the pyg2plot chart "
+"instance::"
+msgstr ""
+"PyWebIO 支持输出使用 pyg2plot 库创建的图表。使用方式为在PyWebIO会话中调用::"
+
+#: ../../libraries_support.rst:105
+msgid ""
+"# `chart` is pyg2plot chart instance\n"
+"pywebio.output.put_html(chart.render_notebook())"
+msgstr ""
+"# `chart` 为 pyg2plot 图表实例\n"
+"pywebio.output.put_html(chart.render_notebook())"
+
+#: ../../libraries_support.rst:108
+msgid "See related demo on :charts_demo_host:`plotly demo </?app=pyg2plot>`"
+msgstr "相应demo见 :charts_demo_host: `plotly demo </?app=pyg2plot>`"
+
+#: ../../libraries_support.rst:111
+msgid "cutecharts.py"
+msgstr ""
+
+#: ../../libraries_support.rst:113
+msgid ""
 "`cutecharts.py <https://github.com/cutecharts/cutecharts.py>`_ is a hand "
-"drawing style charts library for Python which uses `chart.xkcd "
-"<https://github.com/timqian/chart.xkcd>`_ as underlying implementation."
+"drawing style charts library for Python which uses `chart.xkcd <https://github."
+"com/timqian/chart.xkcd>`_ as underlying implementation."
 msgstr ""
-"`cutecharts.py <https://github.com/cutecharts/cutecharts.py>`_ "
-"是一个可以创建具有卡通风格的可视化图表的python库。\n"
+"`cutecharts.py <https://github.com/cutecharts/cutecharts.py>`_ 是一个可以创建具"
+"有卡通风格的可视化图表的python库。\n"
 "底层使用了 `chart.xkcd <https://github.com/timqian/chart.xkcd>`_ Javascript库。"
 
-#: ../../libraries_support.rst:103
+#: ../../libraries_support.rst:115
 msgid ""
-"In PyWebIO, you can use the following code to output the cutecharts.py "
-"chart instance::"
+"In PyWebIO, you can use the following code to output the cutecharts.py chart "
+"instance::"
 msgstr ""
 "在 PyWebIO 中使用 `put_html() <pywebio.output.put_html>` 可以输出 cutecharts.py "
 "库创建的图表::"
 
-#: ../../libraries_support.rst:105
+#: ../../libraries_support.rst:117
 msgid ""
 "# `chart` is cutecharts chart instance\n"
 "pywebio.output.put_html(chart.render_notebook())"
 msgstr ""
 
-#: ../../libraries_support.rst:108
+#: ../../libraries_support.rst:120
 msgid "See related demo on :charts_demo_host:`cutecharts demo </?app=cutecharts>`"
 msgstr "相应demo见 :charts_demo_host:`cutecharts demo </?app=cutecharts>`"