From f211efd300a61be561fb8a3ef38088911b80722a Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Thu, 12 Aug 2021 18:21:07 +0200 Subject: [PATCH] [ADD] add courbe prm prod --- models/enercoop_operation.py | 42 +++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/models/enercoop_operation.py b/models/enercoop_operation.py index 3f12884..86ddd92 100644 --- a/models/enercoop_operation.py +++ b/models/enercoop_operation.py @@ -368,7 +368,7 @@ class EnercoopOperation(models.Model): """ result = {} - result['line_chart_prod']= { + result['line_chart_prod'] = { 'type': 'line', 'data': { 'labels': chart_data['label'], @@ -448,6 +448,46 @@ class EnercoopOperation(models.Model): }] } } + result['line_chart_prod_prm'] = { + 'type': 'line', + 'data': { + 'labels': chart_data['label'], + 'datasets': [ + { + 'label': 'Production solaire', + 'data': chart_data['prod'], + 'backgroundColor': 'rgba(244, 165, 25, 0)', + 'borderColor': 'rgba(244, 165, 25, 1)', + }, + ], + }, + } + result['line_chart_prod_line_prm'] = { + 'type': 'line', + 'data': { + 'labels': chart_data['label'], + 'datasets': [ + { + 'label': 'Production solaire', + 'data': chart_data['prod_line'], + 'backgroundColor': 'rgba(244, 165, 25, 0)', + 'borderColor': 'rgba(244, 165, 25, 1)', + 'borderWidth': 2, + 'hoverRadius': 1, + 'radius': 0, + }, + { + 'label': 'Autoconso', + 'data': chart_data['autocons_line'], + 'backgroundColor': 'rgba(91, 154, 81, 0.4)', + 'borderColor': 'rgba(91, 154, 81, 1)', + 'borderWidth': 2, + 'hoverRadius': 1, + 'radius': 0, + }, + ], + }, + } return result def get_cdc(self, type, date_start, date_end, prm_id=None): -- GitLab