Skip to content

Commit

Permalink
measurements: keep tree strain colors regardless of visibility
Browse files Browse the repository at this point in the history
We need the tree strain colors for all strains regardless of visibility
so that we can display the colors for the reference strains in the
y-axis label even when the strain is not visible in the tree.
  • Loading branch information
joverlee521 committed Oct 4, 2022
1 parent c120508 commit 76e71b9
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/components/measurements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,22 @@ const treeStrainPropertySelector = (state) => {
// Only store properties of terminal strain nodes
if (!node.hasChildren) {
treeStrainVisibility[node.name] = tree.visibility[index];
// Only store colors for visible strains since only measurmeents
// for visible strains will be displayed
if (isVisible(tree.visibility[index])) {
/*
* If the color scale is continuous, we want to group by the legend value
* instead of the specific strain attribute in order to combine all values
* within the legend bounds into a single group.
*/
let attribute = getTipColorAttribute(node, colorScale);
if (colorScale.continuous) {
const matchingLegendValue = colorScale.visibleLegendValues
.find((legendValue) => determineLegendMatch(legendValue, node, colorScale));
if (matchingLegendValue !== undefined) attribute = matchingLegendValue;
}
treeStrainColors[node.name] = {
attribute,
color: tree.nodeColors[index]
};
/*
* If the color scale is continuous, we want to group by the legend value
* instead of the specific strain attribute in order to combine all values
* within the legend bounds into a single group.
*/
let attribute = getTipColorAttribute(node, colorScale);
if (colorScale.continuous) {
const matchingLegendValue = colorScale.visibleLegendValues
.find((legendValue) => determineLegendMatch(legendValue, node, colorScale));
if (matchingLegendValue !== undefined) attribute = matchingLegendValue;
}
treeStrainColors[node.name] = {
attribute,
color: tree.nodeColors[index]
};

}
return treeStrainProperty;
}, intitialTreeStrainProperty);
Expand Down

0 comments on commit 76e71b9

Please sign in to comment.