#导包
from pyecharts.charts import Line
from pyecharts.options import TitleOpts,ToolboxOpts,LegendOpts,VisualMapOpts
#创建一个折线图像对象,即创建一个空的坐标系
line =Line()
#给折线图对象添加x轴的数据
line.add_xaxis(["上海","河南","北京"])
#给折线图添加y轴数
line.add_yaxis("GDP",[30,20,10])
#设置全局配置项 set_global_option来设置
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()