import pyecharts.options as opts from pyecharts.charts import Line, Page """ https://echarts.apache.org/examples/editor.html?c=line-simple """ x_data = [ "2022-09-02", "2022-09-09", "2022-09-16", "2022-09-23", "2022-09-30", "2022-10-14", "2022-10-21", "2022-10-28", "2022-11-04", "2022-11-11", "2022-11-18", "2022-11-25", "2022-12-02", "2022-12-09", "2022-12-23", "2022-12-30", "2023-01-06", "2023-01-13", "2023-02-03", "2023-02-10", "2023-02-17", "2023-03-03", "2023-03-10", "2023-03-17", "2023-03-24", "2023-04-07", "2023-04-14", "2023-04-21", "2023-04-28", "2023-05-05", "2023-05-12", "2023-05-19", "2023-05-26", "2023-06-02", "2023-06-16", "2023-06-30", "2023-07-07", "2023-07-14", "2023-07-28", "2023-08-11", "2023-08-18", "2023-08-25", "2023-09-01", "2023-09-15", "2023-09-22", "2023-10-13", "2023-10-20", "2023-10-27", "2023-11-03", "2023-11-10", "2023-11-17", "2023-12-08", "2023-12-15", "2023-12-22", ] def qps() -> Line: y_data = [ 3.39, 3.71, 3.95, 5.04, 5.37, 3.67, 2.81, 2.43, 1.86, 2.23, 2.06, 2.53, 2.63, 2.49, 2.13, 2.5, 2.9, 3.74, 3.45, 3.25, 4.13, 4.52, 4.36, 4.22, 5.2, 3.63, 4.54, 4.14, 3.63, 2.98, 3.88, 3.99, 3.96, 3.41, 4.18, 3.7, 3.82, 4.12, 5.53, 5.23, 4.25, 3.85, 4.09, 3.94, 3.45, 5.76, 4.8, 4.47, 4.64, 6.9, 14.57, 15.68, 12.35, 10.37, ] return ( Line(init_opts=opts.InitOpts(width="400px", height="300px")) .set_global_opts( title_opts=opts.TitleOpts(title="QPS-Mean"), tooltip_opts=opts.TooltipOpts(is_show=False), xaxis_opts=opts.AxisOpts(type_="category"), yaxis_opts=opts.AxisOpts( type_="value", axistick_opts=opts.AxisTickOpts(is_show=True), splitline_opts=opts.SplitLineOpts(is_show=True), ), ) .add_xaxis(xaxis_data=x_data) .add_yaxis( series_name="", y_axis=y_data, symbol="emptyCircle", is_symbol_show=True, label_opts=opts.LabelOpts(is_show=False), ) ) def latency() -> Line: y_data = [ 1262.77, 1060.59, 729.57, 1360.3, 1734.95, 1633.24, 1001.2, 1104.07, 1154.67, 475.69, 707.75, 605.64, 715.42, 750.09, 1678.96, 1068.96, 711.81, 3895.82, 658.51, 677.85, 790.24, 1115.68, 861.04, 831.83, 674.5, 838.42, 1011.89, 929.16, 977.77, 1069.85, 1110.43, 866.58, 795.64, 916.45, 789.21, 693.96, 786.97, 689.14, 521.33, 527.7, 590.63, 816.49, 661.05, 555.87, 565.47, 429.19, 433.2, 489.09, 720.83, 526.98, 307.3, 272.5, 310.51, 364.88, ] return ( Line(init_opts=opts.InitOpts(width="400px", height="300px")) .set_global_opts( title_opts=opts.TitleOpts(title="TP95"), tooltip_opts=opts.TooltipOpts(is_show=False), xaxis_opts=opts.AxisOpts(type_="category"), yaxis_opts=opts.AxisOpts( type_="value", axistick_opts=opts.AxisTickOpts(is_show=True), splitline_opts=opts.SplitLineOpts(is_show=True), ), ) .add_xaxis(xaxis_data=x_data) .add_yaxis( series_name="", y_axis=y_data, symbol="emptyCircle", is_symbol_show=True, label_opts=opts.LabelOpts(is_show=False), ) ) def error() -> Line: y_data = [ 0.0081, 0.0042, 0.0059, 0.0034, 0.0017, 0.01, 0.0094, 0.0015, 0.0034, 0.0001, 0.0014, 0.0001, 0.0005, 0.0002, 0.0005, 0.0012, 0.0004, 0.0001, 0.0004, 0.0008, 0.004, 0.0003, 0.0004, 0.0004, 0.0006, 0.0007, 0.0002, 0.0026, 0.0003, 0.0001, 0.0006, 0.0009, 0.0002, 0.0013, 0.0005, 0.0003, 0.0004, 0.0004, 0.0002, 0.0004, 0.0001, 0.0008, 0.0012, 0.0003, 0.0002, 0.0007, 0.0006, 0.0005, 0.0005, 0.0004, 0.0001, 0.0001, 0.0012, 0.0001, ] return ( Line(init_opts=opts.InitOpts(width="400px", height="300px")) .set_global_opts( title_opts=opts.TitleOpts(title="ErrorRate"), tooltip_opts=opts.TooltipOpts(is_show=False), xaxis_opts=opts.AxisOpts(type_="category"), yaxis_opts=opts.AxisOpts( type_="value", axistick_opts=opts.AxisTickOpts(is_show=True), splitline_opts=opts.SplitLineOpts(is_show=True), ), ) .add_xaxis(xaxis_data=x_data) .add_yaxis( series_name="", y_axis=y_data, symbol="emptyCircle", is_symbol_show=True, label_opts=opts.LabelOpts(is_show=False), ) ) if __name__ == "__main__": page = Page(layout=Page.SimplePageLayout) page.add(qps(), latency(), error()) page.render("test.html")