mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
code format
This commit is contained in:
parent
1e1ea55cbc
commit
024c41824c
@ -21,9 +21,9 @@ class Base(ChartMixin):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: Union[InitOpts, dict] = InitOpts(),
|
||||
render_opts: Union[RenderOpts, dict] = RenderOpts()
|
||||
self,
|
||||
init_opts: Union[InitOpts, dict] = InitOpts(),
|
||||
render_opts: Union[RenderOpts, dict] = RenderOpts(),
|
||||
):
|
||||
_opts = init_opts
|
||||
if isinstance(init_opts, InitOpts):
|
||||
@ -117,10 +117,10 @@ class Base(ChartMixin):
|
||||
self._use_theme()
|
||||
|
||||
self._render_cache.clear()
|
||||
if self.render_options.get('embed_js'):
|
||||
self._render_cache['javascript'] = (
|
||||
self.load_javascript().load_javascript_contents()
|
||||
)
|
||||
if self.render_options.get("embed_js"):
|
||||
self._render_cache[
|
||||
"javascript"
|
||||
] = self.load_javascript().load_javascript_contents()
|
||||
|
||||
|
||||
def default(o):
|
||||
|
||||
@ -14,9 +14,9 @@ class Calendar(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.options.update(calendar=opts.CalendarOpts().opts)
|
||||
|
||||
@ -10,9 +10,9 @@ from ...globals import ChartType
|
||||
|
||||
class GeoChartBase(Chart):
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.set_global_opts()
|
||||
|
||||
@ -14,9 +14,9 @@ class HeatMap(RectChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.set_global_opts(visualmap_opts=opts.VisualMapOpts(orient="horizontal"))
|
||||
|
||||
@ -15,9 +15,9 @@ class Kline(RectChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.set_global_opts(
|
||||
|
||||
@ -12,9 +12,9 @@ class Liquid(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.js_dependencies.add("echarts-liquidfill")
|
||||
|
||||
@ -13,9 +13,9 @@ class Parallel(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.options.update(parallel=opts.ParallelOpts().opts)
|
||||
|
||||
@ -13,9 +13,9 @@ class Polar(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.add_schema()
|
||||
@ -49,9 +49,7 @@ class Polar(Chart):
|
||||
itemstyle_opts: types.ItemStyle = None,
|
||||
):
|
||||
self._append_legend(series_name)
|
||||
self.options.update(polar={
|
||||
"center": center if center else ["50%", "50%"]
|
||||
})
|
||||
self.options.update(polar={"center": center if center else ["50%", "50%"]})
|
||||
|
||||
if type_ in (ChartType.SCATTER, ChartType.LINE, ChartType.BAR):
|
||||
self.options.get("series").append(
|
||||
|
||||
@ -26,7 +26,6 @@ class Radar(Chart):
|
||||
angleaxis_opts: types.AngleAxis = None,
|
||||
polar_opts: types.Polar = None,
|
||||
):
|
||||
|
||||
self.options.update(
|
||||
radiusAxis=radiusaxis_opts, angleAxis=angleaxis_opts, polar=polar_opts
|
||||
)
|
||||
|
||||
@ -29,7 +29,7 @@ class Sankey(Chart):
|
||||
layout_iterations: types.Numeric = 32,
|
||||
orient: str = "horizontal",
|
||||
is_draggable: bool = True,
|
||||
focus_node_mode: str = 'none',
|
||||
focus_node_mode: str = "none",
|
||||
levels: types.SankeyLevel = None,
|
||||
label_opts: types.Label = opts.LabelOpts(),
|
||||
linestyle_opt: types.LineStyle = opts.LineStyleOpts(),
|
||||
|
||||
@ -32,9 +32,9 @@ class WordCloud(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.js_dependencies.add("echarts-wordcloud")
|
||||
@ -93,9 +93,7 @@ class WordCloud(Chart):
|
||||
):
|
||||
data = []
|
||||
for n, v in data_pair:
|
||||
data.append(
|
||||
{"name": n, "value": v, "textStyle": {"color": gen_color()}}
|
||||
)
|
||||
data.append({"name": n, "value": v, "textStyle": {"color": gen_color()}})
|
||||
|
||||
word_size_range = word_size_range or (12, 60)
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@ from ..types import Optional, Sequence
|
||||
|
||||
class Chart(Base):
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
if isinstance(init_opts, dict):
|
||||
temp_opts = opts.InitOpts()
|
||||
@ -18,8 +18,7 @@ class Chart(Base):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
# Change to Echarts V5 default color list
|
||||
self.colors = (
|
||||
"#5470c6 #91cc75 #fac858 #ee6666 #73c0de #3ba272 #fc8452 #9a60b4 "
|
||||
"#ea7ccc"
|
||||
"#5470c6 #91cc75 #fac858 #ee6666 #73c0de #3ba272 #fc8452 #9a60b4 " "#ea7ccc"
|
||||
).split()
|
||||
self.default_color_n = len(self.colors)
|
||||
if init_opts.opts.get("theme") == ThemeType.WHITE:
|
||||
@ -34,7 +33,7 @@ class Chart(Base):
|
||||
def set_dark_mode(
|
||||
self,
|
||||
dark_mode_colors: Optional[Sequence[str]] = None,
|
||||
dark_mode_bg_color: str = "#100C2A"
|
||||
dark_mode_bg_color: str = "#100C2A",
|
||||
):
|
||||
# [Hard Code Here] The Echarts default Dark Mode Configurations
|
||||
if dark_mode_colors is None:
|
||||
@ -193,24 +192,26 @@ class Chart(Base):
|
||||
)
|
||||
else:
|
||||
self.options.update(
|
||||
dataset=[{
|
||||
"source": source,
|
||||
"dimensions": dimensions,
|
||||
"sourceHeader": source_header,
|
||||
"transform": transform,
|
||||
"fromDatasetIndex": from_dataset_index,
|
||||
"fromDatasetId": from_dataset_id,
|
||||
"fromTransformResult": from_transform_result,
|
||||
}]
|
||||
dataset=[
|
||||
{
|
||||
"source": source,
|
||||
"dimensions": dimensions,
|
||||
"sourceHeader": source_header,
|
||||
"transform": transform,
|
||||
"fromDatasetIndex": from_dataset_index,
|
||||
"fromDatasetId": from_dataset_id,
|
||||
"fromTransformResult": from_transform_result,
|
||||
}
|
||||
]
|
||||
)
|
||||
return self
|
||||
|
||||
|
||||
class RectChart(Chart):
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.options.update(xAxis=[opts.AxisOpts().opts], yAxis=[opts.AxisOpts().opts])
|
||||
@ -252,7 +253,7 @@ class RectChart(Chart):
|
||||
)
|
||||
self.options.get("series").extend(chart.options.get("series"))
|
||||
# to merge colors of chart
|
||||
for c in chart.colors[:len(chart.colors) - self.default_color_n]:
|
||||
for c in chart.colors[: len(chart.colors) - self.default_color_n]:
|
||||
self.colors.insert(len(self.colors) - self.default_color_n, c)
|
||||
return self
|
||||
|
||||
@ -263,9 +264,9 @@ class Chart3D(Chart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
init_opts.renderer = RenderType.CANVAS
|
||||
super().__init__(init_opts, render_opts)
|
||||
@ -376,7 +377,7 @@ class ThreeAxisChart(Chart3D):
|
||||
"lineStyle": wire_frame_line_style_opts,
|
||||
},
|
||||
"equation": equation,
|
||||
"parametricEquation": parametric_equation
|
||||
"parametricEquation": parametric_equation,
|
||||
}
|
||||
)
|
||||
else:
|
||||
|
||||
@ -15,9 +15,9 @@ class Grid(Base):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.options: types.Optional[dict] = None
|
||||
|
||||
@ -9,9 +9,9 @@ class Timeline(Base):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = opts.InitOpts(),
|
||||
render_opts: types.RenderInit = opts.RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts=init_opts, render_opts=render_opts)
|
||||
self.options = {"baseOption": {"series": [], "timeline": {}}, "options": []}
|
||||
@ -78,7 +78,7 @@ class Timeline(Base):
|
||||
"lineStyle": progress_linestyle_opts,
|
||||
"itemStyle": progress_itemstyle_opts,
|
||||
"label": progress_label_opts,
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
return self
|
||||
|
||||
@ -10,9 +10,9 @@ class Bar3D(ThreeAxisChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.BAR3D
|
||||
|
||||
@ -12,9 +12,9 @@ class GraphGL(Chart3D):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.GRAPHGL
|
||||
|
||||
@ -10,9 +10,9 @@ class Line3D(ThreeAxisChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.LINE3D
|
||||
|
||||
@ -11,9 +11,9 @@ class Lines3D(Chart3D):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.LINES3D
|
||||
|
||||
@ -11,9 +11,9 @@ class Map3D(Chart3D):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.MAP3D
|
||||
|
||||
@ -18,9 +18,9 @@ class MapGlobe(Chart3D, MapMixin):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
|
||||
|
||||
@ -10,9 +10,9 @@ class Scatter3D(ThreeAxisChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.SCATTER3D
|
||||
|
||||
@ -11,9 +11,9 @@ class Surface3D(ThreeAxisChart):
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts()
|
||||
self,
|
||||
init_opts: types.Init = InitOpts(),
|
||||
render_opts: types.RenderInit = RenderOpts(),
|
||||
):
|
||||
super().__init__(init_opts, render_opts)
|
||||
self._3d_chart_type = ChartType.SURFACE
|
||||
|
||||
@ -86,7 +86,7 @@ class AriaLabelOpts(BasicOpts):
|
||||
"separator": {
|
||||
"middle": series_multiple_separator_middle,
|
||||
"end": series_multiple_separator_end,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
"data": {
|
||||
@ -98,8 +98,8 @@ class AriaLabelOpts(BasicOpts):
|
||||
"separator": {
|
||||
"middle": data_separator_middle,
|
||||
"end": data_separator_end,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ class AriaDecalOpts(BasicOpts):
|
||||
"rotation": decals_rotation,
|
||||
"maxTileWidth": decals_max_tile_width,
|
||||
"maxTileHeight": decals_max_tile_height,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ class InitOpts(BasicOpts):
|
||||
is_fill_bg_color: bool = False,
|
||||
js_host: str = "",
|
||||
animation_opts: Union[AnimationOpts, dict] = AnimationOpts(),
|
||||
aria_opts: Union[AriaOpts, dict] = AriaOpts()
|
||||
aria_opts: Union[AriaOpts, dict] = AriaOpts(),
|
||||
):
|
||||
self.opts: dict = {
|
||||
"width": width,
|
||||
|
||||
@ -75,11 +75,11 @@ class Javascript:
|
||||
resp: Optional[http.client.HTTPResponse] = None
|
||||
try:
|
||||
conn = http.client.HTTPSConnection(host, port)
|
||||
conn.request('GET', path)
|
||||
conn.request("GET", path)
|
||||
resp = conn.getresponse()
|
||||
if resp.status != 200:
|
||||
raise RuntimeError('Cannot load JavaScript lib: %s' % lib)
|
||||
self.javascript_contents[lib] = resp.read().decode('utf-8')
|
||||
raise RuntimeError("Cannot load JavaScript lib: %s" % lib)
|
||||
self.javascript_contents[lib] = resp.read().decode("utf-8")
|
||||
finally:
|
||||
if resp is not None:
|
||||
resp.close()
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import os
|
||||
|
||||
try:
|
||||
from collections.abc import Iterable
|
||||
except ImportError:
|
||||
|
||||
6
test.py
6
test.py
@ -4,8 +4,10 @@ import os
|
||||
# os.system("nosetests --with-coverage --cover-package pyecharts --cover-package .")
|
||||
|
||||
# current nose
|
||||
os.system("nose2 --with-coverage --coverage pyecharts "
|
||||
"--coverage-config .coveragerc -s test")
|
||||
os.system(
|
||||
"nose2 --with-coverage --coverage pyecharts "
|
||||
"--coverage-config .coveragerc -s test"
|
||||
)
|
||||
|
||||
# pytest
|
||||
os.system("pytest -cov-config=.coveragerc --cov=./ test/")
|
||||
|
||||
@ -2,7 +2,7 @@ import sys
|
||||
|
||||
|
||||
class ConsoleOutputRedirect:
|
||||
""" Wrapper to redirect stdout or stderr """
|
||||
"""Wrapper to redirect stdout or stderr"""
|
||||
|
||||
def __init__(self, fp):
|
||||
self.fp = fp
|
||||
|
||||
@ -55,22 +55,24 @@ def test_render_embed_js(_):
|
||||
c = Base(render_opts=RenderOpts(embed_js=True))
|
||||
# Embedded JavaScript
|
||||
content = c.render_embed()
|
||||
assert_not_in(CurrentConfig.ONLINE_HOST, content, 'Embedding JavaScript fails')
|
||||
assert_not_in(CurrentConfig.ONLINE_HOST, content, "Embedding JavaScript fails")
|
||||
# No embedded JavaScript
|
||||
c.render_options.update(embed_js=False)
|
||||
content = c.render_embed()
|
||||
assert_in(CurrentConfig.ONLINE_HOST, content, 'Embedded JavaScript cannot be closed')
|
||||
assert_in(
|
||||
CurrentConfig.ONLINE_HOST, content, "Embedded JavaScript cannot be closed"
|
||||
)
|
||||
|
||||
|
||||
def test_base_render_options():
|
||||
c0 = Base(render_opts=RenderOpts(embed_js=True))
|
||||
assert_equal(c0.render_options.get('embed_js'), True)
|
||||
assert_equal(c0.render_options.get("embed_js"), True)
|
||||
|
||||
|
||||
def test_base_iso_format():
|
||||
mock_time_str = "2022-04-14 14:42:00"
|
||||
mock_time = datetime.strptime(mock_time_str, "%Y-%m-%d %H:%M:%S")
|
||||
assert (default(mock_time) == "2022-04-14T14:42:00")
|
||||
assert default(mock_time) == "2022-04-14T14:42:00"
|
||||
|
||||
|
||||
def test_base_animation_option():
|
||||
|
||||
@ -47,26 +47,23 @@ def test_calendar_setting(fake_writer):
|
||||
for i in range((end - begin).days + 1)
|
||||
]
|
||||
|
||||
c = (
|
||||
Calendar()
|
||||
.add(
|
||||
"",
|
||||
data,
|
||||
calendar_opts=opts.CalendarOpts(
|
||||
range_="2017",
|
||||
cell_size=15,
|
||||
daylabel_opts=opts.CalendarDayLabelOpts(name_map="cn"),
|
||||
monthlabel_opts=opts.CalendarMonthLabelOpts(name_map="cn"),
|
||||
),
|
||||
visualmap_opts=opts.VisualMapOpts(
|
||||
max_=20000,
|
||||
min_=500,
|
||||
orient="horizontal",
|
||||
is_piecewise=True,
|
||||
pos_top="230px",
|
||||
pos_left="100px",
|
||||
)
|
||||
)
|
||||
c = Calendar().add(
|
||||
"",
|
||||
data,
|
||||
calendar_opts=opts.CalendarOpts(
|
||||
range_="2017",
|
||||
cell_size=15,
|
||||
daylabel_opts=opts.CalendarDayLabelOpts(name_map="cn"),
|
||||
monthlabel_opts=opts.CalendarMonthLabelOpts(name_map="cn"),
|
||||
),
|
||||
visualmap_opts=opts.VisualMapOpts(
|
||||
max_=20000,
|
||||
min_=500,
|
||||
orient="horizontal",
|
||||
is_piecewise=True,
|
||||
pos_top="230px",
|
||||
pos_left="100px",
|
||||
),
|
||||
)
|
||||
c.render()
|
||||
_, content = fake_writer.call_args[0]
|
||||
|
||||
@ -247,7 +247,7 @@ def test_chart_extend_axis(fake_writer):
|
||||
xaxis=opts.AxisOpts(),
|
||||
yaxis=opts.AxisOpts(
|
||||
axislabel_opts=opts.LabelOpts(formatter="{value} °C"), interval=5
|
||||
)
|
||||
),
|
||||
)
|
||||
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
|
||||
.set_global_opts(
|
||||
|
||||
@ -9,11 +9,10 @@ from pyecharts.commons.utils import JsCode
|
||||
|
||||
@patch("pyecharts.render.engine.write_utf8_html_file")
|
||||
def test_custom_base(fake_writer):
|
||||
c = (
|
||||
Custom()
|
||||
.add(
|
||||
series_name="",
|
||||
render_item=JsCode("""
|
||||
c = Custom().add(
|
||||
series_name="",
|
||||
render_item=JsCode(
|
||||
"""
|
||||
function (params, api) {
|
||||
var categoryIndex = api.value(0);
|
||||
var start = api.coord([api.value(1), categoryIndex]);
|
||||
@ -36,9 +35,9 @@ def test_custom_base(fake_writer):
|
||||
style: api.style()
|
||||
};
|
||||
}
|
||||
"""),
|
||||
data=None,
|
||||
)
|
||||
"""
|
||||
),
|
||||
data=None,
|
||||
)
|
||||
c.render()
|
||||
_, content = fake_writer.call_args[0]
|
||||
|
||||
@ -28,7 +28,7 @@ def test_register_url(fake):
|
||||
{
|
||||
"安庆": file_name,
|
||||
"English Name": file_name,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
fake_registry_1 = os.path.join(current_path, "fixtures", "registry_1.json")
|
||||
@ -40,7 +40,7 @@ def test_register_url(fake):
|
||||
{
|
||||
"安庆": file_name,
|
||||
"English Name": file_name,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ def test_geo_catch_nonexistent_coord_exception():
|
||||
)
|
||||
except NonexistentCoordinatesException as err:
|
||||
assert_equal(type(err), NonexistentCoordinatesException)
|
||||
assert err.__str__() != ''
|
||||
assert err.__str__() != ""
|
||||
|
||||
|
||||
def test_geo_ignore_nonexistent_coord_exception():
|
||||
|
||||
@ -15,7 +15,6 @@ def test_img_path():
|
||||
|
||||
|
||||
def test_collector():
|
||||
|
||||
def _add(x, y):
|
||||
return x + y
|
||||
|
||||
|
||||
761
test/test_geo.py
761
test/test_geo.py
@ -178,616 +178,163 @@ def test_geo_add_geo_json():
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
118.57812,
|
||||
26.557402
|
||||
],
|
||||
[
|
||||
118.590394,
|
||||
26.553081
|
||||
],
|
||||
[
|
||||
118.617087,
|
||||
26.553059
|
||||
],
|
||||
[
|
||||
118.616111,
|
||||
26.527755
|
||||
],
|
||||
[
|
||||
118.604148,
|
||||
26.504904
|
||||
],
|
||||
[
|
||||
118.608376,
|
||||
26.497294
|
||||
],
|
||||
[
|
||||
118.59623,
|
||||
26.478385
|
||||
],
|
||||
[
|
||||
118.578807,
|
||||
26.473754
|
||||
],
|
||||
[
|
||||
118.56458,
|
||||
26.465373
|
||||
],
|
||||
[
|
||||
118.554474,
|
||||
26.445927
|
||||
],
|
||||
[
|
||||
118.566533,
|
||||
26.432851
|
||||
],
|
||||
[
|
||||
118.54632,
|
||||
26.417928
|
||||
],
|
||||
[
|
||||
118.548079,
|
||||
26.396854
|
||||
],
|
||||
[
|
||||
118.560868,
|
||||
26.378456
|
||||
],
|
||||
[
|
||||
118.566104,
|
||||
26.358824
|
||||
],
|
||||
[
|
||||
118.589836,
|
||||
26.373463
|
||||
],
|
||||
[
|
||||
118.590222,
|
||||
26.359802
|
||||
],
|
||||
[
|
||||
118.595801,
|
||||
26.347859
|
||||
],
|
||||
[
|
||||
118.60369,
|
||||
26.350515
|
||||
],
|
||||
[
|
||||
118.621191,
|
||||
26.361783
|
||||
],
|
||||
[
|
||||
118.631475,
|
||||
26.354788
|
||||
],
|
||||
[
|
||||
118.656162,
|
||||
26.340797
|
||||
],
|
||||
[
|
||||
118.662964,
|
||||
26.322656
|
||||
],
|
||||
[
|
||||
118.653222,
|
||||
26.313452
|
||||
],
|
||||
[
|
||||
118.661204,
|
||||
26.296272
|
||||
],
|
||||
[
|
||||
118.664809,
|
||||
26.270524
|
||||
],
|
||||
[
|
||||
118.678076,
|
||||
26.279442
|
||||
],
|
||||
[
|
||||
118.68585,
|
||||
26.28836
|
||||
],
|
||||
[
|
||||
118.697277,
|
||||
26.287725
|
||||
],
|
||||
[
|
||||
118.693599,
|
||||
26.305557
|
||||
],
|
||||
[
|
||||
118.699533,
|
||||
26.311078
|
||||
],
|
||||
[
|
||||
118.724644,
|
||||
26.337465
|
||||
],
|
||||
[
|
||||
118.75152,
|
||||
26.330542
|
||||
],
|
||||
[
|
||||
118.76682,
|
||||
26.327157
|
||||
],
|
||||
[
|
||||
118.775794,
|
||||
26.325234
|
||||
],
|
||||
[
|
||||
118.797129,
|
||||
26.340542
|
||||
],
|
||||
[
|
||||
118.800059,
|
||||
26.357136
|
||||
],
|
||||
[
|
||||
118.785137,
|
||||
26.365115
|
||||
],
|
||||
[
|
||||
118.771085,
|
||||
26.385377
|
||||
],
|
||||
[
|
||||
118.750534,
|
||||
26.390836
|
||||
],
|
||||
[
|
||||
118.761617,
|
||||
26.420202
|
||||
],
|
||||
[
|
||||
118.745161,
|
||||
26.427236
|
||||
],
|
||||
[
|
||||
118.732826,
|
||||
26.437957
|
||||
],
|
||||
[
|
||||
118.734248,
|
||||
26.45448
|
||||
],
|
||||
[
|
||||
118.737767,
|
||||
26.472405
|
||||
],
|
||||
[
|
||||
118.748152,
|
||||
26.481723
|
||||
],
|
||||
[
|
||||
118.754353,
|
||||
26.487893
|
||||
],
|
||||
[
|
||||
118.748195,
|
||||
26.494063
|
||||
],
|
||||
[
|
||||
118.748238,
|
||||
26.506403
|
||||
],
|
||||
[
|
||||
118.762057,
|
||||
26.508959
|
||||
],
|
||||
[
|
||||
118.780881,
|
||||
26.504741
|
||||
],
|
||||
[
|
||||
118.784598,
|
||||
26.491919
|
||||
],
|
||||
[
|
||||
118.798615,
|
||||
26.484013
|
||||
],
|
||||
[
|
||||
118.805766,
|
||||
26.474876
|
||||
],
|
||||
[
|
||||
118.794544,
|
||||
26.459227
|
||||
],
|
||||
[
|
||||
118.809178,
|
||||
26.445137
|
||||
],
|
||||
[
|
||||
118.805487,
|
||||
26.430479
|
||||
],
|
||||
[
|
||||
118.822825,
|
||||
26.420838
|
||||
],
|
||||
[
|
||||
118.85278,
|
||||
26.438461
|
||||
],
|
||||
[
|
||||
118.878615,
|
||||
26.469605
|
||||
],
|
||||
[
|
||||
118.898227,
|
||||
26.473649
|
||||
],
|
||||
[
|
||||
118.91784,
|
||||
26.472777
|
||||
],
|
||||
[
|
||||
118.949511,
|
||||
26.464885
|
||||
],
|
||||
[
|
||||
118.951619,
|
||||
26.487056
|
||||
],
|
||||
[
|
||||
118.943747,
|
||||
26.493838
|
||||
],
|
||||
[
|
||||
118.942741,
|
||||
26.507994
|
||||
],
|
||||
[
|
||||
118.962064,
|
||||
26.530816
|
||||
],
|
||||
[
|
||||
118.997866,
|
||||
26.528448
|
||||
],
|
||||
[
|
||||
119.000968,
|
||||
26.556946
|
||||
],
|
||||
[
|
||||
119.009563,
|
||||
26.560258
|
||||
],
|
||||
[
|
||||
119.015767,
|
||||
26.581621
|
||||
],
|
||||
[
|
||||
119.032957,
|
||||
26.594999
|
||||
],
|
||||
[
|
||||
119.062507,
|
||||
26.602235
|
||||
],
|
||||
[
|
||||
119.075945,
|
||||
26.587083
|
||||
],
|
||||
[
|
||||
119.06329,
|
||||
26.569473
|
||||
],
|
||||
[
|
||||
119.076433,
|
||||
26.569869
|
||||
],
|
||||
[
|
||||
119.092152,
|
||||
26.562702
|
||||
],
|
||||
[
|
||||
119.101005,
|
||||
26.572732
|
||||
],
|
||||
[
|
||||
119.103604,
|
||||
26.555941
|
||||
],
|
||||
[
|
||||
119.119788,
|
||||
26.539555
|
||||
],
|
||||
[
|
||||
119.132,
|
||||
26.538732
|
||||
],
|
||||
[
|
||||
119.144213,
|
||||
26.536681
|
||||
],
|
||||
[
|
||||
119.171383,
|
||||
26.548551
|
||||
],
|
||||
[
|
||||
119.194922,
|
||||
26.568383
|
||||
],
|
||||
[
|
||||
119.212185,
|
||||
26.547589
|
||||
],
|
||||
[
|
||||
119.218757,
|
||||
26.53412
|
||||
],
|
||||
[
|
||||
119.229448,
|
||||
26.526792
|
||||
],
|
||||
[
|
||||
119.251174,
|
||||
26.53241
|
||||
],
|
||||
[
|
||||
119.253859,
|
||||
26.546561
|
||||
],
|
||||
[
|
||||
119.272336,
|
||||
26.541055
|
||||
],
|
||||
[
|
||||
119.281139,
|
||||
26.534343
|
||||
],
|
||||
[
|
||||
119.287711,
|
||||
26.577995
|
||||
],
|
||||
[
|
||||
119.301835,
|
||||
26.593391
|
||||
],
|
||||
[
|
||||
119.329006,
|
||||
26.578699
|
||||
],
|
||||
[
|
||||
119.354338,
|
||||
26.599587
|
||||
],
|
||||
[
|
||||
119.363191,
|
||||
26.603281
|
||||
],
|
||||
[
|
||||
119.376544,
|
||||
26.604515
|
||||
],
|
||||
[
|
||||
119.381656,
|
||||
26.62171
|
||||
],
|
||||
[
|
||||
119.397376,
|
||||
26.627859
|
||||
],
|
||||
[
|
||||
119.387272,
|
||||
26.641423
|
||||
],
|
||||
[
|
||||
119.375795,
|
||||
26.639028
|
||||
],
|
||||
[
|
||||
119.358824,
|
||||
26.632951
|
||||
],
|
||||
[
|
||||
119.351467,
|
||||
26.648969
|
||||
],
|
||||
[
|
||||
119.326158,
|
||||
26.676212
|
||||
],
|
||||
[
|
||||
119.261119,
|
||||
26.690807
|
||||
],
|
||||
[
|
||||
119.241593,
|
||||
26.742684
|
||||
],
|
||||
[
|
||||
119.226535,
|
||||
26.728854
|
||||
],
|
||||
[
|
||||
119.204611,
|
||||
26.727288
|
||||
],
|
||||
[
|
||||
119.182686,
|
||||
26.729403
|
||||
],
|
||||
[
|
||||
119.167628,
|
||||
26.711891
|
||||
],
|
||||
[
|
||||
119.146452,
|
||||
26.731884
|
||||
],
|
||||
[
|
||||
119.115663,
|
||||
26.73961
|
||||
],
|
||||
[
|
||||
119.047905,
|
||||
26.728693
|
||||
],
|
||||
[
|
||||
119.045955,
|
||||
26.74669
|
||||
],
|
||||
[
|
||||
119.054992,
|
||||
26.764685
|
||||
],
|
||||
[
|
||||
119.051092,
|
||||
26.776147
|
||||
],
|
||||
[
|
||||
119.042385,
|
||||
26.776575
|
||||
],
|
||||
[
|
||||
119.033679,
|
||||
26.770872
|
||||
],
|
||||
[
|
||||
119.012146,
|
||||
26.761305
|
||||
],
|
||||
[
|
||||
118.982497,
|
||||
26.773075
|
||||
],
|
||||
[
|
||||
118.945981,
|
||||
26.77013
|
||||
],
|
||||
[
|
||||
118.926007,
|
||||
26.749652
|
||||
],
|
||||
[
|
||||
118.882686,
|
||||
26.738982
|
||||
],
|
||||
[
|
||||
118.887478,
|
||||
26.757469
|
||||
],
|
||||
[
|
||||
118.903255,
|
||||
26.76737
|
||||
],
|
||||
[
|
||||
118.923824,
|
||||
26.795751
|
||||
],
|
||||
[
|
||||
118.890803,
|
||||
26.813278
|
||||
],
|
||||
[
|
||||
118.843328,
|
||||
26.798569
|
||||
],
|
||||
[
|
||||
118.827143,
|
||||
26.786924
|
||||
],
|
||||
[
|
||||
118.795852,
|
||||
26.783859
|
||||
],
|
||||
[
|
||||
118.771428,
|
||||
26.805618
|
||||
],
|
||||
[
|
||||
118.741511,
|
||||
26.818793
|
||||
],
|
||||
[
|
||||
118.728195,
|
||||
26.830895
|
||||
],
|
||||
[
|
||||
118.722432,
|
||||
26.851573
|
||||
],
|
||||
[
|
||||
118.739746,
|
||||
26.856167
|
||||
],
|
||||
[
|
||||
118.696095,
|
||||
26.869031
|
||||
],
|
||||
[
|
||||
118.664633,
|
||||
26.86214
|
||||
],
|
||||
[
|
||||
118.63317,
|
||||
26.855248
|
||||
],
|
||||
[
|
||||
118.620069,
|
||||
26.839818
|
||||
],
|
||||
[
|
||||
118.635807,
|
||||
26.832963
|
||||
],
|
||||
[
|
||||
118.638444,
|
||||
26.810674
|
||||
],
|
||||
[
|
||||
118.625974,
|
||||
26.788073
|
||||
],
|
||||
[
|
||||
118.623117,
|
||||
26.769147
|
||||
],
|
||||
[
|
||||
118.600382,
|
||||
26.7093
|
||||
],
|
||||
[
|
||||
118.582339,
|
||||
26.703842
|
||||
],
|
||||
[
|
||||
118.569788,
|
||||
26.680592
|
||||
],
|
||||
[
|
||||
118.57902,
|
||||
26.673354
|
||||
],
|
||||
[
|
||||
118.594415,
|
||||
26.673546
|
||||
],
|
||||
[
|
||||
118.594991,
|
||||
26.656748
|
||||
],
|
||||
[
|
||||
118.587905,
|
||||
26.631739
|
||||
],
|
||||
[
|
||||
118.57812,
|
||||
26.557402
|
||||
]
|
||||
[118.57812, 26.557402],
|
||||
[118.590394, 26.553081],
|
||||
[118.617087, 26.553059],
|
||||
[118.616111, 26.527755],
|
||||
[118.604148, 26.504904],
|
||||
[118.608376, 26.497294],
|
||||
[118.59623, 26.478385],
|
||||
[118.578807, 26.473754],
|
||||
[118.56458, 26.465373],
|
||||
[118.554474, 26.445927],
|
||||
[118.566533, 26.432851],
|
||||
[118.54632, 26.417928],
|
||||
[118.548079, 26.396854],
|
||||
[118.560868, 26.378456],
|
||||
[118.566104, 26.358824],
|
||||
[118.589836, 26.373463],
|
||||
[118.590222, 26.359802],
|
||||
[118.595801, 26.347859],
|
||||
[118.60369, 26.350515],
|
||||
[118.621191, 26.361783],
|
||||
[118.631475, 26.354788],
|
||||
[118.656162, 26.340797],
|
||||
[118.662964, 26.322656],
|
||||
[118.653222, 26.313452],
|
||||
[118.661204, 26.296272],
|
||||
[118.664809, 26.270524],
|
||||
[118.678076, 26.279442],
|
||||
[118.68585, 26.28836],
|
||||
[118.697277, 26.287725],
|
||||
[118.693599, 26.305557],
|
||||
[118.699533, 26.311078],
|
||||
[118.724644, 26.337465],
|
||||
[118.75152, 26.330542],
|
||||
[118.76682, 26.327157],
|
||||
[118.775794, 26.325234],
|
||||
[118.797129, 26.340542],
|
||||
[118.800059, 26.357136],
|
||||
[118.785137, 26.365115],
|
||||
[118.771085, 26.385377],
|
||||
[118.750534, 26.390836],
|
||||
[118.761617, 26.420202],
|
||||
[118.745161, 26.427236],
|
||||
[118.732826, 26.437957],
|
||||
[118.734248, 26.45448],
|
||||
[118.737767, 26.472405],
|
||||
[118.748152, 26.481723],
|
||||
[118.754353, 26.487893],
|
||||
[118.748195, 26.494063],
|
||||
[118.748238, 26.506403],
|
||||
[118.762057, 26.508959],
|
||||
[118.780881, 26.504741],
|
||||
[118.784598, 26.491919],
|
||||
[118.798615, 26.484013],
|
||||
[118.805766, 26.474876],
|
||||
[118.794544, 26.459227],
|
||||
[118.809178, 26.445137],
|
||||
[118.805487, 26.430479],
|
||||
[118.822825, 26.420838],
|
||||
[118.85278, 26.438461],
|
||||
[118.878615, 26.469605],
|
||||
[118.898227, 26.473649],
|
||||
[118.91784, 26.472777],
|
||||
[118.949511, 26.464885],
|
||||
[118.951619, 26.487056],
|
||||
[118.943747, 26.493838],
|
||||
[118.942741, 26.507994],
|
||||
[118.962064, 26.530816],
|
||||
[118.997866, 26.528448],
|
||||
[119.000968, 26.556946],
|
||||
[119.009563, 26.560258],
|
||||
[119.015767, 26.581621],
|
||||
[119.032957, 26.594999],
|
||||
[119.062507, 26.602235],
|
||||
[119.075945, 26.587083],
|
||||
[119.06329, 26.569473],
|
||||
[119.076433, 26.569869],
|
||||
[119.092152, 26.562702],
|
||||
[119.101005, 26.572732],
|
||||
[119.103604, 26.555941],
|
||||
[119.119788, 26.539555],
|
||||
[119.132, 26.538732],
|
||||
[119.144213, 26.536681],
|
||||
[119.171383, 26.548551],
|
||||
[119.194922, 26.568383],
|
||||
[119.212185, 26.547589],
|
||||
[119.218757, 26.53412],
|
||||
[119.229448, 26.526792],
|
||||
[119.251174, 26.53241],
|
||||
[119.253859, 26.546561],
|
||||
[119.272336, 26.541055],
|
||||
[119.281139, 26.534343],
|
||||
[119.287711, 26.577995],
|
||||
[119.301835, 26.593391],
|
||||
[119.329006, 26.578699],
|
||||
[119.354338, 26.599587],
|
||||
[119.363191, 26.603281],
|
||||
[119.376544, 26.604515],
|
||||
[119.381656, 26.62171],
|
||||
[119.397376, 26.627859],
|
||||
[119.387272, 26.641423],
|
||||
[119.375795, 26.639028],
|
||||
[119.358824, 26.632951],
|
||||
[119.351467, 26.648969],
|
||||
[119.326158, 26.676212],
|
||||
[119.261119, 26.690807],
|
||||
[119.241593, 26.742684],
|
||||
[119.226535, 26.728854],
|
||||
[119.204611, 26.727288],
|
||||
[119.182686, 26.729403],
|
||||
[119.167628, 26.711891],
|
||||
[119.146452, 26.731884],
|
||||
[119.115663, 26.73961],
|
||||
[119.047905, 26.728693],
|
||||
[119.045955, 26.74669],
|
||||
[119.054992, 26.764685],
|
||||
[119.051092, 26.776147],
|
||||
[119.042385, 26.776575],
|
||||
[119.033679, 26.770872],
|
||||
[119.012146, 26.761305],
|
||||
[118.982497, 26.773075],
|
||||
[118.945981, 26.77013],
|
||||
[118.926007, 26.749652],
|
||||
[118.882686, 26.738982],
|
||||
[118.887478, 26.757469],
|
||||
[118.903255, 26.76737],
|
||||
[118.923824, 26.795751],
|
||||
[118.890803, 26.813278],
|
||||
[118.843328, 26.798569],
|
||||
[118.827143, 26.786924],
|
||||
[118.795852, 26.783859],
|
||||
[118.771428, 26.805618],
|
||||
[118.741511, 26.818793],
|
||||
[118.728195, 26.830895],
|
||||
[118.722432, 26.851573],
|
||||
[118.739746, 26.856167],
|
||||
[118.696095, 26.869031],
|
||||
[118.664633, 26.86214],
|
||||
[118.63317, 26.855248],
|
||||
[118.620069, 26.839818],
|
||||
[118.635807, 26.832963],
|
||||
[118.638444, 26.810674],
|
||||
[118.625974, 26.788073],
|
||||
[118.623117, 26.769147],
|
||||
[118.600382, 26.7093],
|
||||
[118.582339, 26.703842],
|
||||
[118.569788, 26.680592],
|
||||
[118.57902, 26.673354],
|
||||
[118.594415, 26.673546],
|
||||
[118.594991, 26.656748],
|
||||
[118.587905, 26.631739],
|
||||
[118.57812, 26.557402],
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
"type": "Polygon",
|
||||
},
|
||||
}
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
c = Geo()
|
||||
|
||||
@ -66,7 +66,7 @@ def test_aria_label_options_remove_none():
|
||||
"separator": {
|
||||
"middle": ";",
|
||||
"end": "。",
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
"data": {
|
||||
@ -77,8 +77,8 @@ def test_aria_label_options_remove_none():
|
||||
"withoutName": "{value}",
|
||||
"separator": {
|
||||
"middle": ",",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
assert_equal(expected, remove_key_with_none_value(option.opts))
|
||||
|
||||
@ -97,7 +97,7 @@ def test_aria_decal_options_remove_none():
|
||||
"rotation": 0,
|
||||
"maxTileWidth": 512,
|
||||
"maxTileHeight": 512,
|
||||
}
|
||||
},
|
||||
}
|
||||
assert_equal(expected, remove_key_with_none_value(option.opts))
|
||||
|
||||
@ -347,8 +347,5 @@ def test_radius_axis_options_remove_none():
|
||||
|
||||
def test_dataset_transform_options_remove_none():
|
||||
option = DatasetTransformOpts()
|
||||
expected = {
|
||||
"type": "filter",
|
||||
"print": False
|
||||
}
|
||||
expected = {"type": "filter", "print": False}
|
||||
assert_equal(expected, remove_key_with_none_value(option.opts))
|
||||
|
||||
@ -14,27 +14,33 @@ def test_graph_gl_base(fake_writer):
|
||||
nodes = []
|
||||
for i in range(50):
|
||||
for j in range(50):
|
||||
nodes.append(opts.GraphGLNode(
|
||||
x=random.random() * 958,
|
||||
y=random.random() * 777,
|
||||
value=1,
|
||||
))
|
||||
nodes.append(
|
||||
opts.GraphGLNode(
|
||||
x=random.random() * 958,
|
||||
y=random.random() * 777,
|
||||
value=1,
|
||||
)
|
||||
)
|
||||
|
||||
links = []
|
||||
for i in range(50):
|
||||
for j in range(50):
|
||||
if i < 50 - 1:
|
||||
links.append(opts.GraphGLLink(
|
||||
source=i + j * 50,
|
||||
target=i + 1 + j * 50,
|
||||
value=1,
|
||||
))
|
||||
links.append(
|
||||
opts.GraphGLLink(
|
||||
source=i + j * 50,
|
||||
target=i + 1 + j * 50,
|
||||
value=1,
|
||||
)
|
||||
)
|
||||
if j < 50 - 1:
|
||||
links.append(opts.GraphGLLink(
|
||||
source=i + j * 50,
|
||||
target=i + (j + 1) * 50,
|
||||
value=1,
|
||||
))
|
||||
links.append(
|
||||
opts.GraphGLLink(
|
||||
source=i + j * 50,
|
||||
target=i + (j + 1) * 50,
|
||||
value=1,
|
||||
)
|
||||
)
|
||||
|
||||
c = (
|
||||
GraphGL(init_opts=opts.InitOpts())
|
||||
@ -47,7 +53,7 @@ def test_graph_gl_base(fake_writer):
|
||||
force_atlas2_opts=opts.GraphGLForceAtlas2Opts(
|
||||
steps=5,
|
||||
edge_weight_influence=4,
|
||||
)
|
||||
),
|
||||
)
|
||||
.set_dark_mode()
|
||||
)
|
||||
|
||||
@ -23,30 +23,28 @@ def test_graphic_group():
|
||||
|
||||
def test_graphic_image():
|
||||
image = opts.GraphicImage(
|
||||
graphic_item={"item": 1},
|
||||
graphic_imagestyle_opts={"opts": 1}
|
||||
graphic_item={"item": 1}, graphic_imagestyle_opts={"opts": 1}
|
||||
)
|
||||
expected = {
|
||||
"type": "image",
|
||||
"item": 1,
|
||||
"style": {
|
||||
"opts": 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
assert_equal(expected, remove_key_with_none_value(image.opts))
|
||||
|
||||
|
||||
def test_graphic_text():
|
||||
text = opts.GraphicText(
|
||||
graphic_item={"item": 1},
|
||||
graphic_textstyle_opts={"opts": 1}
|
||||
graphic_item={"item": 1}, graphic_textstyle_opts={"opts": 1}
|
||||
)
|
||||
expected = {
|
||||
"type": "text",
|
||||
"item": 1,
|
||||
"style": {
|
||||
"opts": 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
assert_equal(expected, remove_key_with_none_value(text.opts))
|
||||
|
||||
@ -63,6 +61,6 @@ def test_graphic_rect():
|
||||
"shape": 1,
|
||||
"style": {
|
||||
"opts": 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
assert_equal(expected, remove_key_with_none_value(rect.opts))
|
||||
|
||||
@ -178,34 +178,26 @@ def test_grid_two_radar(fake_writer):
|
||||
]
|
||||
c = (
|
||||
Radar()
|
||||
.add_schema(schema=schema, center=['25%', '50%'])
|
||||
.add_schema(schema=schema, center=["25%", "50%"])
|
||||
.add(
|
||||
series_name="预算分配",
|
||||
data=[[4300, 10000, 28000, 35000, 50000, 19000]],
|
||||
radar_index=0,
|
||||
)
|
||||
.set_global_opts(
|
||||
legend_opts=opts.LegendOpts(pos_left="20%")
|
||||
)
|
||||
.set_global_opts(legend_opts=opts.LegendOpts(pos_left="20%"))
|
||||
)
|
||||
c2 = (
|
||||
Radar()
|
||||
.add_schema(schema=schema, center=['75%', '50%'])
|
||||
.add_schema(schema=schema, center=["75%", "50%"])
|
||||
.add(
|
||||
series_name="实际开销",
|
||||
data=[[5000, 14000, 28000, 31000, 42000, 21000]],
|
||||
radar_index=1,
|
||||
)
|
||||
.set_global_opts(
|
||||
legend_opts=opts.LegendOpts(pos_right="20%")
|
||||
)
|
||||
.set_global_opts(legend_opts=opts.LegendOpts(pos_right="20%"))
|
||||
)
|
||||
|
||||
grid = (
|
||||
Grid()
|
||||
.add(c, grid_opts=opts.GridOpts())
|
||||
.add(c2, grid_opts=opts.GridOpts())
|
||||
)
|
||||
grid = Grid().add(c, grid_opts=opts.GridOpts()).add(c2, grid_opts=opts.GridOpts())
|
||||
grid.render()
|
||||
_, content = fake_writer.call_args[0]
|
||||
assert_in("radar", content)
|
||||
|
||||
@ -41,8 +41,7 @@ def test_kline_item_base(fake_writer):
|
||||
x_axis = ["2017/7/{}".format(i + 1) for i in range(10)]
|
||||
y_axis = data
|
||||
kline_item = [
|
||||
opts.CandleStickItem(name=d[0], value=d[1])
|
||||
for d in list(zip(x_axis, y_axis))
|
||||
opts.CandleStickItem(name=d[0], value=d[1]) for d in list(zip(x_axis, y_axis))
|
||||
]
|
||||
|
||||
c = (
|
||||
|
||||
@ -9,8 +9,9 @@ from pyecharts.charts import Lines3D
|
||||
|
||||
@patch("pyecharts.render.engine.write_utf8_html_file")
|
||||
def test_lines3d_base(fake_writer):
|
||||
test_main_url: str = \
|
||||
test_main_url: str = (
|
||||
"https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples"
|
||||
)
|
||||
data_json_url = test_main_url + "/data-gl/asset/data/flights.json"
|
||||
base_texture = test_main_url + "/data-gl/asset/world.topo.bathy.200401.jpg"
|
||||
height_texture = test_main_url + "/data-gl/asset/bathymetry_bw_composite_4k.jpg"
|
||||
|
||||
761
test/test_map.py
761
test/test_map.py
@ -63,616 +63,163 @@ def test_map_add_geo_json():
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
118.57812,
|
||||
26.557402
|
||||
],
|
||||
[
|
||||
118.590394,
|
||||
26.553081
|
||||
],
|
||||
[
|
||||
118.617087,
|
||||
26.553059
|
||||
],
|
||||
[
|
||||
118.616111,
|
||||
26.527755
|
||||
],
|
||||
[
|
||||
118.604148,
|
||||
26.504904
|
||||
],
|
||||
[
|
||||
118.608376,
|
||||
26.497294
|
||||
],
|
||||
[
|
||||
118.59623,
|
||||
26.478385
|
||||
],
|
||||
[
|
||||
118.578807,
|
||||
26.473754
|
||||
],
|
||||
[
|
||||
118.56458,
|
||||
26.465373
|
||||
],
|
||||
[
|
||||
118.554474,
|
||||
26.445927
|
||||
],
|
||||
[
|
||||
118.566533,
|
||||
26.432851
|
||||
],
|
||||
[
|
||||
118.54632,
|
||||
26.417928
|
||||
],
|
||||
[
|
||||
118.548079,
|
||||
26.396854
|
||||
],
|
||||
[
|
||||
118.560868,
|
||||
26.378456
|
||||
],
|
||||
[
|
||||
118.566104,
|
||||
26.358824
|
||||
],
|
||||
[
|
||||
118.589836,
|
||||
26.373463
|
||||
],
|
||||
[
|
||||
118.590222,
|
||||
26.359802
|
||||
],
|
||||
[
|
||||
118.595801,
|
||||
26.347859
|
||||
],
|
||||
[
|
||||
118.60369,
|
||||
26.350515
|
||||
],
|
||||
[
|
||||
118.621191,
|
||||
26.361783
|
||||
],
|
||||
[
|
||||
118.631475,
|
||||
26.354788
|
||||
],
|
||||
[
|
||||
118.656162,
|
||||
26.340797
|
||||
],
|
||||
[
|
||||
118.662964,
|
||||
26.322656
|
||||
],
|
||||
[
|
||||
118.653222,
|
||||
26.313452
|
||||
],
|
||||
[
|
||||
118.661204,
|
||||
26.296272
|
||||
],
|
||||
[
|
||||
118.664809,
|
||||
26.270524
|
||||
],
|
||||
[
|
||||
118.678076,
|
||||
26.279442
|
||||
],
|
||||
[
|
||||
118.68585,
|
||||
26.28836
|
||||
],
|
||||
[
|
||||
118.697277,
|
||||
26.287725
|
||||
],
|
||||
[
|
||||
118.693599,
|
||||
26.305557
|
||||
],
|
||||
[
|
||||
118.699533,
|
||||
26.311078
|
||||
],
|
||||
[
|
||||
118.724644,
|
||||
26.337465
|
||||
],
|
||||
[
|
||||
118.75152,
|
||||
26.330542
|
||||
],
|
||||
[
|
||||
118.76682,
|
||||
26.327157
|
||||
],
|
||||
[
|
||||
118.775794,
|
||||
26.325234
|
||||
],
|
||||
[
|
||||
118.797129,
|
||||
26.340542
|
||||
],
|
||||
[
|
||||
118.800059,
|
||||
26.357136
|
||||
],
|
||||
[
|
||||
118.785137,
|
||||
26.365115
|
||||
],
|
||||
[
|
||||
118.771085,
|
||||
26.385377
|
||||
],
|
||||
[
|
||||
118.750534,
|
||||
26.390836
|
||||
],
|
||||
[
|
||||
118.761617,
|
||||
26.420202
|
||||
],
|
||||
[
|
||||
118.745161,
|
||||
26.427236
|
||||
],
|
||||
[
|
||||
118.732826,
|
||||
26.437957
|
||||
],
|
||||
[
|
||||
118.734248,
|
||||
26.45448
|
||||
],
|
||||
[
|
||||
118.737767,
|
||||
26.472405
|
||||
],
|
||||
[
|
||||
118.748152,
|
||||
26.481723
|
||||
],
|
||||
[
|
||||
118.754353,
|
||||
26.487893
|
||||
],
|
||||
[
|
||||
118.748195,
|
||||
26.494063
|
||||
],
|
||||
[
|
||||
118.748238,
|
||||
26.506403
|
||||
],
|
||||
[
|
||||
118.762057,
|
||||
26.508959
|
||||
],
|
||||
[
|
||||
118.780881,
|
||||
26.504741
|
||||
],
|
||||
[
|
||||
118.784598,
|
||||
26.491919
|
||||
],
|
||||
[
|
||||
118.798615,
|
||||
26.484013
|
||||
],
|
||||
[
|
||||
118.805766,
|
||||
26.474876
|
||||
],
|
||||
[
|
||||
118.794544,
|
||||
26.459227
|
||||
],
|
||||
[
|
||||
118.809178,
|
||||
26.445137
|
||||
],
|
||||
[
|
||||
118.805487,
|
||||
26.430479
|
||||
],
|
||||
[
|
||||
118.822825,
|
||||
26.420838
|
||||
],
|
||||
[
|
||||
118.85278,
|
||||
26.438461
|
||||
],
|
||||
[
|
||||
118.878615,
|
||||
26.469605
|
||||
],
|
||||
[
|
||||
118.898227,
|
||||
26.473649
|
||||
],
|
||||
[
|
||||
118.91784,
|
||||
26.472777
|
||||
],
|
||||
[
|
||||
118.949511,
|
||||
26.464885
|
||||
],
|
||||
[
|
||||
118.951619,
|
||||
26.487056
|
||||
],
|
||||
[
|
||||
118.943747,
|
||||
26.493838
|
||||
],
|
||||
[
|
||||
118.942741,
|
||||
26.507994
|
||||
],
|
||||
[
|
||||
118.962064,
|
||||
26.530816
|
||||
],
|
||||
[
|
||||
118.997866,
|
||||
26.528448
|
||||
],
|
||||
[
|
||||
119.000968,
|
||||
26.556946
|
||||
],
|
||||
[
|
||||
119.009563,
|
||||
26.560258
|
||||
],
|
||||
[
|
||||
119.015767,
|
||||
26.581621
|
||||
],
|
||||
[
|
||||
119.032957,
|
||||
26.594999
|
||||
],
|
||||
[
|
||||
119.062507,
|
||||
26.602235
|
||||
],
|
||||
[
|
||||
119.075945,
|
||||
26.587083
|
||||
],
|
||||
[
|
||||
119.06329,
|
||||
26.569473
|
||||
],
|
||||
[
|
||||
119.076433,
|
||||
26.569869
|
||||
],
|
||||
[
|
||||
119.092152,
|
||||
26.562702
|
||||
],
|
||||
[
|
||||
119.101005,
|
||||
26.572732
|
||||
],
|
||||
[
|
||||
119.103604,
|
||||
26.555941
|
||||
],
|
||||
[
|
||||
119.119788,
|
||||
26.539555
|
||||
],
|
||||
[
|
||||
119.132,
|
||||
26.538732
|
||||
],
|
||||
[
|
||||
119.144213,
|
||||
26.536681
|
||||
],
|
||||
[
|
||||
119.171383,
|
||||
26.548551
|
||||
],
|
||||
[
|
||||
119.194922,
|
||||
26.568383
|
||||
],
|
||||
[
|
||||
119.212185,
|
||||
26.547589
|
||||
],
|
||||
[
|
||||
119.218757,
|
||||
26.53412
|
||||
],
|
||||
[
|
||||
119.229448,
|
||||
26.526792
|
||||
],
|
||||
[
|
||||
119.251174,
|
||||
26.53241
|
||||
],
|
||||
[
|
||||
119.253859,
|
||||
26.546561
|
||||
],
|
||||
[
|
||||
119.272336,
|
||||
26.541055
|
||||
],
|
||||
[
|
||||
119.281139,
|
||||
26.534343
|
||||
],
|
||||
[
|
||||
119.287711,
|
||||
26.577995
|
||||
],
|
||||
[
|
||||
119.301835,
|
||||
26.593391
|
||||
],
|
||||
[
|
||||
119.329006,
|
||||
26.578699
|
||||
],
|
||||
[
|
||||
119.354338,
|
||||
26.599587
|
||||
],
|
||||
[
|
||||
119.363191,
|
||||
26.603281
|
||||
],
|
||||
[
|
||||
119.376544,
|
||||
26.604515
|
||||
],
|
||||
[
|
||||
119.381656,
|
||||
26.62171
|
||||
],
|
||||
[
|
||||
119.397376,
|
||||
26.627859
|
||||
],
|
||||
[
|
||||
119.387272,
|
||||
26.641423
|
||||
],
|
||||
[
|
||||
119.375795,
|
||||
26.639028
|
||||
],
|
||||
[
|
||||
119.358824,
|
||||
26.632951
|
||||
],
|
||||
[
|
||||
119.351467,
|
||||
26.648969
|
||||
],
|
||||
[
|
||||
119.326158,
|
||||
26.676212
|
||||
],
|
||||
[
|
||||
119.261119,
|
||||
26.690807
|
||||
],
|
||||
[
|
||||
119.241593,
|
||||
26.742684
|
||||
],
|
||||
[
|
||||
119.226535,
|
||||
26.728854
|
||||
],
|
||||
[
|
||||
119.204611,
|
||||
26.727288
|
||||
],
|
||||
[
|
||||
119.182686,
|
||||
26.729403
|
||||
],
|
||||
[
|
||||
119.167628,
|
||||
26.711891
|
||||
],
|
||||
[
|
||||
119.146452,
|
||||
26.731884
|
||||
],
|
||||
[
|
||||
119.115663,
|
||||
26.73961
|
||||
],
|
||||
[
|
||||
119.047905,
|
||||
26.728693
|
||||
],
|
||||
[
|
||||
119.045955,
|
||||
26.74669
|
||||
],
|
||||
[
|
||||
119.054992,
|
||||
26.764685
|
||||
],
|
||||
[
|
||||
119.051092,
|
||||
26.776147
|
||||
],
|
||||
[
|
||||
119.042385,
|
||||
26.776575
|
||||
],
|
||||
[
|
||||
119.033679,
|
||||
26.770872
|
||||
],
|
||||
[
|
||||
119.012146,
|
||||
26.761305
|
||||
],
|
||||
[
|
||||
118.982497,
|
||||
26.773075
|
||||
],
|
||||
[
|
||||
118.945981,
|
||||
26.77013
|
||||
],
|
||||
[
|
||||
118.926007,
|
||||
26.749652
|
||||
],
|
||||
[
|
||||
118.882686,
|
||||
26.738982
|
||||
],
|
||||
[
|
||||
118.887478,
|
||||
26.757469
|
||||
],
|
||||
[
|
||||
118.903255,
|
||||
26.76737
|
||||
],
|
||||
[
|
||||
118.923824,
|
||||
26.795751
|
||||
],
|
||||
[
|
||||
118.890803,
|
||||
26.813278
|
||||
],
|
||||
[
|
||||
118.843328,
|
||||
26.798569
|
||||
],
|
||||
[
|
||||
118.827143,
|
||||
26.786924
|
||||
],
|
||||
[
|
||||
118.795852,
|
||||
26.783859
|
||||
],
|
||||
[
|
||||
118.771428,
|
||||
26.805618
|
||||
],
|
||||
[
|
||||
118.741511,
|
||||
26.818793
|
||||
],
|
||||
[
|
||||
118.728195,
|
||||
26.830895
|
||||
],
|
||||
[
|
||||
118.722432,
|
||||
26.851573
|
||||
],
|
||||
[
|
||||
118.739746,
|
||||
26.856167
|
||||
],
|
||||
[
|
||||
118.696095,
|
||||
26.869031
|
||||
],
|
||||
[
|
||||
118.664633,
|
||||
26.86214
|
||||
],
|
||||
[
|
||||
118.63317,
|
||||
26.855248
|
||||
],
|
||||
[
|
||||
118.620069,
|
||||
26.839818
|
||||
],
|
||||
[
|
||||
118.635807,
|
||||
26.832963
|
||||
],
|
||||
[
|
||||
118.638444,
|
||||
26.810674
|
||||
],
|
||||
[
|
||||
118.625974,
|
||||
26.788073
|
||||
],
|
||||
[
|
||||
118.623117,
|
||||
26.769147
|
||||
],
|
||||
[
|
||||
118.600382,
|
||||
26.7093
|
||||
],
|
||||
[
|
||||
118.582339,
|
||||
26.703842
|
||||
],
|
||||
[
|
||||
118.569788,
|
||||
26.680592
|
||||
],
|
||||
[
|
||||
118.57902,
|
||||
26.673354
|
||||
],
|
||||
[
|
||||
118.594415,
|
||||
26.673546
|
||||
],
|
||||
[
|
||||
118.594991,
|
||||
26.656748
|
||||
],
|
||||
[
|
||||
118.587905,
|
||||
26.631739
|
||||
],
|
||||
[
|
||||
118.57812,
|
||||
26.557402
|
||||
]
|
||||
[118.57812, 26.557402],
|
||||
[118.590394, 26.553081],
|
||||
[118.617087, 26.553059],
|
||||
[118.616111, 26.527755],
|
||||
[118.604148, 26.504904],
|
||||
[118.608376, 26.497294],
|
||||
[118.59623, 26.478385],
|
||||
[118.578807, 26.473754],
|
||||
[118.56458, 26.465373],
|
||||
[118.554474, 26.445927],
|
||||
[118.566533, 26.432851],
|
||||
[118.54632, 26.417928],
|
||||
[118.548079, 26.396854],
|
||||
[118.560868, 26.378456],
|
||||
[118.566104, 26.358824],
|
||||
[118.589836, 26.373463],
|
||||
[118.590222, 26.359802],
|
||||
[118.595801, 26.347859],
|
||||
[118.60369, 26.350515],
|
||||
[118.621191, 26.361783],
|
||||
[118.631475, 26.354788],
|
||||
[118.656162, 26.340797],
|
||||
[118.662964, 26.322656],
|
||||
[118.653222, 26.313452],
|
||||
[118.661204, 26.296272],
|
||||
[118.664809, 26.270524],
|
||||
[118.678076, 26.279442],
|
||||
[118.68585, 26.28836],
|
||||
[118.697277, 26.287725],
|
||||
[118.693599, 26.305557],
|
||||
[118.699533, 26.311078],
|
||||
[118.724644, 26.337465],
|
||||
[118.75152, 26.330542],
|
||||
[118.76682, 26.327157],
|
||||
[118.775794, 26.325234],
|
||||
[118.797129, 26.340542],
|
||||
[118.800059, 26.357136],
|
||||
[118.785137, 26.365115],
|
||||
[118.771085, 26.385377],
|
||||
[118.750534, 26.390836],
|
||||
[118.761617, 26.420202],
|
||||
[118.745161, 26.427236],
|
||||
[118.732826, 26.437957],
|
||||
[118.734248, 26.45448],
|
||||
[118.737767, 26.472405],
|
||||
[118.748152, 26.481723],
|
||||
[118.754353, 26.487893],
|
||||
[118.748195, 26.494063],
|
||||
[118.748238, 26.506403],
|
||||
[118.762057, 26.508959],
|
||||
[118.780881, 26.504741],
|
||||
[118.784598, 26.491919],
|
||||
[118.798615, 26.484013],
|
||||
[118.805766, 26.474876],
|
||||
[118.794544, 26.459227],
|
||||
[118.809178, 26.445137],
|
||||
[118.805487, 26.430479],
|
||||
[118.822825, 26.420838],
|
||||
[118.85278, 26.438461],
|
||||
[118.878615, 26.469605],
|
||||
[118.898227, 26.473649],
|
||||
[118.91784, 26.472777],
|
||||
[118.949511, 26.464885],
|
||||
[118.951619, 26.487056],
|
||||
[118.943747, 26.493838],
|
||||
[118.942741, 26.507994],
|
||||
[118.962064, 26.530816],
|
||||
[118.997866, 26.528448],
|
||||
[119.000968, 26.556946],
|
||||
[119.009563, 26.560258],
|
||||
[119.015767, 26.581621],
|
||||
[119.032957, 26.594999],
|
||||
[119.062507, 26.602235],
|
||||
[119.075945, 26.587083],
|
||||
[119.06329, 26.569473],
|
||||
[119.076433, 26.569869],
|
||||
[119.092152, 26.562702],
|
||||
[119.101005, 26.572732],
|
||||
[119.103604, 26.555941],
|
||||
[119.119788, 26.539555],
|
||||
[119.132, 26.538732],
|
||||
[119.144213, 26.536681],
|
||||
[119.171383, 26.548551],
|
||||
[119.194922, 26.568383],
|
||||
[119.212185, 26.547589],
|
||||
[119.218757, 26.53412],
|
||||
[119.229448, 26.526792],
|
||||
[119.251174, 26.53241],
|
||||
[119.253859, 26.546561],
|
||||
[119.272336, 26.541055],
|
||||
[119.281139, 26.534343],
|
||||
[119.287711, 26.577995],
|
||||
[119.301835, 26.593391],
|
||||
[119.329006, 26.578699],
|
||||
[119.354338, 26.599587],
|
||||
[119.363191, 26.603281],
|
||||
[119.376544, 26.604515],
|
||||
[119.381656, 26.62171],
|
||||
[119.397376, 26.627859],
|
||||
[119.387272, 26.641423],
|
||||
[119.375795, 26.639028],
|
||||
[119.358824, 26.632951],
|
||||
[119.351467, 26.648969],
|
||||
[119.326158, 26.676212],
|
||||
[119.261119, 26.690807],
|
||||
[119.241593, 26.742684],
|
||||
[119.226535, 26.728854],
|
||||
[119.204611, 26.727288],
|
||||
[119.182686, 26.729403],
|
||||
[119.167628, 26.711891],
|
||||
[119.146452, 26.731884],
|
||||
[119.115663, 26.73961],
|
||||
[119.047905, 26.728693],
|
||||
[119.045955, 26.74669],
|
||||
[119.054992, 26.764685],
|
||||
[119.051092, 26.776147],
|
||||
[119.042385, 26.776575],
|
||||
[119.033679, 26.770872],
|
||||
[119.012146, 26.761305],
|
||||
[118.982497, 26.773075],
|
||||
[118.945981, 26.77013],
|
||||
[118.926007, 26.749652],
|
||||
[118.882686, 26.738982],
|
||||
[118.887478, 26.757469],
|
||||
[118.903255, 26.76737],
|
||||
[118.923824, 26.795751],
|
||||
[118.890803, 26.813278],
|
||||
[118.843328, 26.798569],
|
||||
[118.827143, 26.786924],
|
||||
[118.795852, 26.783859],
|
||||
[118.771428, 26.805618],
|
||||
[118.741511, 26.818793],
|
||||
[118.728195, 26.830895],
|
||||
[118.722432, 26.851573],
|
||||
[118.739746, 26.856167],
|
||||
[118.696095, 26.869031],
|
||||
[118.664633, 26.86214],
|
||||
[118.63317, 26.855248],
|
||||
[118.620069, 26.839818],
|
||||
[118.635807, 26.832963],
|
||||
[118.638444, 26.810674],
|
||||
[118.625974, 26.788073],
|
||||
[118.623117, 26.769147],
|
||||
[118.600382, 26.7093],
|
||||
[118.582339, 26.703842],
|
||||
[118.569788, 26.680592],
|
||||
[118.57902, 26.673354],
|
||||
[118.594415, 26.673546],
|
||||
[118.594991, 26.656748],
|
||||
[118.587905, 26.631739],
|
||||
[118.57812, 26.557402],
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
}
|
||||
"type": "Polygon",
|
||||
},
|
||||
}
|
||||
]
|
||||
],
|
||||
}
|
||||
|
||||
c = Map()
|
||||
|
||||
@ -177,9 +177,7 @@ def test_page_resize():
|
||||
|
||||
def test_page_resize_cfg():
|
||||
page = Page()
|
||||
content = page.save_resize_html(
|
||||
cfg_file="test/fixtures/resize_cfg.json"
|
||||
)
|
||||
content = page.save_resize_html(cfg_file="test/fixtures/resize_cfg.json")
|
||||
assert_not_in(".resizable()", content)
|
||||
assert_not_in(".draggable()", content)
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ def test_parallel_base_v1(fake_writer):
|
||||
data=["优", "良", "轻度污染", "中度污染", "重度污染", "严重污染"],
|
||||
),
|
||||
],
|
||||
parallel_opts=opts.ParallelOpts()
|
||||
parallel_opts=opts.ParallelOpts(),
|
||||
)
|
||||
.add("parallel", data)
|
||||
.set_global_opts(title_opts=opts.TitleOpts(title="Parallel-Category"))
|
||||
|
||||
@ -82,22 +82,25 @@ def test_mark_line_item_remove_none():
|
||||
|
||||
def test_mark_area_item_remove_none():
|
||||
item = MarkAreaItem()
|
||||
expected = [{
|
||||
"itemStyle": None,
|
||||
"label": None,
|
||||
"name": None,
|
||||
"type": None,
|
||||
"valueDim": None,
|
||||
"valueIndex": None,
|
||||
"xAxis": None,
|
||||
"yAxis": None,
|
||||
}, {
|
||||
"type": None,
|
||||
"valueDim": None,
|
||||
"valueIndex": None,
|
||||
"xAxis": None,
|
||||
"yAxis": None,
|
||||
}]
|
||||
expected = [
|
||||
{
|
||||
"itemStyle": None,
|
||||
"label": None,
|
||||
"name": None,
|
||||
"type": None,
|
||||
"valueDim": None,
|
||||
"valueIndex": None,
|
||||
"xAxis": None,
|
||||
"yAxis": None,
|
||||
},
|
||||
{
|
||||
"type": None,
|
||||
"valueDim": None,
|
||||
"valueIndex": None,
|
||||
"xAxis": None,
|
||||
"yAxis": None,
|
||||
},
|
||||
]
|
||||
assert_equal(expected, remove_key_with_none_value(item.opts))
|
||||
|
||||
|
||||
|
||||
@ -25,11 +25,11 @@ def _gen_faker_engine(content: str):
|
||||
|
||||
|
||||
def test_decode_base64():
|
||||
assert decode_base64(data="abcde12") == b'i\xb7\x1d{]'
|
||||
assert decode_base64(data="abcde12") == b"i\xb7\x1d{]"
|
||||
|
||||
|
||||
def test_save_as_png():
|
||||
save_as_png(image_data=b'i\xb7\x1d{]', output_name="text_png.png")
|
||||
save_as_png(image_data=b"i\xb7\x1d{]", output_name="text_png.png")
|
||||
os.unlink("text_png.png")
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ def test_tab_render_embed():
|
||||
|
||||
def test_tab_render_notebook():
|
||||
from pyecharts.globals import CurrentConfig, NotebookType
|
||||
|
||||
CurrentConfig.NOTEBOOK_TYPE = NotebookType.JUPYTER_NOTEBOOK
|
||||
|
||||
tab = Tab()
|
||||
@ -96,8 +97,9 @@ def test_tab_attr():
|
||||
|
||||
|
||||
def test_tab_with_chart_container():
|
||||
tab = Tab(tab_css_opts=opts.TabChartGlobalOpts(
|
||||
is_enable=False,
|
||||
tab_base_css={"overflow": "hidden"}
|
||||
))
|
||||
tab = Tab(
|
||||
tab_css_opts=opts.TabChartGlobalOpts(
|
||||
is_enable=False, tab_base_css={"overflow": "hidden"}
|
||||
)
|
||||
)
|
||||
assert_true(isinstance(tab._charts, list))
|
||||
|
||||
@ -10,10 +10,12 @@ def test_utils_produce_require_dict():
|
||||
assert_equal(cfg["libraries"], ["'echarts'"])
|
||||
|
||||
cfg_1 = utils.produce_require_dict(
|
||||
utils.OrderedSet("https://api.map.baidu.com"), "https://example.com",
|
||||
utils.OrderedSet("https://api.map.baidu.com"),
|
||||
"https://example.com",
|
||||
)
|
||||
assert_equal(
|
||||
cfg_1["config_items"], ["'baidu_map_api25':'https://api.map.baidu.com'"],
|
||||
cfg_1["config_items"],
|
||||
["'baidu_map_api25':'https://api.map.baidu.com'"],
|
||||
)
|
||||
assert_equal(cfg_1["libraries"], ["'baidu_map_api25'"])
|
||||
|
||||
@ -24,7 +26,8 @@ def test_utils_produce_require_dict_with_extra():
|
||||
"https://api.baidu.com/test.min": ["https://api.baidu.com/test.min", "css"]
|
||||
}
|
||||
cfg_0 = utils.produce_require_dict(
|
||||
utils.OrderedSet("https://api.baidu.com/test.min"), "https://example.com",
|
||||
utils.OrderedSet("https://api.baidu.com/test.min"),
|
||||
"https://example.com",
|
||||
)
|
||||
assert_equal(cfg_0["libraries"], ["'https://api.baidu.com/test.min'"])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user