Python Forum
Pygal: Displaying information for each data point
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pygal: Displaying information for each data point
#1
I have been playing around with Pygal, creating some line graphs for a project I am working on. I currently have my y axis set to be the value recorded and the x axis being the date / time the test was conducted. However I would also like to link the serial number to each data point. At the moment when you hover on a data point you get the y value in bold and underneith that you get the date it was recorded.

Does anyone know if it is possible to link information to data points without them being an axis label?

For reference I currently have the serial numbers being added to the 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]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  get year information from a timestamp data frame asli 1 1,631 Jan-08-2021, 09:11 PM
Last Post: Larz60+
  connecting the first point to the last point Matplotlib omar_mohsen 0 4,527 Jan-15-2020, 01:23 PM
Last Post: omar_mohsen
  Matplotlib Hovering Event displaying (x, y) data RawlinsCross 0 6,088 Oct-18-2019, 06:13 PM
Last Post: RawlinsCross
  Problems displaying data sent from Arduino to Pi VostokRising 2 2,285 May-18-2019, 08:28 PM
Last Post: VostokRising
  Installing pygal under Ubuntu 18.04 ybeco 25 11,599 Aug-11-2018, 06:15 AM
Last Post: Gribouillis
  Preserve Encapsulation while Displaying Information QueenSvetlana 13 6,865 Dec-07-2017, 06:13 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020