from pyecharts.charts import Bar
from pyecharts import options as opts
bar=(
Bar()
.set_colors("indigo")
.add_xaxis(['Jan','Feb','Mar','Apr','May','Jun'])
.add_yaxis('高衍龙',[12,18,23,8,30,22])
.set_global_opts(
title_opts=opts.TitleOpts(title="高衍龙"),
graphic_opts=[
opts.GraphicGroup(
graphic_item=opts.GraphicItem(
left="50%",
top="15%",
),
children=[
opts.GraphicRect(
graphic_item=opts.GraphicItem(
z=100,
left="center",
top="middle",
),
graphic_shape_opts=opts.GraphicShapeOpts(
width=190, height=90,
),
graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(
fill="#fff",
stroke="#555",
line_width=2,
shadow_blur=8,
shadow_offset_x=3,
shadow_offset_y=3,
shadow_color="rgba(0,0,0,0.3)",
)
),
opts.GraphicText(
graphic_item=opts.GraphicItem(
left="center",
top="middle",
z=100,
),
graphic_textstyle_opts=opts.GraphicTextStyleOpts(
text=JsCode(
"['横轴表示数据类别',"
"'纵轴表示数值的值',"
"'这个文本块可以放在图中各',"
"'种位置'].join('\\n')"
),
font="14px Microsoft YaHei",
graphic_basicstyle_opts=opts.GraphicBasicStyleOpts(
fill="#333"
)
)
)
]
)
],
)
.render("2020-6-8.html")
)