Skip to content

Commit

Permalink
Update @superset-ui/colors (#6464)
Browse files Browse the repository at this point in the history
* Update package version and update breaking changes for color

* update color function usage

* update dependency
  • Loading branch information
kristw authored Nov 30, 2018
1 parent 5f7817a commit 20e1ac6
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
"@data-ui/sparkline": "^0.0.54",
"@data-ui/theme": "^0.0.62",
"@data-ui/xy-chart": "^0.0.61",
"@superset-ui/chart": "^0.5.0",
"@superset-ui/color": "^0.5.0",
"@superset-ui/chart": "^0.7.0",
"@superset-ui/color": "^0.7.0",
"@superset-ui/connection": "^0.5.0",
"@superset-ui/core": "^0.5.0",
"@superset-ui/translation": "^0.5.0",
"@superset-ui/core": "^0.7.0",
"@superset-ui/translation": "^0.7.0",
"@vx/legend": "^0.0.170",
"@vx/responsive": "0.0.172",
"@vx/scale": "^0.0.165",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ describe('ColorPickerControl', () => {
beforeEach(() => {
getCategoricalSchemeRegistry()
.registerValue('test', new CategoricalScheme({
name: 'test',
id: 'test',
colors: ['red', 'green', 'blue'],
}))
.setDefaultSchemeName('test');
.setDefaultKey('test');
wrapper = shallow(<ColorPickerControl {...defaultProps} />);
inst = wrapper.instance();
});
Expand Down
6 changes: 3 additions & 3 deletions superset/assets/src/setup/setupColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export default function setupColors() {
const categoricalSchemeRegistry = getCategoricalSchemeRegistry();
[airbnb, categoricalD3, google, lyft].forEach((group) => {
group.forEach((scheme) => {
categoricalSchemeRegistry.registerValue(scheme.name, scheme);
categoricalSchemeRegistry.registerValue(scheme.id, scheme);
});
});
categoricalSchemeRegistry.setDefaultSchemeName('bnbColors');
categoricalSchemeRegistry.setDefaultKey('bnbColors');

const sequentialSchemeRegistry = getSequentialSchemeRegistry();
[sequentialCommon, sequentialD3].forEach((group) => {
group.forEach((scheme) => {
sequentialSchemeRegistry.registerValue(scheme.name, scheme);
sequentialSchemeRegistry.registerValue(scheme.id, scheme);
});
});
}
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Chord/Chord.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Chord(element, props) {
const div = d3.select(element);
const { nodes, matrix } = data;
const f = d3.format(numberFormat);
const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

const outerRadius = Math.min(width, height) / 2 - 10;
const innerRadius = outerRadius - 24;
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Histogram/Histogram.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CustomHistogram extends React.PureComponent {
yAxisLabel,
} = this.props;

const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);
const keys = data.map(d => d.key);
const colorScale = scaleOrdinal({
domain: keys,
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Partition/Partition.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function Icicle(element, props) {
const hasTime = ['adv_anal', 'time_series'].indexOf(chartType) >= 0;
const format = d3.format(numberFormat);
const timeFormat = d3TimeFormatPreset(dateTimeFormat);
const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

div.selectAll('*').remove();
const tooltip = div
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Rose/Rose.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function Rose(element, props) {
const numGroups = datum[times[0]].length;
const format = d3.format(numberFormat);
const timeFormat = d3TimeFormatPreset(dateTimeFormat);
const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

d3.select('.nvtooltip').remove();
div.selectAll('*').remove();
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Sankey/Sankey.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Sankey(element, props) {
.attr('class', 'sankey-tooltip')
.style('opacity', 0);

const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

const sankey = d3Sankey()
.nodeWidth(15)
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Sunburst/Sunburst.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function Sunburst(element, props) {
let arcs;
let gMiddleText; // dom handles

const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

// Helper + path gen functions
const partition = d3.layout.partition()
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/Treemap/Treemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Treemap(element, props) {
} = props;
const div = d3.select(element);
const formatNumber = d3.format(numberFormat);
const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);
const data = clone(rawData);

function draw(data, eltWidth, eltHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { getScale } = CategoricalColorNamespace;
function getCategories(fd, data) {
const c = fd.color_picker || { r: 0, g: 0, b: 0, a: 1 };
const fixedColor = [c.r, c.g, c.b, 255 * c.a];
const colorFn = getScale(fd.color_scheme).toFunction();
const colorFn = getScale(fd.color_scheme);
const categories = {};
data.forEach((d) => {
if (d.cat_color != null && !categories.hasOwnProperty(d.cat_color)) {
Expand Down Expand Up @@ -158,7 +158,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
}
addColor(data, fd) {
const c = fd.color_picker || { r: 0, g: 0, b: 0, a: 1 };
const colorFn = getScale(fd.color_scheme).toFunction();
const colorFn = getScale(fd.color_scheme);
return data.map((d) => {
let color;
if (fd.dimension) {
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/deckgl/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getBreakPointColorScaler({
: null;
const colorScheme = Array.isArray(linearColorScheme)
? new SequentialScheme({
name: 'custom',
id: 'custom',
colors: linearColorScheme,
})
: getSequentialSchemeRegistry().get(linearColorScheme);
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/nvd3/NVD3Vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ function nvd3Vis(element, props) {
});
}
} else if (vizType !== 'bullet') {
const colorFn = getScale(colorScheme).toFunction();
const colorFn = getScale(colorScheme);
chart.color(d => d.color || colorFn(cleanColorInput(d[colorKey])));
}

Expand Down
2 changes: 1 addition & 1 deletion superset/assets/src/visualizations/wordcloud/WordCloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function WordCloud(element, props) {
.fontWeight('bold')
.fontSize(d => scale(d.size));

const colorFn = CategoricalColorNamespace.getScale(colorScheme).toFunction();
const colorFn = CategoricalColorNamespace.getScale(colorScheme);

function draw(words) {
chart.selectAll('*').remove();
Expand Down
26 changes: 13 additions & 13 deletions superset/assets/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -399,18 +399,18 @@
dependencies:
array-from "^2.1.1"

"@superset-ui/chart@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@superset-ui/chart/-/chart-0.5.0.tgz#1420ce7b6ac3bf1b06875e5f2541fa98505b5a9b"
"@superset-ui/chart@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@superset-ui/chart/-/chart-0.7.0.tgz#c297642bf6968e9e24b8de68c595942ad02da949"
dependencies:
"@superset-ui/core" "^0.3.0"
reselect "^4.0.0"

"@superset-ui/color@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@superset-ui/color/-/color-0.5.0.tgz#3064bec063fdf43d568a39b4d9ded352d0aeed55"
"@superset-ui/color@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@superset-ui/color/-/color-0.7.0.tgz#9d3eca8da493e1241a047f88b06d668b2cd20e3c"
dependencies:
"@superset-ui/core" "^0.5.0"
"@superset-ui/core" "^0.7.0"
d3-scale "^2.1.2"

"@superset-ui/connection@^0.5.0":
Expand All @@ -426,15 +426,15 @@
dependencies:
lodash "^4.17.11"

"@superset-ui/core@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@superset-ui/core/-/core-0.5.0.tgz#8784465e312cac5015df28d8540d27a2fd6060ba"
"@superset-ui/core@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@superset-ui/core/-/core-0.7.0.tgz#aa116248d56fd22d57a7bbc9afbdfc0cb367146a"
dependencies:
lodash "^4.17.11"

"@superset-ui/translation@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@superset-ui/translation/-/translation-0.5.0.tgz#d02af7be94ac6b9e48d3b09f9f1059b11b2d283d"
"@superset-ui/translation@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@superset-ui/translation/-/translation-0.7.0.tgz#8b9426a97d523df5aefe9242084264897efe252c"
dependencies:
jed "^1.1.1"

Expand Down

0 comments on commit 20e1ac6

Please sign in to comment.