Skip to content

Commit

Permalink
Merge pull request #2 from Gummientchen/dev
Browse files Browse the repository at this point in the history
implemented new export functionality: pdf and svg
  • Loading branch information
Gummientchen authored May 20, 2024
2 parents 8b77253 + 02a0164 commit b5be947
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ This tool helps visualize PresentMon logs.
| -t | -Title | Set custom title which is shown at the top of generated image |
| -b | -Bins | Defines how many bins should be used for histograms |
| -d | -Theme | Lets you choose between dark and light mode. Default dark. Options: "dark", "light" |
| -s | -ShowWindow | If set shows a preview window of the graph (image still gets stored) |
| -p | -Pdf | Exports the graph as a .pdf too |
| -v | -Svg | Exports the graph as a .svg too |

Expand Down Expand Up @@ -40,14 +39,20 @@ PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -b 40
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -d light
```

### Show Preview Window
### Export PDF too

```cmd
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -s
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -p
```

### Export SVG too

```cmd
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -v
```

### All Options Combined

```cmd
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -o "C:\presentmon-log.png" -b 40 -d light -s
PresentMon-Grapher.exe -i "C:\presentmon-log.csv" -o "C:\presentmon-log.png" -b 40 -d light -p -v
```
9 changes: 4 additions & 5 deletions presentmon-graph.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import matplotlib.pyplot as plt
import matplotlib.backends.backend_cairo
import numpy as np
import pandas as pd
import argparse
import os
from pathlib import Path
from matplotlib import use as mpluse

mpluse("Cairo")

# Defaults
inputFilename = "input.csv"
Expand All @@ -16,7 +20,6 @@
parser.add_argument("-t", "--Title", help = "Graph title shown at the top of generated image.")
parser.add_argument("-b", "--Bins", help = "How many bins should be used for histograms. Default 20", default=20, type=int)
parser.add_argument("-d", "--Theme", help = "Switch between light and dark mode. Default 'dark'", choices=['dark', 'light'], default="dark")
parser.add_argument("-s", "--ShowWindow", help = "Enable a window whichs shows the generated graph on screen.", action='store_true')
parser.add_argument("-p", "--Pdf", help = "Exports the graph as a .pdf too", action='store_true')
parser.add_argument("-v", "--Svg", help = "Exports the graph as a .svg too", action='store_true')
args = parser.parse_args()
Expand Down Expand Up @@ -166,10 +169,6 @@ def main():

print("All Done!")

# Show windows if enabled
if args.ShowWindow:
plt.show()



def movingaverage(interval, window_size):
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
matplotlib==3.7.2
numpy==1.26.0
pandas==2.1.1
pycairo==1.26.0
CairoSVG==2.6.0
cairocffi==1.6.1

0 comments on commit b5be947

Please sign in to comment.