from pywebio.output import put_html import pyecharts.options as opts from pyecharts.charts import Line, Bar, Line def plot_example(): week_name_list = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"] high_temperature = [0.83, 0.92, 0.95, 0.87, 0.88, 0.92, 0.9] low_temperature = [0.43, 0.52, 0.55, 0.47, 0.48, 0.52, 0.5] c = ( Line() .add_xaxis(xaxis_data=week_name_list) .add_yaxis( series_name="soc一致性", y_axis=high_temperature, markpoint_opts=opts.MarkPointOpts( data=[ opts.MarkPointItem(type_="max", name="最大值"), opts.MarkPointItem(type_="min", name="最小值"), ] ), markline_opts=opts.MarkLineOpts( data=[opts.MarkLineItem(type_="average", name="平均值")] ), ) .add_yaxis( series_name="soh一致性", y_axis=low_temperature, markpoint_opts=opts.MarkPointOpts( data=[opts.MarkPointItem(value=-2, name="周最低", x=1, y=-1.5)] ), # markline_opts=opts.MarkLineOpts( # data=[ # opts.MarkLineItem(type_="average", name="平均值"), # opts.MarkLineItem(symbol="none", x="90%", y="max"), # opts.MarkLineItem(symbol="circle", type_="max", name="最高点"), # ] # ), ) .set_global_opts( title_opts=opts.TitleOpts(title="soc/soh致性变化", subtitle="虚构数据"), tooltip_opts=opts.TooltipOpts(trigger="axis"), toolbox_opts=opts.ToolboxOpts(is_show=True), xaxis_opts=opts.AxisOpts(type_="category", boundary_gap=False), ) ) c.width = "100%" return c def plot_example2(): colors = ["#5793f3", "#d14a61", "#675bba"] x_data = ["0~2h", "2~4h", "4~6h", "6~8h", "8~10h", "10~12h", "12~14h", "14~16h", "16~18h", "18~20h", "20~22h", "22~24h"] legend_list = ["充电开始时间段"] evaporation_capacity = [ 1, 3, 5, 3, 2, 2, 0, 4, 1, 5, 4, 2, ] bar = ( Bar(init_opts=opts.InitOpts(width="800", height="720px")) .add_xaxis(xaxis_data=x_data) .add_yaxis( series_name="充电开始时间段", y_axis=evaporation_capacity, yaxis_index=0, color=colors[1], ) ) return bar