Skip to content

Commit

Permalink
Mark enhance (pyecharts#747)
Browse files Browse the repository at this point in the history
* Add: pyecharts#731 新增 mark_point_raw, mark_line_raw 配置项用于个性化展示标记

* Update: 文档更新

* Fix: 避免其他属性在 _config_components 中多次被调用

* Update: 注释更新
  • Loading branch information
chenjiandongx authored Sep 9, 2018
1 parent aba2cb8 commit 9d7f549
Show file tree
Hide file tree
Showing 8 changed files with 369 additions and 306 deletions.
10 changes: 7 additions & 3 deletions docs/zh-cn/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
* TODO

* ### version 0.5.11 - (dev)

#### Fxied
* [issue#738](https://github.com/pyecharts/pyecharts/issues/738) 支持设置 Grid, Overlay 和 Timeliine 某选项为空 (null)

#### Added
* [issue#731](https://github.com/pyecharts/pyecharts/issues/731) 新增 `mark_point_raw`, `mark_line_raw` 配置项用于个性化展示标记。

#### Fixed
* [issue#738](https://github.com/pyecharts/pyecharts/issues/738) 支持设置 Grid, Overlay 和 Timeline 某选项为空 (null)


* ### version 0.5.10 - 2018.9.4

Expand Down
8 changes: 8 additions & 0 deletions docs/zh-cn/charts_configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,10 @@
[{"coord": [a1, b1], "name": "first markpoint"}, {"coord": [a2, b2], "name": "second markpoint"}]
需自己传入标记点字典,共有两个键值对,'coord' 对应为 x y 轴坐标, 'name' 为标记点名称。

* mark_point_raw -> list
原生格式的 markPoint 数据,数据类型为 [{}, {}, ...]。
格式请参考 http://echarts.baidu.com/option.html#series-line.markPoint.data

* mark_point_symbol -> str
默认 -> 'pin'
标记点图形,有'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'可选。
Expand All @@ -749,6 +753,10 @@
* mark_line -> list
标记线,默认有'min', 'max', 'average'可选

* mark_line_raw -> list
原生格式的 markLine 数据,数据类型为 [{}, {}, ...]。
格式请参考 http://echarts.baidu.com/option.html#series-line.markLine.data

* mark_line_symbolsize -> int
默认 -> 15
标记线图形大小。
Expand Down
2 changes: 1 addition & 1 deletion make.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd test
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --max-complexity 12 --exclude docs --builtins=unicode,xrange,long,basestring
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --max-complexity 14 --exclude docs --builtins=unicode,xrange,long,basestring
4 changes: 2 additions & 2 deletions pyecharts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pyecharts.exceptions as exceptions
import pyecharts.utils as utils
from pyecharts.conf import CURRENT_CONFIG
from pyecharts.echarts.option import get_all_options
from pyecharts.echarts.option import get_other_options


class Base(object):
Expand Down Expand Up @@ -190,7 +190,7 @@ def render_notebook(self):
)

def _get_all_options(self, **kwargs):
return get_all_options(**kwargs)
return get_other_options(**kwargs)

def _repr_html_(self):
"""
Expand Down
5 changes: 4 additions & 1 deletion pyecharts/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import pyecharts.constants as constants
from pyecharts.base import Base
from pyecharts.echarts.option import get_base_options


class Chart(Base):
Expand Down Expand Up @@ -259,10 +260,12 @@ def add(
liquid_color=None,
maptype=None,
mark_line=None,
mark_line_raw=None,
mark_line_symbolsize=None,
mark_line_valuedim=None,
mark_line_coords=None,
mark_point=None,
mark_point_raw=None,
mark_point_symbol=None,
mark_point_symbolsize=None,
mark_point_textcolor=None,
Expand Down Expand Up @@ -407,7 +410,7 @@ def _config_components(
"""
if self.theme == constants.LIGHT_THEME:
kwargs.update(colorlst=self._colorlst)
chart = self._get_all_options(**kwargs)
chart = get_base_options(**kwargs)
self._option.update(color=chart["color"])

# legend
Expand Down
Loading

0 comments on commit 9d7f549

Please sign in to comment.