summaryrefslogtreecommitdiffstats
path: root/glances/exports/glances_history.py
diff options
context:
space:
mode:
Diffstat (limited to 'glances/exports/glances_history.py')
-rw-r--r--glances/exports/glances_history.py31
1 files changed, 11 insertions, 20 deletions
diff --git a/glances/exports/glances_history.py b/glances/exports/glances_history.py
index 674bdb5c..6caaf353 100644
--- a/glances/exports/glances_history.py
+++ b/glances/exports/glances_history.py
@@ -39,23 +39,21 @@ else:
class GlancesHistory(object):
- """This class define the object to manage stats history"""
+ """This class define the object to manage stats history."""
def __init__(self, output_folder):
self.output_folder = output_folder
def get_output_folder(self):
- """Return the output folder where the graph are generated"""
+ """Return the output folder where the graph are generated."""
return self.output_folder
def graph_enabled(self):
- """Return True if Glances can generaate history graphs"""
+ """Return True if Glances can generate history graphs."""
return matplotlib_check
def reset(self, stats):
- """
- Reset all the history
- """
+ """Reset all the history."""
if not self.graph_enabled():
return False
for p in stats.getAllPlugins():
@@ -65,9 +63,7 @@ class GlancesHistory(object):
return True
def get_graph_color(self, item):
- """
- Get the item's color
- """
+ """Get the item's color."""
try:
ret = item['color']
except KeyError:
@@ -76,15 +72,11 @@ class GlancesHistory(object):
return ret
def get_graph_legend(self, item):
- """
- Get the item's legend
- """
+ """Get the item's legend."""
return item['name']
def get_graph_yunit(self, item, pre_label=''):
- """
- Get the item's Y unit
- """
+ """Get the item's Y unit."""
try:
unit = " (%s)" % item['y_unit']
except KeyError:
@@ -96,9 +88,9 @@ class GlancesHistory(object):
return "%s%s" % (label, unit)
def generate_graph(self, stats):
- """
- Generate graphs from plugins history
- Return the number of output files generated by the function
+ """Generate graphs from plugins history.
+
+ Return the number of output files generated by the function.
"""
if not self.graph_enabled():
return 0
@@ -176,8 +168,7 @@ class GlancesHistory(object):
fig.set_size_inches(20, 10)
plt.legend(handles, labels, loc=1, prop={'size': 9})
plt.xlabel('Date')
- plt.savefig(
- os.path.join(self.output_folder, 'glances_%s.png' % (p)), dpi=72)
+ plt.savefig(os.path.join(self.output_folder, 'glances_%s.png' % p), dpi=72)
index_all += 1
plt.close()