mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-04 06:18:11 +08:00
Fix custom color handling (#1929)
This commit is contained in:
@@ -168,12 +168,7 @@ const renderLinks = (projectLinks, aboutURL) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const InfoFormat = React.memo(
|
const InfoFormat = React.memo(
|
||||||
({
|
({ datasetTitle, singleValueCategories, aboutURL, dataPortalProps = {} }) => {
|
||||||
datasetTitle,
|
|
||||||
singleValueCategories,
|
|
||||||
aboutURL,
|
|
||||||
dataPortalProps = {},
|
|
||||||
}) => {
|
|
||||||
if (dataPortalProps.version?.["corpora_schema_version"] !== "1.0.0") {
|
if (dataPortalProps.version?.["corpora_schema_version"] !== "1.0.0") {
|
||||||
dataPortalProps = {};
|
dataPortalProps = {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,15 +106,19 @@ export function loadUserColorConfig(userColors) {
|
|||||||
return -1;
|
return -1;
|
||||||
})
|
})
|
||||||
.reduce(
|
.reduce(
|
||||||
(acc, label, i) => {
|
(acc, label) => {
|
||||||
const color = parseRGB(userColors[category][label]);
|
const color = parseRGB(userColors[category][label]);
|
||||||
acc[0][label] = color;
|
acc[0][label] = color;
|
||||||
acc[1][i] = d3.rgb(255 * color[0], 255 * color[1], 255 * color[2]);
|
acc[1][label] = d3.rgb(
|
||||||
|
255 * color[0],
|
||||||
|
255 * color[1],
|
||||||
|
255 * color[2]
|
||||||
|
);
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
[{}, {}]
|
[{}, {}]
|
||||||
);
|
);
|
||||||
const scale = (i) => scaleMap[i];
|
const scale = (label) => scaleMap[label];
|
||||||
convertedUserColors[category] = { colors, scale };
|
convertedUserColors[category] = { colors, scale };
|
||||||
});
|
});
|
||||||
return convertedUserColors;
|
return convertedUserColors;
|
||||||
|
|||||||
Reference in New Issue
Block a user