Browse Source

[#37192] graph: Fixed saving the TXT plot

Signed-off-by: Grzegorz Latosinski <glatosinski@antmicro.com>
check-vt100
Grzegorz Latosinski 4 years ago
parent
commit
7714ec5b5c
  1. 2
      .ci.yml
  2. 8
      graph.py

2
.ci.yml

@ -25,7 +25,7 @@ simple_test:
- sargraph chart stop
- cd ..
- cat plot.txt
- cat plot.plot.txt
- test -f plot.svg
artifacts:
when: always

8
graph.py

@ -16,6 +16,7 @@ import numpy as np
from typing import List, Tuple, Optional
from contextlib import redirect_stdout
from common import *
from pathlib import Path
global gnuplot
@ -383,7 +384,7 @@ def create_ascii_plot(
def render_ascii_plot(
outpath: str,
outpath: Path,
summary: str,
titles: List,
xtitles: List,
@ -402,9 +403,10 @@ def render_ascii_plot(
axes_color='black',
ticks_color='white'):
print(summary)
print(f'Saving to {outpath}')
with open(outpath, 'w') as outfile:
with redirect_stdout(outfile):
print(summary)
for title, xtitle, xunit, ytitle, yunit, ydata in zip(titles, xtitles, xunits, ytitles, yunits, ydatas): # noqa: E501
print('\n\n')
create_ascii_plot(
@ -447,7 +449,7 @@ def ascii_graph(session, fname='plot.png'):
summary += f"Duration: {START_DATE} .. {END_DATE} ({DURATION})"
render_ascii_plot(
f'{fname}.txt',
f'{Path(fname).with_suffix(".plot.txt")}',
summary,
titles,
["time", "time", "time"],

Loading…
Cancel
Save