[FIX] kpi_dashboard: Meter widget supports customization using parameters

Meter widget is implemented with GaugeMeter (https://github.com/Mictronics/GaugeMeter). GaugeMeter provides a number of parameters to customize its display.  See https://github.com/Mictronics/GaugeMeter#parameter-definitions for details.

Allow user to customize GaugeMeter by setting the customization parameters in the result.
This mechanism can be used to show actual values instead of percentages by setting total, used & showvalue parameter in the result.
Fixes #428
This commit is contained in:
Lijo Antony
2022-07-26 16:43:51 +04:00
committed by Lijo Antony
parent 838a06d0be
commit e14f77b618
3 changed files with 8 additions and 5 deletions

View File

@@ -17,7 +17,6 @@ odoo.define("kpi_dashboard.MeterWidget", function (require) {
_getMeterOptions: function (values) {
var size = Math.min(this.widget_size_x, this.widget_size_y - 40) - 10;
return {
percent: values.value.value,
style: "Arch",
width: 10,
size: size,
@@ -25,6 +24,8 @@ odoo.define("kpi_dashboard.MeterWidget", function (require) {
append: values.suffix === undefined ? "" : values.suffix,
color: values.font_color,
animate_text_colors: true,
...(values.value.value && {percent: values.value.value}),
...values.value,
};
},
});