From 2320c3cb573f413f53ae2812a48d927bd769a5e0 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 12 May 2019 05:54:03 +0300 Subject: [PATCH] Make sure to include all Y-values --- gui/builtinGraphs/fitDmgTime.py | 3 +-- gui/builtinGraphs/fitDpsTime.py | 2 +- gui/graphFrame.py | 11 ++++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gui/builtinGraphs/fitDmgTime.py b/gui/builtinGraphs/fitDmgTime.py index 40b1a5652..e375d3e45 100644 --- a/gui/builtinGraphs/fitDmgTime.py +++ b/gui/builtinGraphs/fitDmgTime.py @@ -33,7 +33,7 @@ class FitDmgTimeGraph(Graph): def __init__(self): Graph.__init__(self) - self.defaults["time"] = "0-300" + self.defaults["time"] = "0-80" self.name = "Damage over time" self.fitDmgTime = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() @@ -76,7 +76,6 @@ class FitDmgTimeGraph(Graph): for point, val in fitDmgTime.getIterator(): x.append(point[variable]) y.append(val) - return x, y diff --git a/gui/builtinGraphs/fitDpsTime.py b/gui/builtinGraphs/fitDpsTime.py index 5278e45bf..12843429a 100644 --- a/gui/builtinGraphs/fitDpsTime.py +++ b/gui/builtinGraphs/fitDpsTime.py @@ -33,7 +33,7 @@ class FitDpsTimeGraph(Graph): def __init__(self): Graph.__init__(self) - self.defaults["time"] = "0-300" + self.defaults["time"] = "0-80" self.name = "DPS over time" self.fitDpsTime = None self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/graphFrame.py b/gui/graphFrame.py index 22243fbaa..5ee000104 100644 --- a/gui/graphFrame.py +++ b/gui/graphFrame.py @@ -264,6 +264,8 @@ class GraphFrame(wx.Frame): self.subplot.grid(True) legend = [] + min_y = 0 + max_y = 0 for fit in self.fits: try: success, status = view.getPoints(fit, values) @@ -273,9 +275,10 @@ class GraphFrame(wx.Frame): return x, y = success, status + min_y = min(min_y, min(y, default=0)) + max_y = max(max_y, max(y, default=0)) self.subplot.plot(x, y) - self.subplot.set_ylim(bottom=0) legend.append(fit.name) except Exception as ex: pyfalog.warning("Invalid values in '{0}'", fit.name) @@ -283,6 +286,12 @@ class GraphFrame(wx.Frame): self.canvas.draw() return + y_range = max_y - min_y + min_y -= y_range * 0.05 + max_y += y_range * 0.05 + + self.subplot.set_ylim(bottom=min_y, top=max_y) + if mpl_version < 2: if self.legendFix and len(legend) > 0: leg = self.subplot.legend(tuple(legend), "upper right", shadow=False)