diff options
| author | hmj6502 <hashim@hmj6502.com> | 2025-12-18 21:54:49 +0000 |
|---|---|---|
| committer | hmj6502 <hashim@hmj6502.com> | 2025-12-18 21:54:49 +0000 |
| commit | b7f285f2b866366cff49d49ccfb49a40c62cb0e3 (patch) | |
| tree | 43e6cd6d143add79fe3409cdcb69620ea880dc88 /display.py | |
| parent | 81f6bcf7d7a62b6d920e17a2d30512c260d6c586 (diff) | |
| download | lock-n-log-b7f285f2b866366cff49d49ccfb49a40c62cb0e3.tar.gz lock-n-log-b7f285f2b866366cff49d49ccfb49a40c62cb0e3.tar.bz2 lock-n-log-b7f285f2b866366cff49d49ccfb49a40c62cb0e3.zip | |
add basic rendering
display each day as a seperate svg; each a bar chart of tags of that day
Diffstat (limited to 'display.py')
| -rw-r--r-- | display.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/display.py b/display.py new file mode 100644 index 0000000..e5b9bda --- /dev/null +++ b/display.py @@ -0,0 +1,24 @@ +# displays stats as graph. assumes csv is in chronological order, with no +# overlapping sessions. as initial test: make a bar chart for time spent per +# tag, for every day +import pygal +import csv +import argparse +from collections import OrderedDict +import formatting as f + +parser = argparse.ArgumentParser() +parser.add_argument("logfile", help="log file to display chart of", + type=argparse.FileType('r')) +args = parser.parse_args() + +day_times = f.per_tag_per_day(args.logfile) +print(day_times) + +for day in day_times: + chart = pygal.Bar() + for key, value in day.items(): + if key == "date": + continue + chart.add(key, value) + chart.render_to_file(str(day["date"]+".svg")) |
