---
title: "Dumbbell Chart Image API — Before→after range plots | Imejis"
description: "Generate dumbbell / range-plot images — before→after comparisons with the change between two dots emphasized, set on every API call. Start free with Imejis."
url: "https://www.imejis.io/components/dumbbell"
---

# Dumbbell Chart Image API — Before→after range plots | Imejis

A dumbbell / range plot — before→after (or two-point) comparison per row, with the change between two dots emphasized. Tailor-made for "Q1 → Q2" and gap visuals.

## Use cases

- "Q1 → Q2" revenue-change report graphics
- Before/after campaign or A/B-test result cards
- Salary or price range bands by role/product
- Year-over-year comparison social cards

## Authoring notes

- data is [{ label, from, to }] — the two dots are the from/to values, the bar shows the change.
- colorByDirection tints the bar green when to ≥ from and red when it falls — great for gains/losses.
- Set fromLabel/toLabel + showLegend to name the two points (e.g. "2020" → "2024").
- Use a tallish box; rows are laid out top-to-bottom, so more rows need more height.

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `data` | `object[]` | `[]` | Rows: array of { label, from, to } — one dumbbell per row. |
| `min` | `number` | — | Value-axis minimum (auto-fits when omitted). |
| `max` | `number` | — | Value-axis maximum (auto-fits when omitted). |
| `fromColor` | `color` | `"#94a3b8"` | Color of the "from" dot. |
| `toColor` | `color` | `"#2563eb"` | Color of the "to" dot. |
| `lineColor` | `color` | `"#cbd5e1"` | Connecting bar color. |
| `colorByDirection` | `boolean` | `false` | Tint the connecting bar green/red by direction (to ≥ from). |
| `showValues` | `boolean` | `false` | Print the endpoint values. |
| `valueFormat` | `'number' \| 'compact' \| 'percent' \| 'currency'` | `"number"` | How values are formatted (1,200 / 1.2K / 12% / $1,200). |
| `currencySymbol` | `string` | `"$"` | Symbol used with the 'currency' format. |
| `dotRadius` | `number` (min 0) | `6` | Endpoint dot radius in px. |
| `lineWidth` | `number` (min 0) | `3` | Connecting bar thickness in px. |
| `showAxis` | `boolean` | `true` | Show the value axis. |
| `showGrid` | `boolean` | `true` | Show vertical gridlines. |
| `gridColor` | `color` | `"#e6e6e3"` | Gridline color. |
| `textColor` | `color` | `"#52514e"` | Label and axis text color. |
| `fromLabel` | `string` | — | Legend name for the "from" series (e.g. "2020"). |
| `toLabel` | `string` | — | Legend name for the "to" series (e.g. "2024"). |
| `showLegend` | `boolean` | `false` | Show the from/to legend. |
| `opacity` | `number` | `1` | Overall component opacity from 0 (transparent) to 1 (opaque). |
| `borderWidth` | `number` | `0` | Border thickness in pixels around the component. |
| `borderColor` | `color` | `"transparent"` | Border color (any CSS color). |
| `borderStyle` | `'solid' \| 'dashed' \| 'dotted' \| 'double' \| 'none'` | `"solid"` | Border line style. |
| `borderRadius` | `number` | `0` | Corner radius in pixels. |
| `boxShadow` | `string` | — | CSS box-shadow applied to the component, e.g. "0 4px 6px rgba(0,0,0,0.1)". |

## Sample design JSON

```json
{
  "title": "Dumbbell sample",
  "description": "Region revenue, Q1 → Q2",
  "dimensions": {
    "width": 800,
    "height": 420
  },
  "background": {
    "color": "#ffffff"
  },
  "components": [
    {
      "id": "sample-dumbbell",
      "key": "change",
      "type": "dumbbell",
      "position": {
        "x": 120,
        "y": 60
      },
      "rotation": 0,
      "size": {
        "width": 560,
        "height": 300
      },
      "dynamic": true,
      "properties": {
        "data": [
          {
            "label": "North",
            "from": 120,
            "to": 180
          },
          {
            "label": "South",
            "from": 90,
            "to": 140
          },
          {
            "label": "East",
            "from": 160,
            "to": 150
          },
          {
            "label": "West",
            "from": 70,
            "to": 130
          }
        ],
        "fromColor": "#94a3b8",
        "toColor": "#2563eb",
        "colorByDirection": true,
        "showValues": true,
        "fromLabel": "Q1",
        "toLabel": "Q2",
        "showLegend": true,
        "valueFormat": "compact",
        "showAxis": true,
        "showGrid": true,
        "opacity": 1
      }
    }
  ]
}
```

## Examples

### Q1 → Q2 revenue by region

Four regions with the quarter-over-quarter change, up in green and down in red.

API overrides that reproduce this example:

```json
{
  "change.data": [
    {
      "label": "North",
      "from": 120,
      "to": 180
    },
    {
      "label": "South",
      "from": 90,
      "to": 140
    },
    {
      "label": "East",
      "from": 160,
      "to": 150
    },
    {
      "label": "West",
      "from": 70,
      "to": 130
    }
  ],
  "change.colorByDirection": true,
  "change.showValues": true,
  "change.valueFormat": "compact",
  "change.fromLabel": "Q1",
  "change.toLabel": "Q2",
  "change.showLegend": true
}
```

### Salary range by role

Min→max pay bands per role as dollar-formatted dumbbells.

API overrides that reproduce this example:

```json
{
  "change.data": [
    {
      "label": "Junior",
      "from": 60000,
      "to": 85000
    },
    {
      "label": "Mid",
      "from": 90000,
      "to": 130000
    },
    {
      "label": "Senior",
      "from": 140000,
      "to": 200000
    }
  ],
  "change.fromColor": "#a1a1aa",
  "change.toColor": "#7c3aed",
  "change.showValues": true,
  "change.valueFormat": "currency",
  "change.fromLabel": "Min",
  "change.toLabel": "Max",
  "change.showLegend": true
}
```

## API overrides

Push fresh rows per render with '<key>.data' (or just '<key>') as [{ label, from, to }]; colors, labels and format are overridable too.

Flat override payload (`key.property` addressing) with the sample design's current values — send only the keys you want to change:

```json
{
  "change.data": [
    {
      "label": "North",
      "from": 120,
      "to": 180
    },
    {
      "label": "South",
      "from": 90,
      "to": 140
    },
    {
      "label": "East",
      "from": 160,
      "to": 150
    },
    {
      "label": "West",
      "from": 70,
      "to": 130
    }
  ],
  "change.fromColor": "#94a3b8",
  "change.toColor": "#2563eb",
  "change.colorByDirection": true,
  "change.showValues": true,
  "change.fromLabel": "Q1",
  "change.toLabel": "Q2",
  "change.showLegend": true,
  "change.valueFormat": "compact",
  "change.showAxis": true,
  "change.showGrid": true,
  "change.opacity": 1
}
```

```bash
curl --location 'https://render.imejis.io/v1/{{YOUR_DESIGN_ID}}' \
--header 'dma-api-key: {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "change.data": [
        {
            "label": "North",
            "from": 120,
            "to": 180
        },
        {
            "label": "South",
            "from": 90,
            "to": 140
        },
        {
            "label": "East",
            "from": 160,
            "to": 150
        },
        {
            "label": "West",
            "from": 70,
            "to": 130
        }
    ],
    "change.fromColor": "#94a3b8",
    "change.toColor": "#2563eb",
    "change.colorByDirection": true,
    "change.showValues": true,
    "change.fromLabel": "Q1",
    "change.toLabel": "Q2",
    "change.showLegend": true,
    "change.valueFormat": "compact",
    "change.showAxis": true,
    "change.showGrid": true,
    "change.opacity": 1
}'
```

`{{YOUR_DESIGN_ID}}` and `{{YOUR_API_KEY}}` are placeholders: first create
the design in your account (paste the sample design JSON above into the
editor at https://app.imejis.io, or create it programmatically via the
imejis MCP server's `create_design` + `update_design` tools), then render
it with the design's id and one of your API keys.

Agents: the MCP server at https://api.imejis.io/api/mcp exposes this same
catalog as structured data via the `list_component_types` tool (property
kinds, allowed values, bounds, ready-to-use sample designs).

## Frequently Asked Questions

### How do I pass the data?

Send '<key>.data' as an array of { label, from, to } objects — one dumbbell per row; the two values become the two dots and the bar shows the change.

### Can the bar be colored by gain vs loss?

Yes — enable colorByDirection to tint the connecting bar green when to ≥ from and red when it drops.

### Can I name the two endpoints?

Set fromLabel and toLabel (e.g. "2020" and "2024") and enable showLegend to add a labeled legend.

## Variants

- [Before / after](https://www.imejis.io/components/dumbbell/before-after.md) — A two-point before→after comparison with a named legend and gain/loss tint.
- [Dark](https://www.imejis.io/components/dumbbell/dark.md) — Light dots on a dark canvas for social cards.

All components: https://www.imejis.io/components.md
