mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
[explore] improve bubble viz (#2927)
* [explore] improve bubble viz * allow for custom axis formatters * reorg the control panels * Addressing comments
This commit is contained in:
committed by
GitHub
parent
591e512327
commit
3e51c61dbf
@@ -1,6 +1,29 @@
|
||||
/* eslint camelcase: 0 */
|
||||
const d3 = require('d3');
|
||||
const $ = require('jquery');
|
||||
import d3 from 'd3';
|
||||
import $ from 'jquery';
|
||||
|
||||
import { formatDate, UTC } from './dates';
|
||||
|
||||
export function d3FormatPreset(format) {
|
||||
// like d3.format, but with support for presets like 'smart_date'
|
||||
if (format === 'smart_date') {
|
||||
return formatDate;
|
||||
}
|
||||
if (format) {
|
||||
return d3.format(format);
|
||||
}
|
||||
return d3.format('.3s');
|
||||
}
|
||||
export const d3TimeFormatPreset = function (format) {
|
||||
if (format === 'smart_date') {
|
||||
return formatDate;
|
||||
}
|
||||
const f = d3.time.format(format);
|
||||
return function (dttm) {
|
||||
const d = UTC(new Date(dttm));
|
||||
return f(d);
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
Utility function that takes a d3 svg:text selection and a max width, and splits the
|
||||
|
||||
Reference in New Issue
Block a user