[IMP] improved code to set suffix in tooltip.
bzr revid: tpa@tinyerp.com-20131011072744-pz4mcxbr4qbdrg79
This commit is contained in:
parent
c2505fb1ef
commit
cce3b9138b
|
@ -13,6 +13,11 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
var value = _.pluck(self.field.value, 'value');
|
var value = _.pluck(self.field.value, 'value');
|
||||||
var tooltips = _.pluck(self.field.value, 'tooltip');
|
var tooltips = _.pluck(self.field.value, 'tooltip');
|
||||||
|
var suffix = self.options.tooltip_suffix || "";
|
||||||
|
if (self.options.tooltip_suffix_field) {
|
||||||
|
suffix = self.getParent().record[self.options.tooltip_suffix_field].raw_value;
|
||||||
|
}
|
||||||
|
var tooltipformat = _.str.sprintf("{{offset:offset}}: {{value}} %s", suffix);
|
||||||
var sparkline_options = _.extend({
|
var sparkline_options = _.extend({
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: 5,
|
barWidth: 5,
|
||||||
|
@ -20,7 +25,7 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
barWidth: 4,
|
barWidth: 4,
|
||||||
barSpacing: 1,
|
barSpacing: 1,
|
||||||
barColor: '#96d854',
|
barColor: '#96d854',
|
||||||
tooltipFormat: self.set_offset(),
|
tooltipFormat: tooltipformat,
|
||||||
chartRangeMin: 0,
|
chartRangeMin: 0,
|
||||||
tooltipValueLookups: {
|
tooltipValueLookups: {
|
||||||
'offset': tooltips
|
'offset': tooltips
|
||||||
|
@ -30,9 +35,6 @@ instance.web_kanban.SparklineBarWidget = instance.web_kanban.AbstractField.exten
|
||||||
self.$el.tipsy({'delayIn': self.options.delayIn || 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
|
self.$el.tipsy({'delayIn': self.options.delayIn || 0, 'html': true, 'title': function(){return title}, 'gravity': 'n'});
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
set_offset: function(){
|
|
||||||
return '{{offset:offset}} {{value}}';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.web_kanban.fields_registry.add("sparkline_bar", "instance.web_kanban.SparklineBarWidget");
|
instance.web_kanban.fields_registry.add("sparkline_bar", "instance.web_kanban.SparklineBarWidget");
|
||||||
|
|
Loading…
Reference in New Issue