mirror of
https://github.com/pyecharts/pyecharts.git
synced 2025-12-08 20:59:23 +00:00
添加chart颜色颠倒的单元测试模块
“
This commit is contained in:
parent
bbf193925f
commit
58ca07510f
29
test/test_chart.py
Normal file
29
test/test_chart.py
Normal file
@ -0,0 +1,29 @@
|
||||
from nose.tools import assert_equal
|
||||
from pyecharts.charts import Line
|
||||
|
||||
|
||||
def test_chart_append_color():
|
||||
x_data = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
||||
y_data1 = [140, 232, 101, 264, 90, 340, 250]
|
||||
y_data2 = [120, 282, 111, 234, 220, 340, 310]
|
||||
|
||||
c = (
|
||||
Line()
|
||||
.add_xaxis(xaxis_data=x_data)
|
||||
.add_yaxis(
|
||||
series_name="品类 1",
|
||||
y_axis=y_data1,
|
||||
color='#80FFA5')
|
||||
.add_yaxis(
|
||||
series_name="品类 2",
|
||||
y_axis=y_data2,
|
||||
color='#00DDFF')
|
||||
)
|
||||
c.render()
|
||||
default_colors = (
|
||||
"#c23531 #2f4554 #61a0a8 #d48265 #749f83 #ca8622 #bda29a #6e7074 "
|
||||
"#546570 #c4ccd3 #f05b72 #ef5b9c #f47920 #905a3d #fab27b #2a5caa "
|
||||
"#444693 #726930 #b2d235 #6d8346 #ac6767 #1d953f #6950a1 #918597"
|
||||
).split()
|
||||
expected_result = ['#80FFA5', '#00DDFF', *default_colors]
|
||||
assert_equal(c.colors, expected_result)
|
||||
Loading…
x
Reference in New Issue
Block a user