Skip to content

Commit

Permalink
[country_map] use Albers USA projection (apache#3946)
Browse files Browse the repository at this point in the history
* [country_map] use Albers USA projection

* Minor touchups

* Adding color scheme
  • Loading branch information
mistercrunch authored and michellethomas committed May 23, 2018
1 parent cd02c48 commit 1e0fc7b
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 56 deletions.
1 change: 1 addition & 0 deletions superset/assets/javascripts/explore/stores/controls.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export const controls = {
['white_black', 'white/black'],
['black_white', 'black/white'],
['dark_blue', 'light/dark blue'],
['pink_grey', 'pink/white/grey'],
],
default: 'blue_white_yellow',
clearable: false,
Expand Down
3 changes: 2 additions & 1 deletion superset/assets/javascripts/explore/stores/visTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,9 @@ export const visTypes = {
},
{
label: t('Options'),
expanded: true,
controlSetRows: [
['select_country'],
['select_country', 'number_format'],
['linear_color_scheme'],
],
},
Expand Down
5 changes: 5 additions & 0 deletions superset/assets/javascripts/modules/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ export const spectrums = {
'#1B4150',
'#092935',
],
pink_grey: [
'#E70B81',
'#FAFAFA',
'#666666',
],
};

/**
Expand Down
112 changes: 58 additions & 54 deletions superset/assets/visualizations/countries/usa.geojson

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion superset/assets/visualizations/country_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function countryMapChart(slice, payload) {
let resultText;
const container = slice.container;
const data = payload.data;
const format = d3.format(fd.number_format);

const colorScaler = colorScalerFactory(fd.linear_color_scheme, data, v => v.metric);
const colorMap = {};
Expand Down Expand Up @@ -91,7 +92,7 @@ function countryMapChart(slice, payload) {

const updateMetrics = function (region) {
if (region.length > 0) {
resultText.text(d3.format(',')(region[0].metric));
resultText.text(format(region[0].metric));
}
};

Expand Down

0 comments on commit 1e0fc7b

Please sign in to comment.