mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
DECKGL integration - Phase 1 (#3771)
* DECKGL integration Adding a new set of geospatial visualizations building on top of the awesome deck.gl library. https://github.com/uber/deck.gl While the end goal it to expose all types of layers and let users bind their data to control most props exposed by the deck.gl API, this PR focusses on a first set of visualizations and props: * ScatterLayer * HexagonLayer * GridLayer * ScreenGridLayer * Addressing comments * lint * Linting * Addressing chri's comments
This commit is contained in:
committed by
Grace Guo
parent
1c545d3a2d
commit
3a8af5d0b0
@@ -1,7 +1,7 @@
|
||||
import { it, describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { ALL_COLOR_SCHEMES, getColorFromScheme } from '../../../javascripts/modules/colors';
|
||||
import { ALL_COLOR_SCHEMES, getColorFromScheme, hexToRGB } from '../../../javascripts/modules/colors';
|
||||
|
||||
describe('colors', () => {
|
||||
it('default to bnbColors', () => {
|
||||
@@ -19,4 +19,13 @@ describe('colors', () => {
|
||||
expect(color1).to.equal(color3);
|
||||
expect(color4).to.equal(ALL_COLOR_SCHEMES.bnbColors[1]);
|
||||
});
|
||||
|
||||
it('hexToRGB converts properly', () => {
|
||||
expect(hexToRGB('#FFFFFF')).to.have.same.members([255, 255, 255, 255]);
|
||||
expect(hexToRGB('#000000')).to.have.same.members([0, 0, 0, 255]);
|
||||
expect(hexToRGB('#FF0000')).to.have.same.members([255, 0, 0, 255]);
|
||||
expect(hexToRGB('#00FF00')).to.have.same.members([0, 255, 0, 255]);
|
||||
expect(hexToRGB('#0000FF')).to.have.same.members([0, 0, 255, 255]);
|
||||
expect(hexToRGB('#FF0000', 128)).to.have.same.members([255, 0, 0, 128]);
|
||||
});
|
||||
});
|
||||
|
||||
27
superset/assets/spec/javascripts/modules/geo_spec.jsx
Normal file
27
superset/assets/spec/javascripts/modules/geo_spec.jsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { it, describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { unitToRadius } from '../../../javascripts/modules/geo';
|
||||
|
||||
const METER_TO_MILE = 1609.34;
|
||||
|
||||
describe('unitToRadius', () => {
|
||||
it('converts to square meters', () => {
|
||||
expect(unitToRadius('square_m', 4 * Math.PI)).to.equal(2);
|
||||
});
|
||||
it('converts to square meters', () => {
|
||||
expect(unitToRadius('square_km', 25 * Math.PI)).to.equal(5000);
|
||||
});
|
||||
it('converts to radius meters', () => {
|
||||
expect(unitToRadius('radius_m', 1000)).to.equal(1000);
|
||||
});
|
||||
it('converts to radius km', () => {
|
||||
expect(unitToRadius('radius_km', 1)).to.equal(1000);
|
||||
});
|
||||
it('converts to radius miles', () => {
|
||||
expect(unitToRadius('radius_miles', 1)).to.equal(METER_TO_MILE);
|
||||
});
|
||||
it('converts to square miles', () => {
|
||||
expect(unitToRadius('square_miles', 25 * Math.PI)).to.equal(5000 * (METER_TO_MILE / 1000));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user