Skip to content
Extraits de code Groupes Projets
Valider 1fac7fb0 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[UPD] replace bilan title on pie charts

parent 1fadd7c1
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -422,6 +422,14 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) { ...@@ -422,6 +422,14 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) {
_getPieChartConfig: function (typeData) { _getPieChartConfig: function (typeData) {
var data = this._getPieChartData(typeData); var data = this._getPieChartData(typeData);
var tot = 0;
data.datasets[0].data.forEach((num) => {
tot += num;
});
var title = [
"Total : " + tot + " kWh",
"(sur la période sélectionnée)",
];
return { return {
type: "pie", type: "pie",
data: data, data: data,
...@@ -451,6 +459,14 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) { ...@@ -451,6 +459,14 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) {
}, },
}, },
}, },
title: {
display: true,
fontColor: "#000",
fontFamily: '"overpass", sans-serif',
fontSize: 24.5,
fontStyle: "normal",
text: title,
},
tooltips: { tooltips: {
callbacks: { callbacks: {
label: function (tooltipItem, chart) { label: function (tooltipItem, chart) {
...@@ -654,7 +670,7 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) { ...@@ -654,7 +670,7 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) {
}); });
}, },
_exportChartData: function (title_name) { _exportChartData: function () {
var self = this; var self = this;
var url = "/chart/export_cdc?operation_id=" + self.operation; var url = "/chart/export_cdc?operation_id=" + self.operation;
url = url + "&start_date=" + self.first_day; url = url + "&start_date=" + self.first_day;
...@@ -761,8 +777,8 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) { ...@@ -761,8 +777,8 @@ odoo.define("oacc_portal_overview_cdc.operation_chart", function (require) {
this._updateChartData(this.title_name); this._updateChartData(this.title_name);
}, },
_onBtnExportClick: function (ev) { _onBtnExportClick: function () {
this._exportChartData(this.title_name); this._exportChartData();
}, },
_onChangePrm: function (ev) { _onChangePrm: function (ev) {
......
...@@ -198,7 +198,9 @@ ...@@ -198,7 +198,9 @@
class="col-10 col-xl-5 align-self-center mt-4 mt-lg-0" class="col-10 col-xl-5 align-self-center mt-4 mt-lg-0"
t-if="partners" t-if="partners"
> >
<div class="prm-selection align-items-between justify-content-around d-flex"> <div
class="prm-selection align-items-between justify-content-around d-flex"
>
<select <select
class="form-select" class="form-select"
aria-label="prm-selection" aria-label="prm-selection"
...@@ -248,7 +250,13 @@ ...@@ -248,7 +250,13 @@
</t> </t>
</t> </t>
</select> </select>
<a href="#" title="Export" target="_blank" class="btn btn-primary" id="export-data" > <a
href="#"
title="Export"
target="_blank"
class="btn btn-primary"
id="export-data"
>
<i class="fa fa-cloud-download " /> <i class="fa fa-cloud-download " />
<span class="d-none d-md-inline">Exporter</span> <span class="d-none d-md-inline">Exporter</span>
</a> </a>
...@@ -277,13 +285,11 @@ ...@@ -277,13 +285,11 @@
<template id="bilan_conso"> <template id="bilan_conso">
<div class="text-center mb-4 p-3 shadow op-graph"> <div class="text-center mb-4 p-3 shadow op-graph">
<h3>Bilan</h3>
<br /><br />
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="pie_chart_conso" id="pie_chart_conso"
class="pie_chart_conso" class="pie_chart_conso"
height="140" height="180"
/> />
</div> </div>
</div> </div>
...@@ -322,13 +328,11 @@ ...@@ -322,13 +328,11 @@
<template id="bilan_prod"> <template id="bilan_prod">
<div class="text-center mb-4 p-3 shadow op-graph"> <div class="text-center mb-4 p-3 shadow op-graph">
<h3>Bilan</h3>
<br /><br />
<div class="chart-container"> <div class="chart-container">
<canvas <canvas
id="pie_chart_prod" id="pie_chart_prod"
class="pie_chart_prod" class="pie_chart_prod"
height="140" height="180"
/> />
</div> </div>
</div> </div>
......
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