mirror of
https://github.com/apache/superset.git
synced 2026-04-21 09:04:38 +00:00
Adding rowcount label to explore view header (#4059)
This commit is contained in:
committed by
GitHub
parent
ec752b1378
commit
c21513fb8c
@@ -4,6 +4,17 @@ import $ from 'jquery';
|
||||
|
||||
import { formatDate, UTC } from './dates';
|
||||
|
||||
const siFormatter = d3.format('.3s');
|
||||
|
||||
export function defaultNumberFormatter(n) {
|
||||
let si = siFormatter(n);
|
||||
// Removing trailing `.00` if any
|
||||
if (si.slice(-1) < 'A') {
|
||||
si = parseFloat(si).toString();
|
||||
}
|
||||
return si;
|
||||
}
|
||||
|
||||
export function d3FormatPreset(format) {
|
||||
// like d3.format, but with support for presets like 'smart_date'
|
||||
if (format === 'smart_date') {
|
||||
@@ -12,7 +23,7 @@ export function d3FormatPreset(format) {
|
||||
if (format) {
|
||||
return d3.format(format);
|
||||
}
|
||||
return d3.format('.3s');
|
||||
return defaultNumberFormatter;
|
||||
}
|
||||
export const d3TimeFormatPreset = function (format) {
|
||||
const effFormat = format || 'smart_date';
|
||||
|
||||
Reference in New Issue
Block a user