mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
* 格式化 setup.py * Fix: #504 修复 markpoint 标记点标注不显示的 bug * Update: changelog 文档更新 * Update: 文档更新 * Reformat: make white happy * Add: 新增 test_js_event.py 测试文件 * Update: 文档完善 * Update: changelog update * Update: api docs update * Update: DOCS UPDATE * Add: 新增 test_js_function.py 测试文件 * Add: 新增测试断言 * Update: fix borken test * Fix demo for translator docs * 📚 update the import location of Date * 💚 update test cases * Refactor translator docs * Update translator docs * Add technical_docs * Update: update translator.md * Update: update .gitgnore for vscode * Update: advanced.md update * Merge branch 'docs-for-v050' of github.com:chenjiandongx/pyecharts into docs-for-v050 # Conflicts: # docs/zh-cn/advanced.md # docs/zh-cn/translator.md * 📚 minor doc update * 👕 fix grammar
35 lines
893 B
Python
35 lines
893 B
Python
#!/usr/bin/env python
|
|
# coding=utf-8
|
|
from __future__ import unicode_literals
|
|
|
|
from pyecharts import Geo, Style
|
|
|
|
|
|
def geo_formatter(params):
|
|
return params.name + ' : ' + params.value[2]
|
|
|
|
|
|
def test_geo_formatter_func():
|
|
style = Style(
|
|
title_color="#fff",
|
|
title_pos="center",
|
|
width=1200,
|
|
height=600,
|
|
background_color='#404a59',
|
|
)
|
|
data = [('汕头市', 50), ('汕尾市', 60), ('揭阳市', 35), ('阳江市', 44), ('肇庆市', 72)]
|
|
geo = Geo("广东城市空气质量", "data from pm2.5", **style.init_style)
|
|
attr, value = geo.cast(data)
|
|
geo.add(
|
|
"",
|
|
attr,
|
|
value,
|
|
maptype='广东',
|
|
type="effectScatter",
|
|
tooltip_formatter=geo_formatter,
|
|
is_random=True,
|
|
effect_scale=5,
|
|
is_legend_show=False,
|
|
)
|
|
assert "function geo_formatter(" in geo._repr_html_()
|