Skip to content
Extraits de code Groupes Projets
Valider 8abd50db rédigé par Juliana's avatar Juliana
Parcourir les fichiers

[ADD]Add label + Text legend

parent f211efd3
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -524,7 +524,7 @@ class EnercoopOperation(models.Model):
type_date = 'date_slot:hour'
type_date_abs = 'date_slot:day'
type_date_histo = 'date_slot:hour'
elif type == 'year':
elif type == 'year' or 'semestre':
type_date = 'date_slot:month'
type_date_abs = 'date_slot:month'
type_date_histo = 'date_slot:month'
......
......@@ -60,9 +60,46 @@ odoo.define('enercoop_cdc.operation_graph', function (require) {
ticks: {
min: result.date_start,
},
title: {
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'kW',
}
}]
},
elements: {
point:{
radius: 0
}
}
},
};
var options_line_stacked = { options: {
scales: {
xAxes: [{
stacked: true,
type: 'time',
time: {
// Luxon format string
unit: unit,
},
ticks: {
min: result.date_start,
},
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
stacked: true,
scaleLabel: {
display: true,
text: 'Date'
labelString: 'kW',
}
}]
},
......@@ -81,13 +118,22 @@ odoo.define('enercoop_cdc.operation_graph', function (require) {
}
}
}};
var options_stacked = { options: {
var options_donuts = { options: {
showDatasetLabels : true,
cutoutPercentage: 41,
}};
var options_histo_stacked = { options: {
interaction: {
intersect: false,
},
scales: {
xAxes: [{
stacked: true,
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
stacked: true,
......@@ -95,6 +141,33 @@ odoo.define('enercoop_cdc.operation_graph', function (require) {
beginAtZero: true,
},
type: 'linear',
scaleLabel: {
display: true,
labelString: 'kWh',
}
}]
}
}};
var options_histo = { options: {
interaction: {
intersect: false,
},
scales: {
xAxes: [{
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
ticks: {
beginAtZero: true,
},
type: 'linear',
scaleLabel: {
display: true,
labelString: 'kWh',
}
}]
}
}};
......@@ -117,33 +190,34 @@ odoo.define('enercoop_cdc.operation_graph', function (require) {
Object.assign({}, result.line_chart_conso_line, options_line)
);
}
console.log(options_line);
console.log(chart_line_conso);
chart_donuts_conso = new Chart(
donuts_conso,
Object.assign({}, result.donuts_chart_conso, options)
Object.assign({}, result.donuts_chart_conso, options_donuts)
);
chart_histo_conso = new Chart(
histo_conso,
Object.assign({}, result.histo_chart_conso, options_stacked)
Object.assign({}, result.histo_chart_conso, options_histo_stacked)
);
if (result.scale == 'week' || result.scale == 'day'){
chart_line_prod = new Chart(
line_prod,
Object.assign({}, result.line_chart_prod_line, options_line)
Object.assign({}, result.line_chart_prod_line, options_line_stacked)
);
}
chart_donuts_prod = new Chart(
donuts_prod,
Object.assign({}, result.donuts_chart_prod, options)
Object.assign({}, result.donuts_chart_prod, options_donuts)
);
chart_histo_prod = new Chart(
histo_prod,
Object.assign({}, result.histo_chart_prod, options_stacked)
Object.assign({}, result.histo_chart_prod, options_histo)
);
this.$el.find('.o_enercoop_button').removeClass('active');
if (this.state.scale) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter