Skip to content

Commit

Permalink
Fix 0.5.3 where empty dict means a lot for echarts (#558)
Browse files Browse the repository at this point in the history
* 🐛 keep the empty dictionary though it looks useless but charts needs them. fix #555

* 👕 keep empty array too. update 📖

* 🎨 minor tweaks on the source code

* Update: pink test folder

* Update: changelog update
  • Loading branch information
chfw committed May 15, 2018
1 parent c166800 commit d2f07da
Show file tree
Hide file tree
Showing 15 changed files with 208 additions and 507 deletions.
15 changes: 12 additions & 3 deletions docs/zh-cn/changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# 版本日志

* ### version 0.5.4(dev)
* 重构`Page`类,新增图表命名名称引用。
* ### version 0.5.5(dev)
* TODO

* ### version 0.5.3 - 2018.05.10(current)
* ### version 0.5.4 - 2018.05.15(current)

### Updated
* 重构 `Page` 类,新增图表命名名称引用。

### Fixed
* [issue#555](https://github.com/pyecharts/pyecharts/issues/555) 修复 v0.5.3 Polar 图不能显示的 bug
* [issue#541](https://github.com/pyecharts/pyecharts/issues/541) 修复 v0.5.3 Django + pyecharts 不能正常导入的 bug

* ### version 0.5.3 - 2018.05.10

#### Fixed
* [issue#544](https://github.com/pyecharts/pyecharts/issues/544) 修复 v0.5.2 主题颜色默认颜色配置与前版本有差别太大的 bug
Expand Down
2 changes: 1 addition & 1 deletion pyecharts/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.5.3"
__version__ = "0.5.4"
__author__ = "chenjiandongx"
1 change: 1 addition & 0 deletions pyecharts/custom/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def __getitem__(self, item):
if isinstance(item, int):
# list index
return list(self._charts.values())[item]

return self._charts[item]

def __setitem__(self, key, value):
Expand Down
17 changes: 2 additions & 15 deletions pyecharts/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,10 @@ def _clean_dict(mydict):
for key, value in viewitems(mydict):
if value is not None:
if isinstance(value, dict):
if value:
value = _expand(_clean_dict(value))
else:
# delete key with empty dictionary
continue

if not value:
# detete empty dictionary resulted by
# previous cleanning function
continue
value = _expand(_clean_dict(value))

elif isinstance(value, (list, tuple, set)):
if value:
value = list(_clean_array(value))
else:
# delete key with empty array
continue
value = list(_clean_array(value))

elif isinstance(value, string_type) and not value:
# delete key with empty string
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/bar3d_options.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
"high",
"low"
],
"textStyle": {},
"top": "bottom",
"type": "continuous"
},
Expand Down

0 comments on commit d2f07da

Please sign in to comment.