Skip to content
Back to skills

Bubble Chart

ASecurity

Packed circle chart using D3 circle-packing layout. Bubble size is proportional to data value. Supports labels, gradients, masks, and custom bubble rendering.

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
data-aireactnodeaws

Works with

  • cli

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add reaviz/skills --skill bubble-chart --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bubble Chart?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bubble Chart
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/reaviz-bubble-chart/badge)](https://www.skillsdirectory.com/skills/reaviz-bubble-chart)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# BubbleChart

Packed circle chart using D3 circle-packing layout. Bubble size is proportional to data value. Supports labels, gradients, masks, and custom bubble rendering.

## Import

```tsx
import { BubbleChart, BubbleSeries, Bubble, BubbleLabel } from 'reaviz';
```

## BubbleChart Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `data` | `ChartShallowDataShape[]` | `[]` | Chart data |
| `width` | `number` | auto | Width in pixels |
| `height` | `number` | auto | Height in pixels |
| `margins` | `Margins` | `10` | Chart margins |
| `series` | `ReactElement<BubbleSeriesProps>` | `<BubbleSeries />` | Series component |
| `className` | `string` | — | SVG CSS class |
| `containerClassName` | `string` | — | Container div CSS class |

## BubbleSeries Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `animated` | `boolean` | `true` | Enable animations |
| `colorScheme` | `ColorSchemeType` | `'cybertron'` | Color scheme name or function |
| `bubble` | `ReactElement<BubbleProps>` | `<Bubble />` | Bubble element |
| `label` | `ReactElement<BubbleLabelProps>` | `<BubbleLabel />` | Label element |
| `format` | `(item) => ReactElement<BubbleProps>` | — | Custom bubble renderer (overrides `bubble` prop) |

## Bubble Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `tooltip` | `ReactElement<ChartTooltipProps> \| null` | `<ChartTooltip />` | Tooltip component |
| `gradient` | `ReactElement<GradientProps> \| null` | — | Gradient fill |
| `mask` | `ReactElement<MaskProps> \| null` | — | SVG pattern mask |
| `glow` | `Glow` | — | Glow effect |
| `onClick` | `(event, node) => void` | — | Click handler |
| `onMouseEnter` | `(event) => void` | — | Mouse enter handler |
| `onMouseLeave` | `(event) => void` | — | Mouse leave handler |

## BubbleLabel Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `wrap` | `boolean` | `true` | Wrap long text |
| `fontSize` | `number` | `14` | Font size |
| `fontFamily` | `string` | `'sans-serif'` | Font family |
| `fill` | `string` | — | Text color (auto-inverted from bubble color if not set) |
| `format` | `(data) => any` | — | Custom label formatter |

## Basic Usage

```tsx
const data = [
  { key: 'AWS', data: 100 },
  { key: 'SendGrid', data: 45 },
  { key: 'Okta', data: 75 },
  { key: 'Twilio', data: 25 },
];

<BubbleChart
  width={450}
  height={350}
  data={data}
/>
```

## With Gradient

```tsx
import { Gradient } from 'reaviz';

<BubbleChart
  data={data}
  series={
    <BubbleSeries
      bubble={<Bubble gradient={<Gradient />} />}
    />
  }
/>
```

## With Pattern Mask

```tsx
import { Stripes } from 'reaviz';

<BubbleChart
  data={data}
  series={
    <BubbleSeries
      bubble={<Bubble mask={<Stripes />} />}
    />
  }
/>
```

## Custom Label Format

```tsx
<BubbleChart
  data={data}
  series={
    <BubbleSeries
      label={<BubbleLabel format={(d) => `${d.data.key}: ${d.data.data}`} />}
    />
  }
/>
```

## Custom Bubble Rendering (Icons)

```tsx
<BubbleChart
  data={data}
  series={
    <BubbleSeries
      format={(item) => (
        <Bubble
          tooltip={<ChartTooltip />}
          // render custom content inside bubble
        />
      )}
    />
  }
/>
```

## No Animation

```tsx
<BubbleChart
  data={data}
  series={<BubbleSeries animated={false} />}
/>
```

## Notes

- Uses D3 `pack` layout to compute circle positions and sizes
- Label text color is automatically inverted from the bubble fill for contrast
- Long labels wrap by default within the bubble bounds
- Autosize: omit `width`/`height` and the chart fills its container

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.