From 222f69a76b6ec34a1fb5fd79a53ac900e9eadfec Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 00:36:33 +0800 Subject: [PATCH 1/8] update documentation --- README.md | 19 ++- document/{ => en-us}/doc_django.md | 10 +- document/en-us/documentation.md | 34 +++-- document/zh-cn/doc_django.md | 192 +++++++++++++++++++++++++++++ document/zh-cn/doc_flask.md | 2 +- document/zh-cn/documentation.md | 72 ++++++++--- 6 files changed, 296 insertions(+), 33 deletions(-) rename document/{ => en-us}/doc_django.md (97%) create mode 100644 document/zh-cn/doc_django.md diff --git a/README.md b/README.md index 6f245385..358a4431 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ It will creat a file named render.html in the root directory, open file with you ![usage-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/usage-0.gif) + ## Working with pandas & numpy ```python import pandas as pd @@ -60,8 +61,24 @@ bar.render() ``` ![usage-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/usage-1.png) + +## working with Flask & Django +Flask +![flask-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/flask-0.gif) + +Django +![django-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/django-0.gif) + +* 中文文档 + * [Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_flask.md) + * [Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_django.md) +* English + * [Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_flask.md) + * [Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_django.md) + + ## Documentation -* [中文档案](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md) +* [中文文档](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md) * [English](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md) ## Author diff --git a/document/doc_django.md b/document/en-us/doc_django.md similarity index 97% rename from document/doc_django.md rename to document/en-us/doc_django.md index 1668fcc7..3d00fd14 100644 --- a/document/doc_django.md +++ b/document/en-us/doc_django.md @@ -9,7 +9,7 @@ gone through the tutorial at least. ```shell $ virtualenv --no-site-packages pyecharts-env $ source pyecharts-env/bin/activate -$ pip install django=1.11.4 +$ pip install django==1.11.4 $ pip install pyecharts ``` @@ -18,7 +18,7 @@ Although current dependencies of pyecharts include django, the tutorial is writt ## Step 1: create a mini django site and the actual visualization app ```shell -$ djangoadmin startproject myechartsite +$ django-admin startproject myechartsite ``` And start an app @@ -125,9 +125,9 @@ from django.template import loader def index(request): template = loader.get_template('myfirstvis/pyecharts.html') - context = { + context = { "myechart": line3d() - } + } return HttpResponse(template.render(context, request)) @@ -147,7 +147,7 @@ def line3d(): line3d = Line3D("3D 折线图示例", width=1200, height=600) line3d.add("", _data, is_visualmap=True, visual_range_color=range_color, visual_range=[0, 30], is_grid3D_rotate=True, grid3D_rotate_speed=180) - return line3d.render_embed() + return line3d.render_embed() ``` ## Step 4: Run it diff --git a/document/en-us/documentation.md b/document/en-us/documentation.md index 1ae98554..3e8cf92e 100644 --- a/document/en-us/documentation.md +++ b/document/en-us/documentation.md @@ -4,8 +4,8 @@ pyecharts is a library to generate charts using Echarts. It simply provides the [![Build Status](https://travis-ci.org/chenjiandongx/pyecharts.svg?branch=master)](https://travis-ci.org/chenjiandongx/pyecharts) -* [First-steps](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#First-steps) -* [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Global-options) +* [First-steps](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#First-steps) +* [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Global-options) * xyAxis:x, y axis in cartesian coordinate system(Line、Bar、Scatter、EffectScatter、Kline) * dataZoom:dataZoom components for zoom-in and zoom-out. With them, it is possible to magnify a small area, to see the overall picture or to stay away from scattered points(Line、Bar、Scatter、EffectScatter、Kline) * legend:legend component has different symbol, colour and name, and provide the interactive clicking functions to show or hide its associated data series. @@ -13,7 +13,7 @@ pyecharts is a library to generate charts using Echarts. It simply provides the * lineStyle:line style for Line、Polar、Radar、Graph、Parallel. * grid3D:gird3D components in cartesian coordinate system(Bar3D, Line3D, Scatter3D) * visualMap:It is a type of component for visual encoding, which maps the data to visual channels -* [Chart-types](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Chart-types) +* [Chart-types](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Chart-types) * Bar * Bar3D * EffectScatter @@ -34,9 +34,9 @@ pyecharts is a library to generate charts using Echarts. It simply provides the * Scatter * Scatter3D * WordCloud -* [Customize](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Customize) -* [Example](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Example) -* [About](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#About) +* [Customize](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Customize) +* [Example](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Example) +* [About](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#About) # First-steps @@ -198,7 +198,7 @@ The parameter a chart type initialize accept(the same to all the chart type) You may also use hexadecimal format, for example '#ccc'. * is_grid -> bool defalut -> False - It specifies whether to use the grid component. Detail [Customize](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Customize) + It specifies whether to use the grid component. Detail [Customize](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Customize) # Global-options **Sitting general configuration in```add()```** @@ -223,6 +223,12 @@ xyAxis:x, y axis in cartesian coordinate system(Line、Bar、Scatter、EffectS The minimun value of xaxis. * xaxis_max -> int/float The maximun value of xaxis. +* xaxis_type -> str + Type of xaxis + * 'value': Numerical axis, suitable for continuous data. + * 'category': Category axis, suitable for discrete category data. Data should only be set via data for this type. + * 'time': Time axis, suitable for continuous time series data. As compared to value axis,it has a better formatting for time and a different tick calculation method. For example,it decides to use month, week, day or hour for tick based on the range of span. + * 'log': Log axis, suitable for log data. * y_axis -> list yAxis data * yaxis_formatter -> str @@ -237,6 +243,12 @@ xyAxis:x, y axis in cartesian coordinate system(Line、Bar、Scatter、EffectS The minimun value of yaxis. * yaxis_max -> int/float The maximun value of yaxis. +* yaxis_type -> str + Type of yaxis + * 'value': Numerical axis, suitable for continuous data. + * 'category': Category axis, suitable for discrete category data. Data should only be set via data for this type. + * 'time': Time axis, suitable for continuous time series data. As compared to value axis,it has a better formatting for time and a different tick calculation method. For example,it decides to use month, week, day or hour for tick based on the range of span. + * 'log': Log axis, suitable for log data. * interval -> int The display interval of the axis scale label is valid in the category axis.By default, labels are displayed using labels that do not overlap the labels. Set to 0 to force all labels to be displayed and label is one by one if setting as 1; If 2, it will be one label separates from each other, and so on. @@ -557,7 +569,7 @@ bar3d.render() ``` ![bar3D-3](https://github.com/chenjiandongx/pyecharts/blob/master/images/bar3D-3.gif) -**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Global-options) +**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Global-options) ## EffectScatter @@ -1167,7 +1179,7 @@ line3d.render() ``` ![line3D-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/line3D-1.gif) -**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Global-options) +**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Global-options) ## Liquid > Liquid chart is usually used to represent data in percentage. @@ -1713,7 +1725,7 @@ radar.render() Scatter.add() signatures ```python -add(name, x_value, y_value, symbol_size=10, **kwargs) +add(name, x_axis, y_axis, symbol_size=10, **kwargs) ``` * name -> str Series name used for displaying in tooltip and filtering with legend,or updaing data and configuration with setOption. @@ -1792,7 +1804,7 @@ scatter3D.render() ``` ![scatter3D-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/scatter3D-0.gif) -**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/doc_en_US.md#Global-options) +**Tip:** more details aboutt gird3D,please refer to [Global-options](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/documentation.md#Global-options) ## WordCloud WordCloud.add() signatures diff --git a/document/zh-cn/doc_django.md b/document/zh-cn/doc_django.md new file mode 100644 index 00000000..789e0fa8 --- /dev/null +++ b/document/zh-cn/doc_django.md @@ -0,0 +1,192 @@ +# pyecharts + Django 使用指南 +> 本指南按照 Django [官方教程](https://docs.djangoproject.com/en/1.11/intro/tutorial01/),通过完成一个 Django 小项目来说明如何在 Django 中使用 pyecharts。如果对 Django 还不太熟悉的开发者,可仔细阅读官方提供的最新文档。 + + +## Step 0: 使用新的 virtualenv 环境 +建议开发者使用 1.11.4 版本的 Django + +```shell +$ virtualenv --no-site-packages pyecharts-env +$ source pyecharts-env/bin/activate +$ pip install django==1.11.4 +$ pip install pyecharts +``` + + +## Step 1: 新建一个 django 项目 + +```shell +$ django-admin startproject myechartsite +``` + +创建一个应用程序 + +```shell +$ python manage.py startapp myfirstvis +$ ls +db.sqlite3 manage.py myechartsite myfirstvis +``` + +在 `myechartsite/settings.py` 中注册应用程序 + +```python +# myechartsite/settings.py +... +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'myfirstvis' # <--- +] +... +``` + + +我们先编辑 urls.py.这文件在 Django 里的功能是把前段的 HTTP 需求和后台服务函数挂钩。在 Step3,我们再引入后端服务函数 + +```python +# myfirstvis/urls.py +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^$', views.index, name='index'), +] +``` + +在 `myechartsite/urls.py` 中新增 'myfirstvis.urls' + +```python +myechartsite/urls.py +from django.conf.urls import include, url +from django.contrib import admin + +urlpatterns = [ + url(r'^admin/', admin.site.urls), + url(r'myfirstvis/', include('myfirstvis.urls')) # <--- +] +``` + + +## Step 2: 为项目提供自己的模板 + +前面的步骤是按照 [tutorial part 1]([tutorials](https://docs.djangoproject.com/en/1.11/intro/tutorial01/),接下来我们跳到 [tutorial part 3](https://docs.djangoproject.com/en/1.11/intro/tutorial03/) + + +Linux/macos 系统 +```shell +$ mkdir templates/myfirstvis -p +``` + +Windows 系统 +在 myfirstvis 目录下,新建 templates/myfirstvis 子目录 + +myfirstvis 目录 +``` +─ myfirstvis + ├── admin.py + ├── apps.py + ├── __init__.py + ├── migrations + │   ├── __init__.py + ├── models.py + ├── templates + │   └── myfirstvis + │   └── pyecharts.html + ├── tests.py + ├── urls.py + └── views.py +``` +将下面 html 模板代码保存为 pyecharts.html,请确保 pyecharts.html 文件的绝对路径为 `/myfirstvis/templates/myfirstvis` + + +```html + + + + + + + ECharts + + + + + + + + + {{myechart|safe}} + + + +``` + + +## Step 3: 处理视图功能部分 + +将下列代码保存到 `myfirstvis/views.py` 中。 + + +```python +# myfirstvis/views.py +from __future__ import unicode_literals +from django.http import HttpResponse +from django.template import loader + + +def index(request): + template = loader.get_template('myfirstvis/pyecharts.html') + context = { + "myechart": line3d() + } + return HttpResponse(template.render(context, request)) + + +def line3d(): + from pyecharts import Line3D + + import math + _data = [] + for t in range(0, 25000): + _t = t / 1000 + x = (1 + 0.25 * math.cos(75 * _t)) * math.cos(_t) + y = (1 + 0.25 * math.cos(75 * _t)) * math.sin(_t) + z = _t + 2.0 * math.sin(75 * _t) + _data.append([x, y, z]) + range_color = ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', + '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'] + line3d = Line3D("3D line plot demo", width=1200, height=600) + line3d.add("", _data, is_visualmap=True, visual_range_color=range_color, visual_range=[0, 30], + is_grid3D_rotate=True, grid3D_rotate_speed=180) + return line3d.render_embed() +``` + +## Step 4: 运行项目 + +```shell +$ cd myechartsite +$ python manage.py runserver + +You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. +Run 'python manage.py migrate' to apply them. + +August 08, 2017 - 05:48:38 +Django version 1.11.4, using settings 'myechartsite.settings' +Starting development server at http://127.0.0.1:8000/ +Quit the server with CONTROL-C. +``` + +访问 http://localhost:8000/myfirstvis/,你就可以看到酷炫的 3D 图了 +![django-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/django-0.gif) + + +## 小结 + +看到了吧,只需要简单的几步就可以使用 pyecharts 创建可视化的图表。Django 官方教程需要七步的这里我们三步就搞定了。 + +具体文档可以参考 pyecharts/document 文件夹。 diff --git a/document/zh-cn/doc_flask.md b/document/zh-cn/doc_flask.md index e8bfe20f..28bd22c3 100644 --- a/document/zh-cn/doc_flask.md +++ b/document/zh-cn/doc_flask.md @@ -95,4 +95,4 @@ $ flask run ## 小结 -可以看到,在 Flask app 中加入 pyecharts 图表只需要简单的几个步骤而已,欢迎尝试个更多的图表类型。具体文档可以参考 ```pyecharts/document``` 文件夹。 +可以看到,在 Flask app 中加入 pyecharts 图表只需要简单的几个步骤而已,欢迎尝试更多的图表类型。具体文档可以参考 ```pyecharts/document``` 文件夹。 diff --git a/document/zh-cn/documentation.md b/document/zh-cn/documentation.md index 6fcbb015..becefef2 100644 --- a/document/zh-cn/documentation.md +++ b/document/zh-cn/documentation.md @@ -5,8 +5,8 @@ pyecharts 是一个用于生成 Echarts 图表的类库。实际上就是 Echart [![Build Status](https://travis-ci.org/chenjiandongx/pyecharts.svg?branch=master)](https://travis-ci.org/chenjiandongx/pyecharts) -* [开始使用](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#开始使用) -* [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) +* [开始使用](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#开始使用) +* [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) * xyAxis:直角坐标系中的 x、y 轴(Line、Bar、Scatter、EffectScatter、Kline) * dataZoom:dataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息,或者概览数据整体,或者去除离群点的影响。(Line、Bar、Scatter、EffectScatter、Kline) * legend:图例组件。图例组件展现了不同系列的标记(symbol),颜色和名字。可以通过点击图例控制哪些系列不显示。 @@ -15,7 +15,7 @@ pyecharts 是一个用于生成 Echarts 图表的类库。实际上就是 Echart * grid3D:3D笛卡尔坐标系组配置项,适用于 3D 图形。(Bar3D, Line3D, Scatter3D) * visualMap:是视觉映射组件,用于进行『视觉编码』,也就是将数据映射到视觉元素(视觉通道) -* [图表详细](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#图表详细) +* [图表详细](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#图表详细) * Bar(柱状图/条形图) * Bar3D(3D 柱状图) * EffectScatter(带有涟漪特效动画的散点图) @@ -36,9 +36,10 @@ pyecharts 是一个用于生成 Echarts 图表的类库。实际上就是 Echart * Scatter(散点图) * Scatter3D(3D 散点图) * WordCloud(词云图) -* [用户自定义](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#用户自定义) -* [更多示例](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#更多示例) -* [关于项目](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#关于项目) +* [用户自定义](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#用户自定义) +* [集成Flask&Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#集成Flask&Django) +* [更多示例](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#更多示例) +* [关于项目](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#关于项目) # 开始使用 @@ -180,7 +181,7 @@ print(npdata) * background_color -> str 画布背景颜色,默认为 '#fff' * is_grid -> bool - 是否使用 grid 组件,grid 组件用于并行显示图表。具体实现参见 [用户自定义](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#用户自定义) + 是否使用 grid 组件,grid 组件用于并行显示图表。具体实现参见 [用户自定义](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#用户自定义) # 通用配置项 **通用配置项均在 ```add()``` 中设置** @@ -205,6 +206,12 @@ xyAxis:直角坐标系中的 x、y 轴(Line、Bar、Scatter、EffectScatter、 x 坐标轴刻度最小值,默认为自适应。 * xaxis_max -> int/float x 坐标轴刻度最大值,默认为自适应。 +* xaxis_type -> str + x 坐标轴类型 + * 'value':数值轴,适用于连续数据。 + * 'category':类目轴,适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。 + * 'time':时间轴,适用于连续的时序数据,与数值轴相比时间轴带有时间的格式化,在刻度计算上也有所不同,例如会根据跨度的范围来决定使用月,星期,日还是小时范围的刻度。 + * 'log':对数轴。适用于对数数据。 * y_axis -> list y 坐标轴数据 * yaxis_formatter -> str @@ -217,6 +224,12 @@ xyAxis:直角坐标系中的 x、y 轴(Line、Bar、Scatter、EffectScatter、 y 坐标轴刻度最小值,默认为自适应。 * yaxis_max -> int/float y 坐标轴刻度最大值,默认为自适应。 +* yaxis_type -> str + y 坐标轴类型 + * 'value':数值轴,适用于连续数据。 + * 'category':类目轴,适用于离散的类目数据,为该类型时必须通过 data 设置类目数据。 + * 'time':时间轴,适用于连续的时序数据,与数值轴相比时间轴带有时间的格式化,在刻度计算上也有所不同,例如会根据跨度的范围来决定使用月,星期,日还是小时范围的刻度。 + * 'log':对数轴。适用于对数数据。 * yaxis_rotate -> int 刻度标签旋转的角度,在类目轴的类目标签显示不下的时候可以通过旋转防止标签之间重叠。默认为 0,即不旋转。旋转的角度从 -90 度到 90 度。 * interval -> int @@ -523,7 +536,7 @@ bar3d.render() ``` ![bar3D-3](https://github.com/chenjiandongx/pyecharts/blob/master/images/bar3D-3.gif) -**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) +**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) ## EffectScatter(带有涟漪特效动画的散点图) @@ -717,7 +730,7 @@ geo.render() ``` ![geo-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/geo-0.gif) -**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) 中的 Visualmap 使用 +**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) 中的 Visualmap 使用 HeatMap 类型 ```python @@ -873,7 +886,7 @@ heatmap.render() ``` ![heatmap-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/heatmap-0.gif) -**Tip:** 热力图必须配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) 中的 VisualMap 使用才有效果。 +**Tip:** 热力图必须配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) 中的 VisualMap 使用才有效果。 ## Kline(K线图) @@ -1033,6 +1046,17 @@ line.render() **Tip:** 可配置 **lineStyle** 参数 **Tip:** 可以通过 label_color 来设置线条颜色,如 ['#eee', '#000'],所有的图表类型的图例颜色都可通过 label_color 来修改。 +如果是对数数据,推荐使用 ```yaxis_type``` 参数来设置 y 坐标轴为对数轴 +```python +import math, random +line = Line("折线图示例") +line.add("商家A", attr, [math.log10(random.randint(1, 99999)) for _ in range(6)]) +line.add("商家B", attr, [math.log10(random.randint(1, 99999999)) for _ in range(6)], yaxis_type="log") +line.show_config() +line.render() +``` +![line-3-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/line-3-1.png) + ## Line3D(3D 折线图) @@ -1089,7 +1113,7 @@ line3d.render() ``` ![line3D-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/line3D-1.gif) -**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) +**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) ## Liquid(水球图) @@ -1186,7 +1210,7 @@ map.render() ``` ![map-1](https://github.com/chenjiandongx/pyecharts/blob/master/images/map-1.gif) -**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) 中的 Visualmap 使用 +**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) 中的 Visualmap 使用 ```python from pyecharts import Map @@ -1613,7 +1637,7 @@ radar.render() Scatter.add() 方法签名 ```python -add(name, x_value, y_value, symbol_size=10, **kwargs) +add(name, x_axis, y_axis, symbol_size=10, **kwargs) ``` * name -> str 图例名称 @@ -1657,7 +1681,17 @@ scatter.render() ``` ![scatter-0-2](https://github.com/chenjiandongx/pyecharts/blob/master/images/scatter-0-2.gif) -**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) 中的 Visualmap 使用 +**Tip:** 请配合 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) 中的 Visualmap 使用 + +散点图默认的坐标轴都为数值轴,如果想实现横坐标为类目轴,可通过 ```xaxis_type``` 修改 +```python +scatter = Scatter("散点图示例") +scatter.add("A", ["a", "b", "c", "d", "e", "f"], v2) +scatter.add("B", ["a", "b", "c", "d", "e", "f"], v1[::-1], xaxis_type="category") +scatter.show_config() +scatter.render() +``` +![scatter-0-3](https://github.com/chenjiandongx/pyecharts/blob/master/images/scatter-0-3.png) Scatter 还内置了画画方法 ```python @@ -1714,7 +1748,7 @@ scatter3D.render() ``` ![scatter3D-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/scatter3D-0.gif) -**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/README.md#通用配置项) +**Tip:** 关于 gird3D 部分的设置,请参照通用配置项中的介绍 [通用配置项](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/documentation.md#通用配置项) ## WordCloud(词云图) @@ -2054,11 +2088,19 @@ heatmap.render() ![grid-5](https://github.com/chenjiandongx/pyecharts/blob/master/images/grid-5.gif) Bar 会受 HeatMap 影响,很有趣。 + +# 集成Flask&Django + +* [pyecharts + Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_flask.md) +* [pyecharts + Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_django.md) + + # 更多示例 * 更多示例请参考 [example.md](https://github.com/chenjiandongx/pyecharts/blob/master/example.md) * 欢迎大家补充示例 + # 关于项目 * 欢迎大家使用 pyecharts From 381d4f2b6fd57665c9803e6365da4f4997d0440d Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 00:39:04 +0800 Subject: [PATCH 2/8] add xaxis_type and yaxis_type options for rectangular coordinate system --- pyecharts/base.py | 2 ++ pyecharts/charts/scatter.py | 8 +++---- pyecharts/option.py | 47 ++++++++++++++++++++++++++++++------- test/test_line.py | 10 +++++++- test/test_scatter.py | 7 ++++++ 5 files changed, 61 insertions(+), 13 deletions(-) diff --git a/pyecharts/base.py b/pyecharts/base.py index 528cf386..70e00a82 100644 --- a/pyecharts/base.py +++ b/pyecharts/base.py @@ -216,12 +216,14 @@ class Base(object): xaxis_rotate=None, xaxis_min=None, xaxis_max=None, + xaxis_type=None, xy_text_size=None, yaxis_formatter=None, yaxis_rotate=None, yaxis_min=None, yaxis_max=None, yaxis_name_pos=None, + yaxis_type=None, yaxis_name=None): """ The base class's add() is just to provide a hint option """ pass diff --git a/pyecharts/charts/scatter.py b/pyecharts/charts/scatter.py index 924a292e..9b0539d1 100644 --- a/pyecharts/charts/scatter.py +++ b/pyecharts/charts/scatter.py @@ -22,7 +22,7 @@ class Scatter(Base): def add(self, *args, **kwargs): self.__add(*args, **kwargs) - def __add(self, name, x_value, y_value, + def __add(self, name, x_axis, y_axis, symbol_size=10, **kwargs): """ @@ -38,8 +38,8 @@ class Scatter(Base): symbol size :param kwargs: """ - assert len(x_value) == len(y_value) - kwargs.update(type="scatter") + assert len(x_axis) == len(y_axis) + kwargs.update(type="scatter", x_axis=x_axis) chart = get_all_options(**kwargs) xaxis, yaxis = chart['xy_axis'] self._option.update(xAxis=xaxis, yAxis=yaxis) @@ -49,7 +49,7 @@ class Scatter(Base): "name": name, "symbol": chart['symbol'], "symbolSize": symbol_size, - "data": [list(z) for z in zip(x_value, y_value)], + "data": [list(z) for z in zip(x_axis, y_axis)], "label": chart['label'], "indexflag": self._option.get('_index_flag') }) diff --git a/pyecharts/option.py b/pyecharts/option.py index f14be438..f1629cc4 100644 --- a/pyecharts/option.py +++ b/pyecharts/option.py @@ -196,12 +196,14 @@ def xy_axis(type=None, xaxis_rotate=0, xaxis_min=None, xaxis_max=None, + xaxis_type=None, interval="auto", yaxis_name="", yaxis_name_pos="middle", yaxis_rotate=0, yaxis_min=None, yaxis_max=None, + yaxis_type=None, is_convert=False, x_axis=None, yaxis_formatter="", @@ -225,6 +227,14 @@ def xy_axis(type=None, The minimun value of xaxis. :param xaxis_max: The maximun value of xaxis. + :param xaxis_type: + Type of xaxis + 'value' Numerical axis, suitable for continuous data. + 'category' Category axis, suitable for discrete category data. Data should only be set via data for this type. + 'time' Time axis, suitable for continuous time series data. As compared to value axis, + it has a better formatting for time and a different tick calculation method. For example, + it decides to use month, week, day or hour for tick based on the range of span. + 'log' Log axis, suitable for log data. :param interval: The display interval of the axis scale label is valid in the category axis. By default, labels are displayed using labels that do not overlap the labels @@ -241,6 +251,14 @@ def xy_axis(type=None, The minimun value of yaxis. :param yaxis_max: The maximun value of yaxis. + :param yaxis_type: + Type of yaxis + 'value' Numerical axis, suitable for continuous data. + 'category' Category axis, suitable for discrete category data. Data should only be set via data for this type. + 'time' Time axis, suitable for continuous time series data. As compared to value axis, + it has a better formatting for time and a different tick calculation method. For example, + it decides to use month, week, day or hour for tick based on the range of span. + 'log' Log axis, suitable for log data. :param is_convert: It specifies whether to convert xAxis and yAxis. :param x_axis: @@ -275,15 +293,28 @@ def xy_axis(type=None, "min": yaxis_min, "max": yaxis_max } - if is_convert: - _yAxis.update(data=x_axis, type="category") - _xAxis.update(type="value") - else: - _xAxis.update(data=x_axis, type="category") - _yAxis.update(type="value") + if type == "scatter": - _xAxis.update(data=x_axis, type="value") - _yAxis.update(type="value") + if xaxis_type is None: + xaxis_type = "value" + if yaxis_type is None: + yaxis_type = "value" + else: # line/bar + if xaxis_type is None: + xaxis_type = "category" + if yaxis_type is None: + yaxis_type = "value" + + if is_convert: + xaxis_type, yaxis_type = yaxis_type, xaxis_type + _xAxis.update(type=xaxis_type) + _yAxis.update(data=x_axis, type=yaxis_type) + else: + _xAxis.update(data=x_axis, type=xaxis_type) + _yAxis.update(type=yaxis_type) + if type == "scatter": + _xAxis.update(data=x_axis, type=xaxis_type) + _yAxis.update(type=yaxis_type) return [_xAxis], [_yAxis] diff --git a/test/test_line.py b/test/test_line.py index 79333cc7..5f0c5a22 100644 --- a/test/test_line.py +++ b/test/test_line.py @@ -38,13 +38,21 @@ def test_line(): line.show_config() line.render() - # # line_3 + # line_3 line = Line("折线图-面积图示例") line.add("商家A", attr, v1, is_fill=True, line_opacity=0.2, area_opacity=0.4, symbol=None) line.add("商家B", attr, v2, is_fill=True, area_color='#000', area_opacity=0.3, is_smooth=True) line.show_config() line.render() + # line_3_1 + import math, random + line = Line("折线图示例") + line.add("商家A", attr, [math.log10(random.randint(1, 99999)) for _ in range(6)]) + line.add("商家B", attr, [math.log10(random.randint(1, 99999999)) for _ in range(6)], yaxis_type="log") + line.show_config() + line.render() + # line_4 attr = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] line = Line("折线图示例") diff --git a/test/test_scatter.py b/test/test_scatter.py index 97fa3bf6..e2e3ba81 100644 --- a/test/test_scatter.py +++ b/test/test_scatter.py @@ -29,6 +29,13 @@ def test_scatter(): scatter.show_config() scatter.render() + # scatter_0_3 + scatter = Scatter("散点图示例") + scatter.add("A", ["a", "b", "c", "d", "e", "f"], v2) + scatter.add("B", ["a", "b", "c", "d", "e", "f"], v1[::-1], xaxis_type="category") + scatter.show_config() + scatter.render() + # scatter_1 scatter = Scatter("散点图示例") v1, v2 = scatter.draw("../images/pyecharts-0.png") From 781e7e4850de17b1d5474f3506be607e752c1331 Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 00:45:13 +0800 Subject: [PATCH 3/8] update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 358a4431..1bf678d7 100644 --- a/README.md +++ b/README.md @@ -64,17 +64,19 @@ bar.render() ## working with Flask & Django Flask + ![flask-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/flask-0.gif) Django + ![django-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/django-0.gif) * 中文文档 - * [Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_flask.md) - * [Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_django.md) + * [pyecharts + Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_flask.md) + * [pyecharts + Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/doc_django.md) * English - * [Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_flask.md) - * [Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_django.md) + * [pyecharts + Flask](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_flask.md) + * [pyecharts + Django](https://github.com/chenjiandongx/pyecharts/blob/master/document/en-us/doc_django.md) ## Documentation From d85053a6139c6f632fd22756404362076110bc5a Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 00:50:04 +0800 Subject: [PATCH 4/8] update doc_django.md --- document/zh-cn/doc_django.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/document/zh-cn/doc_django.md b/document/zh-cn/doc_django.md index 789e0fa8..63e35002 100644 --- a/document/zh-cn/doc_django.md +++ b/document/zh-cn/doc_django.md @@ -74,7 +74,7 @@ urlpatterns = [ ## Step 2: 为项目提供自己的模板 -前面的步骤是按照 [tutorial part 1]([tutorials](https://docs.djangoproject.com/en/1.11/intro/tutorial01/),接下来我们跳到 [tutorial part 3](https://docs.djangoproject.com/en/1.11/intro/tutorial03/) +前面的步骤是按照 [tutorial part 1](https://docs.djangoproject.com/en/1.11/intro/tutorial01/),接下来我们跳到 [tutorial part 3](https://docs.djangoproject.com/en/1.11/intro/tutorial03/) Linux/macos 系统 @@ -82,7 +82,7 @@ Linux/macos 系统 $ mkdir templates/myfirstvis -p ``` -Windows 系统 +Windows 系统 在 myfirstvis 目录下,新建 templates/myfirstvis 子目录 myfirstvis 目录 @@ -181,7 +181,8 @@ Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C. ``` -访问 http://localhost:8000/myfirstvis/,你就可以看到酷炫的 3D 图了 +访问 [http://localhost:8000/myfirstvis/](http://localhost:8000/myfirstvis/),你就可以看到酷炫的 3D 图了 + ![django-0](https://github.com/chenjiandongx/pyecharts/blob/master/images/django-0.gif) From b3db947b55260f757fb737b0c984287f7c2295c0 Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 01:38:54 +0800 Subject: [PATCH 5/8] update documentation --- README.md | 2 +- document/zh-cn/documentation.md | 7 +++---- document/zh-cn/user-customize-map.md | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1bf678d7..d01c7762 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ pyecharts is a library to generate charts using Echarts. It simply provides the [Echarts](https://github.com/ecomfe/echarts) is an open source library from Baidu for data visualization in javascript. It has awesome demo pages so I started to look out for an interface library so that I could use it in Python. I ended up with [echarts-python](https://github.com/yufeiminds/echarts-python) on github but it lacks of documentation and was not updated for a while. Just like many other Python projects, I started my own project, pyecharts, referencing echarts-python and another library [pygal](https://github.com/Kozea/pygal). ## Instatllation -pyecharts works on Python2 and Python3. The latest release is 0.1.9.2. For more information please refer to [changelog.md](https://github.com/chenjiandongx/pyecharts/blob/master/changelog.md) +pyecharts works on Python2 and Python3. The latest release is 0.1.9.3. For more information please refer to [changelog.md](https://github.com/chenjiandongx/pyecharts/blob/master/changelog.md) You can install it via pip ``` diff --git a/document/zh-cn/documentation.md b/document/zh-cn/documentation.md index becefef2..4f059d27 100644 --- a/document/zh-cn/documentation.md +++ b/document/zh-cn/documentation.md @@ -93,8 +93,7 @@ cast(seq) 3. 字典 {A1: B1, A2: B2, A3: B3, A4: B4} -- > k_lst[ A[i1, i2...] ], v_lst[ B[i1, i2...] ] -如果使用的是 Numpy 或者 Pandas,0.1.9.2 以前提供的 ```pdcast(pddata)``` 和 ``` npcast(npdata)``` 两个方法在 0.1.9.3 之后不需再用了,用于这两个库数据类型的处理。 -DataFrame 多个维度时返回一个嵌套列表。比较适合像 Radar, Parallel, HeatMap 这些需要传入嵌套列表([[ ], [ ]])数据的图表。 +如果使用的是 Numpy 或者 Pandas,0.1.9.2 以前提供的 ```pdcast(pddata)``` 和 ``` npcast(npdata)``` 两个方法在 0.1.9.3 之后不需再用了。 Series 类型 ```python @@ -1043,7 +1042,7 @@ line.render() * area_color -> str 填充区域颜色 -**Tip:** 可配置 **lineStyle** 参数 +**Tip:** 可配置 **lineStyle** 参数 **Tip:** 可以通过 label_color 来设置线条颜色,如 ['#eee', '#000'],所有的图表类型的图例颜色都可通过 label_color 来修改。 如果是对数数据,推荐使用 ```yaxis_type``` 参数来设置 y 坐标轴为对数轴 @@ -1184,7 +1183,7 @@ add(name, attr, value, is_roam=True, maptype='china', **kwargs) 是否开启鼠标缩放和平移漫游。默认为 True 如果只想要开启缩放或者平移,可以设置成'scale'或者'move'。设置成 True 为都开启 * maptype -> str - 地图类型。默认只提供了 'china' 和 'world',即中国地图和世界地图。不用担心,这里说明了 [用户如何自定义地图](https://github.com/chenjiandongx/pyecharts/blob/master/document/user-customize-map.md) + 地图类型。 支持 china、world、安徽、澳门、北京、重庆、福建、福建、甘肃、广东,广西、广州、海南、河北、黑龙江、河南、湖北、湖南、江苏、江西、吉林、辽宁、内蒙古、宁夏、青海、山东、上海、陕西、四川、台湾、天津、香港、新疆、西藏、云南、浙江。地图提供了自定义模式 [用户如何自定义地图](https://github.com/chenjiandongx/pyecharts/blob/master/document/zh-cn/user-customize-map.md) ```python from pyecharts import Map diff --git a/document/zh-cn/user-customize-map.md b/document/zh-cn/user-customize-map.md index 6086c5bb..fd68250e 100644 --- a/document/zh-cn/user-customize-map.md +++ b/document/zh-cn/user-customize-map.md @@ -1,6 +1,6 @@ # 用户自定义地图 -考虑到项目更好的通用性,以及更好可扩展性,所以决定对地图部分实现完全自定义,现在默认只提供 world 和 china,即世界地图和中国地图。其余省份或地区现在完全由用户自行决定是否添加。 +考虑到项目更好的通用性,以及更好可扩展性,所以决定对地图部分提供自定义模式。 ## 下载地图 From 2b230d8170a4237d38cf50e951b3a6e09d82f9be Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 01:39:16 +0800 Subject: [PATCH 6/8] update changelog.md --- changelog.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 67e1594b..f14daaa2 100644 --- a/changelog.md +++ b/changelog.md @@ -35,6 +35,11 @@ * render() 方法现在为离线模式,实现本地生成 .html 文件,加载速度更快。 * 废弃 render_notebook() 方法,现可直接调用图形实例显示在 jupyter notebook 上。 +* version 0.1.9.3 + * 新增 xaxis_type, yaxis_type 参数,可通过设置该参数指定直角坐标系数轴类型。(参见 Line,Scattre 图) + * 集成 Flask + Django + + ## 项目期待 -* 更好地集成到 Django + Flask 中。 \ No newline at end of file +// Todo \ No newline at end of file From 9940b0bdb6dad4f0d9300377b762b3e08b73460f Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 01:49:20 +0800 Subject: [PATCH 7/8] :clap: release version 0.1.9.3 --- pyecharts/__init__.py | 2 +- pyecharts/template.py | 32 ++++++++++++++++++++++++++++++ pyecharts/templates/template.html | 33 +++++++++++++++++++++++++++++++ setup.py | 2 +- test/test_base.py | 2 +- 5 files changed, 68 insertions(+), 3 deletions(-) diff --git a/pyecharts/__init__.py b/pyecharts/__init__.py index b3f4ed24..c608003d 100644 --- a/pyecharts/__init__.py +++ b/pyecharts/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python #coding=utf-8 -__version__ = '0.1.9.2' +__version__ = '0.1.9.3' __author__ = 'chenjiandongx' from pyecharts.charts.bar import Bar diff --git a/pyecharts/template.py b/pyecharts/template.py index a79f8947..41350ff4 100644 --- a/pyecharts/template.py +++ b/pyecharts/template.py @@ -44,6 +44,38 @@ def freeze_js(html_content): _mapindex = { "广东": "guangdong: '//oog4yfyu0.bkt.clouddn.com/guangdong'", + "安徽": "anhui: '//oog4yfyu0.bkt.clouddn.com/anhui'", + "澳门": "aomen: '//oog4yfyu0.bkt.clouddn.com/aomen'", + "北京": "beijing: '//oog4yfyu0.bkt.clouddn.com/beijing'", + "重庆": "chongqing: '//oog4yfyu0.bkt.clouddn.com/chongqing'", + "福建": "fujian: '//oog4yfyu0.bkt.clouddn.com/fujian'", + "甘肃": "gansu: '//oog4yfyu0.bkt.clouddn.com/gansu'", + "广西": "guangxi: '//oog4yfyu0.bkt.clouddn.com/guangxi'", + "贵州": "guizhou: '//oog4yfyu0.bkt.clouddn.com/guizhou'", + "海南": "hainan: '//oog4yfyu0.bkt.clouddn.com/hainan'", + "河北": "hebei: '//oog4yfyu0.bkt.clouddn.com/hebei'", + "黑龙江": "heilongjiang: '//oog4yfyu0.bkt.clouddn.com/heilongjiang'", + "河南": "henan: '//oog4yfyu0.bkt.clouddn.com/henan'", + "湖北": "hubei: '//oog4yfyu0.bkt.clouddn.com/hubei'", + "湖南": "hunan: '//oog4yfyu0.bkt.clouddn.com/hunan'", + "江苏": "jiangsu: '//oog4yfyu0.bkt.clouddn.com/jiangsu'", + "江西": "jiangxi: '//oog4yfyu0.bkt.clouddn.com/jiangxi'", + "吉林": "jilin: '//oog4yfyu0.bkt.clouddn.com/jilin'", + "辽宁": "liaoning: '//oog4yfyu0.bkt.clouddn.com/liaoning'", + "内蒙古": "neimenggu: '//oog4yfyu0.bkt.clouddn.com/neimenggu'", + "宁夏": "ningxia: '//oog4yfyu0.bkt.clouddn.com/ningxia'", + "青海": "qinghai: '//oog4yfyu0.bkt.clouddn.com/qinghai'", + "山东": "shandong: '//oog4yfyu0.bkt.clouddn.com/shandong'", + "上海": "shanghai: '//oog4yfyu0.bkt.clouddn.com/shanghai'", + "山西": "shanxi: '//oog4yfyu0.bkt.clouddn.com/shanxi'", + "四川": "sichuan: '//oog4yfyu0.bkt.clouddn.com/sichuan'", + "台湾": "taiwan: '//oog4yfyu0.bkt.clouddn.com/taiwan'", + "天津": "tianjin: '//oog4yfyu0.bkt.clouddn.com/tianjin'", + "香港": "xianggang: '//oog4yfyu0.bkt.clouddn.com/xianggang'", + "新疆": "xinjiang: '//oog4yfyu0.bkt.clouddn.com/xinjiang'", + "西藏": "xizang: '//oog4yfyu0.bkt.clouddn.com/xizang'", + "云南": "yunnan: '//oog4yfyu0.bkt.clouddn.com/yunnan'", + "浙江": "zhejiang: '//oog4yfyu0.bkt.clouddn.com/zhejiang'" } diff --git a/pyecharts/templates/template.html b/pyecharts/templates/template.html index b92e494e..b24c72fb 100644 --- a/pyecharts/templates/template.html +++ b/pyecharts/templates/template.html @@ -9,6 +9,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/setup.py b/setup.py index 749498c1..bc99697c 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ except ImportError: __title__ = 'pyecharts' __description__ = 'Python echarts, make charting easier' __url__ = 'https://github.com/chenjiandongx/pyecharts' -__version__ = '0.1.9.2' +__version__ = '0.1.9.3' __author__ = 'chenjiandongx' __author_email__ = 'chenjiandongx@qq.com' __license__ = 'MIT' diff --git a/test/test_base.py b/test/test_base.py index 5d45b54c..c465017c 100644 --- a/test/test_base.py +++ b/test/test_base.py @@ -49,6 +49,6 @@ def test_pandas_dataframe(): bar = Bar(title, 'Profit and loss situation') bar.add('profit', df1.index, dtvalue1) - bar.add('loss', df2.index, dtvalue2) + bar.add('loss', df2.index, dtvalue2) html = bar.render_embed() assert title in html From 48940f964e0a0abd168a4266aa559b35a7676e50 Mon Sep 17 00:00:00 2001 From: chenjiandongx Date: Thu, 10 Aug 2017 02:06:03 +0800 Subject: [PATCH 8/8] update changelog.md --- changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index f14daaa2..df3f1290 100644 --- a/changelog.md +++ b/changelog.md @@ -28,14 +28,14 @@ * legend 增加 legend_selectedmode 参数,图例可以设置为单例或者多例。(参见 Radar 图) * visualmap 组件增加 visual_map 和 visual_range_size 参数。现在支持映射到颜色和图形大小两种方式。(参见 Scatter 图) -* version 0.1.9.2(当前版本) +* version 0.1.9.2 * 新增 xaxis_rotate, yaxis_rotate 参数,可通过设置该参数解决强制显示所有坐标轴标签时因过于密集重叠的问题。参见(Bar 图) * 新增 xaxis_min, xaxis_max. yaxis_min, yaxis_max 参数,可设置坐标轴上的最大最小值,针对数值轴有效。 * 解决 3D 图形不能在 jupyter notebook 上正常显示的问题。 * render() 方法现在为离线模式,实现本地生成 .html 文件,加载速度更快。 * 废弃 render_notebook() 方法,现可直接调用图形实例显示在 jupyter notebook 上。 -* version 0.1.9.3 +* version 0.1.9.3(当前版本) * 新增 xaxis_type, yaxis_type 参数,可通过设置该参数指定直角坐标系数轴类型。(参见 Line,Scattre 图) * 集成 Flask + Django