[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:
Maxime Beauchemin
2017-06-19 22:09:09 -07:00
committed by GitHub
parent 591e512327
commit 3e51c61dbf
7 changed files with 116 additions and 67 deletions

View File

@@ -2,6 +2,7 @@ import { it, describe } from 'mocha';
import { expect } from 'chai';
import {
tryNumify, slugify, formatSelectOptionsForRange, d3format,
d3FormatPreset, d3TimeFormatPreset,
} from '../../../javascripts/modules/utils';
describe('utils', () => {
@@ -35,4 +36,20 @@ describe('utils', () => {
expect(d3format('.3s', 1237)).to.equal('1.24k');
expect(d3format('', 1237)).to.equal('1.24k');
});
describe('d3FormatPreset', () => {
it('is a function', () => {
assert.isFunction(d3FormatPreset);
});
it('returns a working formatter', () => {
expect(d3FormatPreset('.3s')(3000000)).to.equal('3.00M');
});
});
describe('d3TimeFormatPreset', () => {
it('is a function', () => {
assert.isFunction(d3TimeFormatPreset);
});
it('returns a working time formatter', () => {
expect(d3FormatPreset('smart_date')(0)).to.equal('1970');
});
});
});