lims: chart plot: plot second Y-axis even though the first could not be plotted

This commit is contained in:
Adrián Bernardi 2022-01-26 18:49:04 -03:00
parent a40e48d270
commit a30836bb70
1 changed files with 18 additions and 0 deletions

View File

@ -1563,7 +1563,25 @@ class TrendChart(ModelSQL, ModelView):
image = output.getvalue()
output.close()
return image
except (TypeError, ModuleNotFoundError):
if ds2:
try:
ax = df2.plot(kind='line', rot=45, fontsize=7,
figsize=(10, 7.5), marker='o', linestyle='-',
secondary_y=True)
ax.set_xlabel(self.x_axis_string)
if self.uom_y2:
ax.set_ylabel(self.uom_y2.symbol)
ax.get_figure().savefig(output, bbox_inches='tight',
dpi=300)
image = output.getvalue()
output.close()
return image
except (TypeError, ModuleNotFoundError):
pass
return output.getvalue()
@classmethod