def plotlib_data(self): # 画图 Type Proportion(%)
self.cursor.execute('select video_name from game_fps GROUP BY video_name')
video_name = [i[0] for i in self.cursor.fetchall()]
self.cursor.execute('select number from game_fps GROUP BY number')
x = [i[0] / 50 for i in self.cursor.fetchall()]
self.cursor.execute('select fps from game_fps where video_name="{}"'.format(video_name[0]))
y1 = [i[0] for i in self.cursor.fetchall()]
self.cursor.execute('select fps from game_fps where video_name="{}"'.format(video_name[1]))
y2 = [i[0] for i in self.cursor.fetchall()]
line_fps = (
Line()
.add_xaxis(xaxis_data=x)
.add_yaxis(series_name=video_name[0], y_axis=y1, is_smooth=True)
.add_yaxis(series_name=video_name[1], y_axis=y2, is_smooth=True)
.set_global_opts(title_opts=opts.TitleOpts(title="fps-ping"), xaxis_opts=opts.AxisOpts(name='fps', name_location='center', name_gap=35, name_textstyle_opts=opts.TextStyleOpts(font_size=25)))
.set_series_opts(label_opts=opts.LabelOpts(is_show=False))
)
self.cursor.execute('select ping from game_fps where video_name="{}"'.format(video_name[0]))
y1 = [i[0] for i in self.cursor.fetchall()]
self.cursor.execute('select ping from game_fps where video_name="{}"'.format(video_name[1]))
y2 = [i[0] for i in self.cursor.fetchall()]
line_ping = (
Line()
.add_xaxis(xaxis_data=x)
.add_yaxis(series_name=video_name[0], y_axis=y1, is_smooth=True)
.add_yaxis(series_name=video_name[1], y_axis=y2, is_smooth=True)
.set_global_opts(title_opts=opts.TitleOpts(title=""), xaxis_opts=opts.AxisOpts(name='ping', name_location='center', name_gap=35, name_textstyle_opts=opts.TextStyleOpts(font_size=25)))
.set_series_opts(label_opts=opts.LabelOpts(is_show=False)) # 不现实具体数字
)
grid = (
Page(layout=Page.SimplePageLayout)
.add(line_fps)
.add(line_ping)
.render("data.html")
)