diff --git a/models/enercoop_operation.py b/models/enercoop_operation.py
index acc3c2f7591db0bbd1e053d88a0baee86b74f5db..bacea1797f7b6c3727a485e57b06a85072a40eea 100644
--- a/models/enercoop_operation.py
+++ b/models/enercoop_operation.py
@@ -581,6 +581,15 @@ class EnercoopOperation(models.Model):
}
}]
},
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'x',
+ 'intersect': False,
+ },
'elements': {
'point': {
'radius': 0
@@ -674,6 +683,15 @@ class EnercoopOperation(models.Model):
'labelString': 'kWh',
}
}]
+ },
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'nearest',
+ 'intersect': 0,
}
}
}
@@ -715,6 +733,18 @@ class EnercoopOperation(models.Model):
},
'options': {
'cutoutPercentage': 60,
+ 'animation': {
+ 'animateScale': True,
+ },
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'nearest',
+ 'intersect': 0,
+ }
}
}
return result
@@ -734,22 +764,24 @@ class EnercoopOperation(models.Model):
'labels': chart_data['label'],
'datasets': [
{
- 'label': 'Surplus',
- 'data': chart_data['surplus'],
- 'backgroundColor': 'rgba(225, 80, 96, 0.4)',
- 'borderColor': 'rgba(225, 80, 96, 1)',
+ 'label': 'Autoconso',
+ 'data': chart_data['autocons_prod'],
+ 'backgroundColor': 'rgba(91, 154, 81, 0.4)',
+ 'borderColor': 'rgba(91, 154, 81, 1)',
'borderWidth': 2,
'hoverRadius': 1,
'radius': 0,
+ 'fill': 'origin'
},
{
- 'label': 'Autoconso',
- 'data': chart_data['autocons_prod'],
- 'backgroundColor': 'rgba(91, 154, 81, 0.4)',
- 'borderColor': 'rgba(91, 154, 81, 1)',
+ 'label': 'Surplus',
+ 'data': chart_data['surplus'],
+ 'backgroundColor': 'rgba(225, 80, 96, 0.4)',
+ 'borderColor': 'rgba(225, 80, 96, 1)',
'borderWidth': 2,
'hoverRadius': 1,
'radius': 0,
+ 'fill': '-1'
},
],
},
@@ -775,18 +807,27 @@ class EnercoopOperation(models.Model):
}
}]
},
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'x',
+ 'intersect': False,
+ },
'elements': {
'point': {
'radius': 0
}
- }
+ },
},
}
return result
def chart_data_donuts_prod(self, chart_data, scale):
"""
- Fonction retournant le dictionnaire permettant la construiction
+ Fonction retournant le dictionnaire permettant la construction
des graphes de la partie production
:param chart_data: données à afficher dans les chart (labels et data)
:return: un dictionnaire de chart
@@ -817,6 +858,21 @@ class EnercoopOperation(models.Model):
'borderWidth': 1
}],
},
+ 'options': {
+ 'cutoutPercentage': 60,
+ 'animation': {
+ 'animateScale': True,
+ },
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'nearest',
+ 'intersect': 0,
+ }
+ }
}
return result
@@ -892,7 +948,16 @@ class EnercoopOperation(models.Model):
'labelString': 'kWh',
}
}]
- }
+ },
+ 'tooltips': {
+ 'backgroundColor': '#f5f5f5',
+ 'titleFontColor': '#333',
+ 'bodyFontColor': '#666',
+ 'bodySpacing': 4,
+ 'xPadding': 12,
+ 'mode': 'nearest',
+ 'intersect': 0,
+ },
}
}
@@ -1040,8 +1105,6 @@ class EnercoopOperation(models.Model):
if not date_start and not date_end:
date_start, date_end = self.get_last_day(scale)
- # counter_ids = self.env['enercoop.counter'].sudo().search([('enercoop_operation_ids', 'in', self.sudo().enercoop_delivery_operation_ids.ids)]).ids
-
step_courbe, step_display_courbe = self.get_step_from_date(date_start=date_start, date_end=date_end)
# Get the data to display in chart
chart_data = self.get_cdc(
@@ -1049,7 +1112,8 @@ class EnercoopOperation(models.Model):
date_end=date_end, prm_ids=None)
# Build the chart with data and options
- result_graph = self.build_graph_data_options(chart_data, step_display_courbe=step_display_courbe, scale=scale, step_courbe=step_courbe)
+ result_graph = self.build_graph_data_options(
+ chart_data, step_display_courbe=step_display_courbe, scale=scale, step_courbe=step_courbe)
date_deb, date_max = self.get_last_day('day')
date_max = date_max.strftime("%d/%m/%Y")