forked from pyecharts/pyecharts
-
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.
* 🐛 fix theme color problem for themes other than dark, pyecharts#544 * 🔬 test remove_key_with_none_value and whitening * 📚 update docs and pump version * Update json_serializable.py * Update __init__.py * 💚 fix unit test failures * 🔥 get rid of dev code * 💚 pass all unit tests * 👕 use python 2 to generate the fixtures * 🔥 remove empty dictionary that resulted from cleaning * 🔬 more test cases. 👕 whitening * 💚 ignore basestring please, flake8 * 🔨 code refactor test * 🔨 address review feedbacks * 💄 change single quote * Update: docs update * Update: img link update * Update: docs update
- Loading branch information
1 parent
47233f6
commit a130fe8
Showing
23 changed files
with
197 additions
and
212 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
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
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 |
---|---|---|
@@ -1,51 +1,74 @@ | ||
> 主题自定义篇:适用在 pyecharts v0.5.2 以后的版本。 | ||
> 主题自定义篇:扩展主题插件,多样化图表配色。V0.5.2+ 新增 | ||
自 0.5.2+ 起,pyecharts 支持更换主体色系。下面是更换为 'dark' 的例子: | ||
自 0.5.2+ 起,pyecharts 支持更换主题。下面是更换为 "dark" 的例子: | ||
|
||
```python | ||
import random | ||
|
||
from pyecharts import Bar | ||
|
||
|
||
X_AXIS = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"] | ||
bar = Bar("我的第一个图表", "这里是副标题") | ||
bar.use_theme('dark') | ||
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90]) | ||
bar.use_theme("dark") | ||
bar.add("商家A", X_AXIS, [random.randint(10, 100) for _ in range(6)]) | ||
bar.add("商家B", X_AXIS, [random.randint(10, 100) for _ in range(6)]) | ||
bar.add("商家C", X_AXIS, [random.randint(10, 100) for _ in range(6)]) | ||
bar.add("商家D", X_AXIS, [random.randint(10, 100) for _ in range(6)]) | ||
bar.render() | ||
``` | ||
 | ||
 | ||
|
||
默认主题的效果 | ||
|
||
 | ||
|
||
## 如何获得更多主题 | ||
|
||
伴随 pyecharts v0.5.2, [echarts-themes-pypkg](https://github.com/pyecharts/echarts-themes-pypkg) 提供 dark, vintage, macarons, infographic, shine 和 roma 主题。 | ||
[echarts-themes-pypkg](https://github.com/pyecharts/echarts-themes-pypkg) 提供了 `dark`, `vintage`, `macarons`, `infographic`, `shine` 和 `roma` 主题。 | ||
|
||
## 安装主题插件 | ||
### 安装主题插件 | ||
|
||
```shell | ||
$ pip install echarts-themes-pypkg | ||
``` | ||
|
||
## 使用主题 | ||
### 使用主题 | ||
|
||
更换单个图形主题 | ||
```python | ||
bar.use_theme('vintage') # 更换为你喜欢的主题 | ||
bar.use_theme("vintage") | ||
``` | ||
|
||
更换运行环境内所有图表主题 | ||
```python | ||
from pyecharts import configure | ||
|
||
# 将这行代码置于首部 | ||
configure(global_theme='dark') | ||
|
||
bar = Bar() | ||
.... | ||
``` | ||
|
||
## 示例 | ||
### 示例 | ||
|
||
### vintage: | ||
**vintage** | ||
|
||
 | ||
 | ||
|
||
### macarons: | ||
**macarons** | ||
|
||
 | ||
 | ||
|
||
### infographic | ||
**infographic** | ||
|
||
 | ||
 | ||
|
||
### shine: | ||
**shine** | ||
|
||
 | ||
 | ||
|
||
### roma: | ||
**roma** | ||
|
||
 | ||
 |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cd test | ||
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --exclude docs --builtins=unicode,xrange,long | ||
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --max-complexity 12 --exclude docs --builtins=unicode,xrange,long,basestring |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__version__ = "0.5.2" | ||
__version__ = "0.5.3" | ||
__author__ = "chenjiandongx" |
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
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
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 |
---|---|---|
@@ -1,13 +1,20 @@ | ||
from pyecharts.utils import remove_key_with_none_value | ||
|
||
|
||
class JsonSerializable(object): | ||
|
||
def __init__(self): | ||
self.config = {} | ||
self._config = {} | ||
|
||
def __setitem__(self, key, value): | ||
self.config[key] = value | ||
self._config[key] = value | ||
|
||
def __getitem__(self, key): | ||
return self.config.get(key) | ||
return self._config.get(key) | ||
|
||
def update(self, **kwargs): | ||
self.config.update(**kwargs) | ||
|
||
@property | ||
def config(self): | ||
return remove_key_with_none_value(self._config) |
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
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
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
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 |
---|---|---|
@@ -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 | ||
nosetests --with-coverage --cover-package pyecharts --cover-package test && cd .. && flake8 --max-complexity 12 --exclude docs --builtins=unicode,xrange,long,basestring |
Oops, something went wrong.