Commit 52cb77f7 authored by Julius Metz's avatar Julius Metz

change plot value, fix plotnames

parent aa7e2a8c
......@@ -6,7 +6,7 @@ def cpu_plot(values, title=None, xtitle=None, ytitle=None):
plot = {
'data': [],
'layout': {
'showlegend': False,
'showlegend': True,
'title': {
'text': title
},
......@@ -19,7 +19,7 @@ def cpu_plot(values, title=None, xtitle=None, ytitle=None):
},
}
for cmd, cmd_data in values.items():
CPU = cmd_data.get('CPU', [])
CPU = cmd_data.get('PCT', [])
if not any(elem != '0' for elem in CPU):
continue
......@@ -28,10 +28,9 @@ def cpu_plot(values, title=None, xtitle=None, ytitle=None):
'type': 'scatter',
'mode': 'markers',
'x': cmd_data.get('datetime', []),
'y': cmd_data.get('CPU', []),
'y': CPU,
'name': cmd,
}
)
pio.show(plot)
\ No newline at end of file
......@@ -17,6 +17,14 @@ CONFIG = {
def datestr2date(datestr):
"""Converts a "datestring" to a date Object.
Arguments:
datestr {str} -- string of a Date example: 20191224
Returns:
datetime.date -- date of the string
"""
return datetime.date(
int(datestr[:4]),
int(datestr[4:6]),
......@@ -32,9 +40,8 @@ def parse_file(path, collectl):
entrys_data = {}
tmp_date = None
tmp_time = None
for entry in output:
splited_entry = entry.split(' ', len(head))
splited_entry = entry.split(' ', len(head)-1)
cmd = splited_entry[-1]
if not cmd in entrys_data:
......@@ -59,6 +66,7 @@ def parse_file(path, collectl):
return entrys_data
@click.command()
@click.option('--file', '-f', required=True)
@click.option('--collectl', '-c', required=False, default='collectl')
......@@ -66,6 +74,7 @@ def main(file, collectl):
path = Path(file)
if path.exists():
data = parse_file(path, collectl)
for generator, settings in CONFIG.items():
getattr(plots_generators, generator)(data, **settings)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment