# Bubble

<table data-card-size="large" data-view="cards"><thead><tr><th data-card-target data-type="content-ref"></th><th data-hidden></th><th data-hidden></th><th data-hidden></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><a href="#auto-bubble">#auto-bubble</a></td><td></td><td></td><td></td><td><a href="https://4045370218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0xzzR5x0BnQ6kHixlzd%2Fuploads%2FOnNGwyJo3RCcfvHnPWuB%2Fauto_bubble_example.jpg?alt=media&#x26;token=7f42f62d-2f02-4454-a9e0-1d24a8174a12">auto_bubble_example.jpg</a></td></tr></tbody></table>

## Auto Bubble

A bubble chart is a scatter chart but with different sized data points. When 3 numeric columns exist a bubble chart will be automatically created.

```sql
-- @title: Auto Bubble
-- @subtitle: Auto generted bubble chart
SELECT 
  Profit,
  Amount,
  (CAST(Profit AS FLOAT) / Amount) * 500 as Margin
FROM Sales
WHERE Status = 'Won'
LIMIT 10;
```

<div data-full-width="true"><figure><img src="https://4045370218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0xzzR5x0BnQ6kHixlzd%2Fuploads%2FOnNGwyJo3RCcfvHnPWuB%2Fauto_bubble_example.jpg?alt=media&#x26;token=7f42f62d-2f02-4454-a9e0-1d24a8174a12" alt=""><figcaption></figcaption></figure></div>

| PROFIT  | AMOUNT   | MARGIN           |
| ------- | -------- | ---------------- |
| 27064.0 | 84572.0  | 160.005675637327 |
| 45307.0 | 133253.0 | 170.003677215522 |
| 14746.0 | 73728.0  | 100.002712673611 |
| 21198.0 | 75705.0  | 140.003962750149 |
| 37394.0 | 196808.0 | 95.001219462623  |
| 15454.0 | 67191.0  | 115.000520903097 |
| 13263.0 | 78013.0  | 85.005063258688  |
| 11532.0 | 76878.0  | 75.00195114337   |
| 13092.0 | 72732.0  | 90.001649892757  |
