Skip to content

legend gray out if filtered #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 38 additions & 35 deletions src/components/plotControls/PlotLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ export default function PlotLegend({
alignItems: 'center',
fontSize: legendTextSize,
// gray out for filtered item
color: checkedLegendItems?.includes(item.label)
? ''
: '#999',
color:
checkedLegendItems?.includes(item.label) && item.hasData
? ''
: '#999',
// add this for general usage (e.g., story)
margin: 0,
}}
Expand Down Expand Up @@ -135,11 +136,11 @@ export default function PlotLegend({
height: defaultMarkerSize,
width: defaultMarkerSize,
borderWidth: '0',
backgroundColor: checkedLegendItems?.includes(
item.label
)
? item.markerColor
: '#999',
backgroundColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? item.markerColor
: '#999',
}}
/>
)}
Expand All @@ -151,16 +152,18 @@ export default function PlotLegend({
width: defaultMarkerSize,
borderWidth: '0.125em',
borderStyle: 'solid',
borderColor: checkedLegendItems?.includes(item.label)
? item.markerColor
: '#999',
backgroundColor: checkedLegendItems?.includes(
item.label
)
? ColorMath.evaluate(
item.markerColor + ' @a 50%'
).result.css()
: '#999',
borderColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? item.markerColor
: '#999',
backgroundColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? ColorMath.evaluate(
item.markerColor + ' @a 50%'
).result.css()
: '#999',
}}
/>
)}
Expand All @@ -175,11 +178,11 @@ export default function PlotLegend({
borderWidth: '0.15em',
borderStyle: 'solid',
borderRadius: '0.6em',
borderColor: checkedLegendItems?.includes(
item.label
)
? item.markerColor
: '#999',
borderColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? item.markerColor
: '#999',
}}
/>
</div>
Expand All @@ -192,11 +195,11 @@ export default function PlotLegend({
height: '0.15em',
width: scatterMarkerSpace,
borderWidth: '0',
backgroundColor: checkedLegendItems?.includes(
item.label
)
? item.markerColor
: '#999',
backgroundColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? item.markerColor
: '#999',
}}
/>
</div>
Expand All @@ -209,13 +212,13 @@ export default function PlotLegend({
height: '0.5em',
width: scatterMarkerSpace,
borderWidth: '0',
backgroundColor: checkedLegendItems?.includes(
item.label
)
? ColorMath.evaluate(
item.markerColor + ' @a 30%'
).result.css()
: '#999',
backgroundColor:
checkedLegendItems?.includes(item.label) &&
item.hasData
? ColorMath.evaluate(
item.markerColor + ' @a 30%'
).result.css()
: '#999',
}}
/>
</div>
Expand Down