Make sure to include all Y-values

This commit is contained in:
DarkPhoenix
2019-05-12 05:54:03 +03:00
parent bd5710c676
commit 2320c3cb57
3 changed files with 12 additions and 4 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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)