diff --git a/pyecharts/_version.py b/pyecharts/_version.py index 68472a9d..cf12e614 100644 --- a/pyecharts/_version.py +++ b/pyecharts/_version.py @@ -1,2 +1,2 @@ -__version__ = '0.1.9.6' +__version__ = '0.1.9.7' __author__ = 'chenjiandongx' diff --git a/pyecharts/charts/map.py b/pyecharts/charts/map.py index 67af0082..0c8a2283 100644 --- a/pyecharts/charts/map.py +++ b/pyecharts/charts/map.py @@ -57,8 +57,6 @@ class Map(Base): "data": _data, "roam": is_roam }) - map_type = self._option.get('series')[0].get('mapType') - name_in_pinyin = CITY_NAME_PINYIN_MAP.get(map_type, map_type) + name_in_pinyin = CITY_NAME_PINYIN_MAP.get(maptype, maptype) self._js_dependencies.add(name_in_pinyin) - self._legend_visualmap_colorlst(**kwargs) diff --git a/pyecharts/template.py b/pyecharts/template.py index 5223bf2d..2f3a17c3 100644 --- a/pyecharts/template.py +++ b/pyecharts/template.py @@ -89,11 +89,12 @@ def produce_require_configuration(dependencies, jshost): :param jshost: :return: """ + _d = ensure_echarts_is_in_the_front(dependencies) # if no nick name register, we treat the location as location.js require_conf_items = [ "'%s': '%s/%s'" % (key, jshost, DEFAULT_JS_LIBRARIES.get(key, key)) - for key in dependencies] - require_libraries = ["'%s'" % key for key in dependencies] + for key in _d] + require_libraries = ["'%s'" % key for key in _d] return dict( config_items=require_conf_items, libraries=require_libraries @@ -101,7 +102,18 @@ def produce_require_configuration(dependencies, jshost): def produce_html_script_list(dependencies): + _d = ensure_echarts_is_in_the_front(dependencies) script_list = [ '%s' % DEFAULT_JS_LIBRARIES.get(key, key) - for key in dependencies] + for key in _d] return script_list + + +def ensure_echarts_is_in_the_front(dependencies): + # make sure echarts is the item in the list + # require(['echarts'....], function(ec) {..}) need it to be first + # but dependencies is a set so has no sequence + if len(dependencies) > 1: + dependencies.remove('echarts') + dependencies = ['echarts'] + list(dependencies) + return dependencies diff --git a/setup.py b/setup.py index a806a273..c389c55e 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ except: __title__ = 'pyecharts' __description__ = 'Python echarts, make charting easier' __url__ = 'https://github.com/chenjiandongx/pyecharts' -__version__ = '0.1.9.6' +__version__ = '0.1.9.7' __author__ = 'chenjiandongx' __author_email__ = 'chenjiandongx@qq.com' __license__ = 'MIT'