""" author:少校 create Time:2025/2/27 16:00 越努力越幸运 """ from pyecharts.charts import Line from pyecharts import options #1.创建图标对象 line = Line() #2.添加数据 line.add_xaxis(["1月","2月","3月","4月","5月","6月"]) line.add_yaxis( "销售额", [89,102,77,65,120,50], color="red", linestyle_opts=options.LineStyleOpts( #设置线宽 width=5, ), #设置平滑 is_smooth=True ) line.add_yaxis( "成本", [40,52,33,26,59,10] ) #3.添加配置 line.set_global_opts( title_opts=options.TitleOpts( title="xx公司上半年销售情况", pos_left="340" ), legend_opts=options.LegendOpts( pos_left=85, pos_top=30 ), yaxis_opts=options.AxisOpts( name="金额(万元)" ) ) #系列设置 line.set_series_opts( markline_opts=options.MarkLineOpts( data=[ options.MarkLineItem("平均值","average") ] ) ) #4.制图 line.render("charts/02折线图.html")
02.折线图
本节944字2025-02-27 19:39:51