Skip to content
Snippets Groups Projects
Commit a67ba328 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] web: y-axis precision

In graph view, the y-axis always uses the standard float precision with
2 digits. This might not be enough if the precision was defined
differently for a given float type.

opw-697625
parent 2455e178
No related branches found
No related tags found
No related merge requests found
......@@ -107,7 +107,8 @@ return Widget.extend({
display_bar: function () {
// prepare data for bar chart
var data, values,
measure = this.fields[this.measure].string;
measure = this.fields[this.measure].string,
self = this;
// zero groupbys
if (this.groupbys.length === 0) {
......@@ -180,7 +181,12 @@ return Widget.extend({
rotateLabels: -20,
showControls: (this.groupbys.length > 1)
});
chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });});
chart.yAxis.tickFormat(function(d) {
return formats.format_value(d, {
type : 'float',
digits : self.fields[self.measure] && self.fields[self.measure].digits || [69, 2],
});
});
chart(svg);
this.to_remove = chart.update;
......@@ -312,7 +318,12 @@ return Widget.extend({
});
chart.xAxis.tickValues(tickValues)
.tickFormat(tickFormat);
chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });});
chart.yAxis.tickFormat(function(d) {
return formats.format_value(d, {
type : 'float',
digits : self.fields[self.measure] && self.fields[self.measure].digits || [69, 2],
});
});
chart(svg);
this.to_remove = chart.update;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment