【发布时间】:2019-07-24 08:33:28
【问题描述】:
我一直在玩 Pygal,为我正在进行的项目创建一些线图。我目前将我的y axis 设置为记录的值,x axis 是date / time 进行了测试。但是,我还想将序列号链接到每个数据点。在您将鼠标悬停在数据点上的那一刻,您会以粗体显示 y 值,并在下方显示记录的日期。
有谁知道是否可以将信息链接到数据点而不将它们作为轴标签?
作为参考,我目前将序列号添加到list: 'sn_list'。
for row in line_graph_query:
if str(row.date_time) >= start_date and str(row.date_time) <= end_date :
min_values.append(float(row.minimum_value))
max_values.append(float(row.maximum_value))
recorded_values.append(float(row.recorded_value))
sn_list.append(row.product_serial_number)
date_list.append(row.date_time)
number_of_records = number_of_records + 1
print(min_values)
print(max_values)
print(recorded_values)
distance_x_axis = math.floor(number_of_records/6)
line_chart = pygal.Line(no_data_text='No result found', style=custom_style,x_labels_major_every=distance_x_axis, x_label_rotation=20, show_minor_x_labels=False )
line_chart.title = 'Detailed Results of '+test_name+' tests of '+board_pn
line_chart.x_labels = map(str,date_list)
line_chart.add('Minimum', min_values)
line_chart.add('Maximum', max_values)
line_chart.add('Recorded', recorded_values)
graph_render.append(line_chart.render_data_uri())
graphs_to_render[test_name] = graph_render[-1]
【问题讨论】:
标签: python sqlalchemy flask-sqlalchemy pygal