Fix metric formating in Dashboard view + some refactoring (#2598)

* Fix metric formating in Dashboard view + some refactoring

* Fixing build
This commit is contained in:
Maxime Beauchemin
2017-04-12 09:37:49 -07:00
committed by GitHub
parent 93c6597cf4
commit 31283f1424
9 changed files with 50 additions and 44 deletions

View File

@@ -55,7 +55,7 @@ const px = function () {
})
.tooltip();
}
const Slice = function (data, controller) {
const Slice = function (data, datasource, controller) {
let timer;
const token = $('#token_' + data.slice_id);
const containerId = 'con_' + data.slice_id;
@@ -74,6 +74,7 @@ const px = function () {
formData,
container,
containerId,
datasource,
selector,
getWidgetHeader() {
return this.container.parents('div.widget').find('.chart-header');
@@ -105,11 +106,11 @@ const px = function () {
d3format(col, number) {
// uses the utils memoized d3format function and formats based on
// column level defined preferences
if (data.column_formats) {
const format = data.column_formats[col];
return utils.d3format(format, number);
let format = '.3s';
if (this.datasource.column_formats[col]) {
format = this.datasource.column_formats[col];
}
return utils.d3format('.3s', number);
return utils.d3format(format, number);
},
/* eslint no-shadow: 0 */
always(data) {