Skip to main content
Public

Share visualization

Loading preview…

Bowl of Fruit - Click to Select

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Bowl of Fruit - Click to Select

0
Jjesramyep1263
Last edited Mar 31, 2020
Created on Mar 31, 2020

Five apples sit in a row across an SVG canvas, each rendered as a red circle with a radius of 50 pixels. Clicking any apple strokes it with a thick black border to mark it as selected, while the previously selected apple loses its outline. The example uses React state via the `useState` hook to track the selected fruit ID and d3's `scaleOrdinal` for both color and radius mapping. All fruits are generated with `range` and rendered as React components, with the selection interaction handled through the `onClick` event.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed