Commit f9a099a2 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Results: Hydrograph: Add legend.

Showing with 16 additions and 0 deletions
+16 -0
......@@ -54,6 +54,10 @@ class PlotH(PamhyrPlot):
self.label_x = _translate("Results", "Time (s)")
self.label_y = _translate("Results", "Discharge (m³/s)")
self.label_discharge = _translate("Results", "Cross-section discharge")
self.label_discharge_max = _translate("Results", "Max discharge")
self.label_timestamp = _translate("Results", "Current timestamp")
self._isometric_axis = False
self._auto_relim_update = True
......@@ -88,6 +92,8 @@ class PlotH(PamhyrPlot):
self.set_ticks_time_formater()
self.enable_legend()
self.idle()
self._init = True
......@@ -100,6 +106,7 @@ class PlotH(PamhyrPlot):
self._line, = self.canvas.axes.plot(
x, y,
label=self.label_discharge,
color=self.color_plot,
**self.plot_default_kargs
)
......@@ -112,6 +119,7 @@ class PlotH(PamhyrPlot):
self._current, = self.canvas.axes.plot(
self._current_timestamp,
y[self.ts.index(self._current_timestamp)],
# label=self.label_timestamp,
color=self.color_plot_current,
**kargs
)
......@@ -131,6 +139,7 @@ class PlotH(PamhyrPlot):
self._line_max, = self.canvas.axes.plot(
x, y,
label=self.label_discharge_max,
color=self.color_plot_highlight,
linestyle='dotted',
**self.plot_default_kargs
......
......@@ -200,3 +200,10 @@ class PamhyrPlot(APlot):
labelsize=9,
labelrotation=45
)
def enable_legend(self):
self.canvas.axes.legend(
fancybox=True,
shadow=True,
fontsize=8
)
Supports Markdown
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