Skip to content

Commit

Permalink
fix: show/hide the spectra legend fields
Browse files Browse the repository at this point in the history
  • Loading branch information
hamed-musallam committed Aug 28, 2024
1 parent eb51399 commit 20126dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/component/1d/SpectraLegends.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function InnerSpectraLegends({
spectra,
legendsFields,
}: InnerSpectraLegendsProps) {
const visibleLegendsFields = legendsFields.filter((legend) => legend.visible);

return (
<g className="spectra-intensity-legend">
{spectra.map((spectrum, index) => (
Expand All @@ -72,10 +74,9 @@ function InnerSpectraLegends({
}}
/>
<SVGGroup space={5} transform="translate(12 0)">
{legendsFields.map((field) => {
const predefinedField = field as PredefinedLegendField;

switch (predefinedField?.name) {
{visibleLegendsFields.map((field) => {
const { name } = field as PredefinedLegendField;
switch (name) {
case 'intensity':
return (
<g key="intensity">
Expand Down

0 comments on commit 20126dd

Please sign in to comment.