Skip to content

Commit

Permalink
Fix some issues with drawing notes on the graph. (#39)
Browse files Browse the repository at this point in the history
* Copy the notes list before plotting. (Otherwise when popping a note from the list, it will disappear for plots that are generated later).
* May combine multiple notes and plot them on the same date.
  • Loading branch information
qinsoon authored Nov 4, 2023
1 parent 604e03f commit d44814c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/history_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@
pp.pprint(baseline)

# plot
fig = plot.plot_history(runs, plan, benchmarks, from_date, to_date, "execution_times", baseline, config['notes'])
fig = plot.plot_history(runs, plan, benchmarks, from_date, to_date, "execution_times", baseline, config['notes'].copy())
path = os.path.join(output_dir, "%s_%s_history.html" % (prefix, plan))
fig.write_html(path)
14 changes: 11 additions & 3 deletions scripts/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,17 @@ def peek_next_note_date():
for idx, run_id in enumerate(x_labels):
log_date = parse.parse_run_date(run_id)
if log_date >= next_note_date:
note = notes.pop(0)
aligned_notes.append({ 'run_id': run_id, 'x': x[idx], 'note': f"{note['date']}: {note['note']}" })
next_note_date = peek_next_note_date()
# We may have multiple notes on this date. We have to combine them.
combined_note = None

while log_date >= next_note_date:
note = notes.pop(0)
if combined_note is None:
combined_note = { 'run_id': run_id, 'x': x[idx], 'note': f"{note['date']}: {note['note']}" }
else:
combined_note['note'] += f",{note['date']}: {note['note']}"
next_note_date = peek_next_note_date()
aligned_notes.append(combined_note)

y_cur_aboslute = y[-1]

Expand Down

0 comments on commit d44814c

Please sign in to comment.