Skip to content

FE: add selected/selectable visual states to BarChart#1748

Open
ikondrat wants to merge 2 commits into
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p6from
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p7
Open

FE: add selected/selectable visual states to BarChart#1748
ikondrat wants to merge 2 commits into
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p6from
kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p7

Conversation

@ikondrat

Copy link
Copy Markdown
Contributor

Summary

Stacked on p6.

Extends CategoryCount with optional selected and selectable boolean fields; buildEchartsOption applies visual feedback:

  • Selected bar: bright white border (rgba(255,255,255,0.95))
  • Unselectable bar: 45% opacity (same dimming as disabled state elsewhere)
  • Clicks on selectable=false bars are suppressed at the BarChart level so the host component only receives intentional selections

Bars without either field behave identically to before (backwards-compatible).

Test plan

  • make static-checks (frontend) passes
  • npm run test:unit passes (new tests in buildEchartsOption.test.ts)

Part of LIG-9585.

@ikondrat
ikondrat requested a review from a team as a code owner July 22, 2026 16:18
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 25e149db-761a-4ff7-846e-08e215f7ea45

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p7

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lightly-fast-track-bot

lightly-fast-track-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

❌  Fast Track: checks did not pass

Guardrail Result Message
dummy Always passes.
frontend/complexity Guardrail threw: Cannot find module 'eslint' Require stack: - /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json
backend/complexity 0 file(s) checked.
backend/coverage 0 file(s) checked.
diff-size PR adds 38 line(s) (limit: 215).
frontend/coverage [FAIL] lightly_studio_view/src/lib/components/BarChart/types.ts: no test file found [FAIL] lightly_studio_view/src/lib/components/BarChart/BarChart.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/BarChart/buildEchartsOption.ts: coverage data not found

View the guardrail run

To run the guardrails locally, from fast_track/ run make install once, then make run-guardrails (or GUARDRAILS=<name1>,<name2> make run-guardrails for some guardrails).

Reflects 3292fd1.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d958aead1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (typeof params.dataIndex !== 'number') return;
const item = data[params.dataIndex];
if (item) onBarClick?.(item);
if (item && item.selectable !== false) onBarClick?.(item);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover the unselectable click path

This is the only place that enforces selectable=false, but the added tests only inspect the ECharts option and do not exercise this click branch. A regression could start calling onBarClick for unselectable bars while the new option-builder test still passes, so please add a BarChart component test using the mocked click handler for a selectable: false datum.

AGENTS.md reference: AGENTS.md:L39-L41

Useful? React with 👍 / 👎.

Comment on lines +96 to +98
opacity: item.selectable === false ? 0.45 : 1,
borderColor: item.selected ? SELECTED_BORDER_COLOR : 'transparent',
borderWidth: item.selected ? 3 : 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Name the new visual-state constants

The new selected/unselectable styling hard-codes 0.45, 1, 3, and 0 inside the series-data mapper even though these values define reusable visual states. Please lift the opacity and border-width values into named constants next to BAR_COLOR/SELECTED_BORDER_COLOR so the option builder stays easier to scan and future changes to the disabled/selected treatment are centralized.

AGENTS.md reference: AGENTS.md:L39-L41

Useful? React with 👍 / 👎.

CategoryCount gains optional selected and selectable fields; buildEchartsOption
renders a bright border on selected bars and dims unselectable ones.
Clicks on bars with selectable=false are suppressed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ikondrat
ikondrat force-pushed the kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p6 branch from 8788416 to aaeaf8a Compare July 22, 2026 17:06
@ikondrat
ikondrat force-pushed the kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p7 branch from d958aea to a32f9c9 Compare July 22, 2026 17:06
…t-filter-ui-8-sp.p6' into kondrat-lig-9585-frontend-categorical-metadata-bar-chart-filter-ui-8-sp.p7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant