程序代码
from pyecharts.charts import Line
from pyecharts.options import TitleOpts, LegendOpts, ToolboxOpts, VisualMapOpts
line = Line()
line.add_xaxis(["中国", "美国", "日本"])
line.add_yaxis("GDP", [30, 35, 20])
# 设置全局配置项
line.set_global_opts(
# 标题设置
title_opts=TitleOpts(title="GDP展示", pos_left="center", pos_bottom="1%"),
# 图例设置
legend_opts=LegendOpts(is_show=True),
# 工具箱设置
toolbox_opts=ToolboxOpts(is_show=True),
# 视觉显示设置
visualmap_opts=VisualMapOpts(is_show=True)
)
line.render()
程序展示