Skip to content

Commit

Permalink
Enable area color in map (pyecharts#1253)
Browse files Browse the repository at this point in the history
* ✨ enable area color in map. resolve pyecharts#1248

* 💄 update version number
  • Loading branch information
chfw authored and chenjiandongx committed Jul 15, 2019
1 parent fa212de commit d5adccf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyecharts/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "1.3.0"
__version__ = "1.3.1"
__author__ = "chenjiandongx"
2 changes: 2 additions & 0 deletions pyecharts/options/series_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(
border_color0: Optional[str] = None,
border_width: Optional[Numeric] = None,
opacity: Optional[Numeric] = None,
area_color: Optional[str] = None,
):
self.opts: dict = {
"color": color,
Expand All @@ -33,6 +34,7 @@ def __init__(
"borderColor0": border_color0,
"borderWidth": border_width,
"opacity": opacity,
"areaColor": area_color
}


Expand Down
7 changes: 7 additions & 0 deletions test/test_item_style_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pyecharts import options as opts
from nose.tools import eq_


def test_area_color_in_item_styles():
op = opts.ItemStyleOpts(area_color='red')
eq_(op.opts['areaColor'], 'red')
5 changes: 3 additions & 2 deletions test/test_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ def test_map_emphasis():
[list(z) for z in zip(Faker.provinces, Faker.values())],
"china",
emphasis_label_opts=opts.LabelOpts(is_show=False),
emphasis_itemstyle_opts=opts.ItemStyleOpts(border_color="white"),
emphasis_itemstyle_opts=opts.ItemStyleOpts(border_color="white",
area_color="red"),
)
options = json.loads(c.dump_options())
expected = {
"label": {"show": False, "position": "top", "margin": 8},
"itemStyle": {"borderColor": "white"},
"itemStyle": {"borderColor": "white", "areaColor": "red"},
}
eq_(expected, options["series"][0]["emphasis"])

0 comments on commit d5adccf

Please sign in to comment.