[FIX] web_kanban_sparkline: Floating format
The format of a float value must consider the language of the user. opw:632348
This commit is contained in:
parent
3b6eae8b1e
commit
a5a797d0a6
|
@ -11,6 +11,15 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
var self = this;
|
var self = this;
|
||||||
var title = this.$node.html() || this.field.string;
|
var title = this.$node.html() || this.field.string;
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
var tooltipFormatter = function(sp, options, fields) {
|
||||||
|
var format = $.spformat('<div class="jqsfield">{{offset:offset}} {{formatted_value}}</div>');
|
||||||
|
var result = '';
|
||||||
|
$.each(fields, function(i, field) {
|
||||||
|
field.formatted_value = instance.web.format_value(field.value, { type : 'float' });
|
||||||
|
result += format.render(field, options.get('tooltipValueLookups'), options);
|
||||||
|
})
|
||||||
|
return result;
|
||||||
|
}
|
||||||
var field_value = JSON.parse(self.field.value);
|
var field_value = JSON.parse(self.field.value);
|
||||||
var value = _.pluck(field_value, 'value');
|
var value = _.pluck(field_value, 'value');
|
||||||
var tooltips = _.pluck(field_value, 'tooltip');
|
var tooltips = _.pluck(field_value, 'tooltip');
|
||||||
|
@ -24,6 +33,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
barSpacing: 1,
|
barSpacing: 1,
|
||||||
barColor: '#96d854',
|
barColor: '#96d854',
|
||||||
tooltipFormat: tooltipFormat,
|
tooltipFormat: tooltipFormat,
|
||||||
|
tooltipFormatter: self.options.type == 'tristate' ? undefined : tooltipFormatter,
|
||||||
chartRangeMin: 0,
|
chartRangeMin: 0,
|
||||||
tooltipValueLookups: {
|
tooltipValueLookups: {
|
||||||
'offset': tooltips
|
'offset': tooltips
|
||||||
|
|
Loading…
Reference in New Issue