---
title: "Horizontal Bar Chart Image API — Ranking charts | Imejis"
description: "Bars running left-to-right suit rankings and long category names — data and labels swapped on every API call. Create horizontal bar chart images free."
url: "https://www.imejis.io/components/chart/horizontal-bars"
---

# Horizontal Bar Chart Image API — Ranking charts | Imejis

Bars running left-to-right — rankings and long category names.

## Use cases

- Top-10 leaderboards and rankings
- Survey answers with long option names
- Category comparison report images

## Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `chartType` | `'bar' \| 'line' \| 'area'` | `"bar"` | Chart style. |
| `data` | `number[]` | `[]` | Single-series data values (ignored when series is set). |
| `series` | `object[]` | `[]` | Multi-series data: array of { name?, data: number[], color? }. |
| `labels` | `string[]` | `[]` | Category labels along the x-axis. |
| `colors` | `color[]` | `[]` | Color palette. Multi-series: one color per series. Single-series bar charts: colors[i] colors bar i individually (empty string = inherit). |
| `orientation` | `'vertical' \| 'horizontal'` | `"vertical"` | Bar direction for bar charts. |
| `stacked` | `boolean` | `false` | Stack multiple series on top of each other. |
| `sparkline` | `boolean` | `false` | Minimal mode: hides axes, grid and labels. |
| `showAxis` | `boolean` | `true` | Show the x/y axes. |
| `showGrid` | `boolean` | `true` | Show background grid lines. |
| `showValues` | `boolean` | `false` | Print each data value on the chart. |
| `showLegend` | `boolean` | — | Show the series legend. |
| `legendPosition` | `'top' \| 'right' \| 'bottom'` | `"bottom"` | Where the legend is placed. |
| `valueFormat` | `'number' \| 'compact' \| 'percent' \| 'currency'` | `"number"` | How values are formatted (1200, 1.2K, 12%, $1,200). |
| `currencySymbol` | `string` | `"$"` | Currency symbol used with the 'currency' format. |
| `textColor` | `color` | `"#52514e"` | Color of axis labels and values. |
| `gridColor` | `color` | `"#e6e6e3"` | Color of the grid lines. |
| `xAxisLabel` | `string` | — | Caption below the x-axis. |
| `yAxisLabel` | `string` | — | Caption beside the y-axis. |
| `lineWidth` | `number` (min 0) | `2` | Stroke width for line/area charts in pixels. |
| `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)". |

## Design JSON (this variant)

```json
{
  "title": "Chart sample",
  "description": "A dynamic bar chart",
  "dimensions": {
    "width": 800,
    "height": 420
  },
  "background": {
    "color": "#ffffff"
  },
  "components": [
    {
      "id": "sample-chart",
      "key": "sales",
      "type": "chart",
      "position": {
        "x": 140,
        "y": 60
      },
      "rotation": 0,
      "size": {
        "width": 520,
        "height": 300
      },
      "dynamic": true,
      "properties": {
        "chartType": "bar",
        "data": [
          12,
          28,
          20,
          34,
          26
        ],
        "labels": [
          "Mon",
          "Tue",
          "Wed",
          "Thu",
          "Fri"
        ],
        "colors": [],
        "orientation": "horizontal",
        "showAxis": true,
        "showGrid": true,
        "showValues": false,
        "valueFormat": "number",
        "opacity": 1
      }
    }
  ]
}
```

## Examples

### Survey results with long answers

Poll answers as left-to-right bars — long option names stay readable.

API overrides that reproduce this example:

```json
{
  "sales.orientation": "horizontal",
  "sales.data": [
    45,
    32,
    18,
    5
  ],
  "sales.labels": [
    "Very satisfied",
    "Satisfied",
    "Neutral",
    "Unsatisfied"
  ],
  "sales.colors": [
    "#10B981"
  ],
  "sales.valueFormat": "percent",
  "sales.showValues": true
}
```

### Top-5 sales leaderboard

Ranked rep performance with values printed at the end of each bar.

API overrides that reproduce this example:

```json
{
  "sales.orientation": "horizontal",
  "sales.data": [
    98,
    87,
    76,
    64,
    51
  ],
  "sales.labels": [
    "Ava",
    "Noah",
    "Mia",
    "Leo",
    "Zoe"
  ],
  "sales.colors": [
    "#6366F1"
  ],
  "sales.showValues": true
}
```

## API overrides

Feed fresh numbers via '<key>.data' (or '<key>.series' for multi-series), and swap '<key>.labels' or '<key>.chartType' per render.

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

```json
{
  "sales.chartType": "bar",
  "sales.data": [
    12,
    28,
    20,
    34,
    26
  ],
  "sales.labels": [
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri"
  ],
  "sales.colors": [],
  "sales.orientation": "vertical",
  "sales.showAxis": true,
  "sales.showGrid": true,
  "sales.showValues": false,
  "sales.valueFormat": "number",
  "sales.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 '{
    "sales.chartType": "bar",
    "sales.data": [
        12,
        28,
        20,
        34,
        26
    ],
    "sales.labels": [
        "Mon",
        "Tue",
        "Wed",
        "Thu",
        "Fri"
    ],
    "sales.colors": [],
    "sales.orientation": "vertical",
    "sales.showAxis": true,
    "sales.showGrid": true,
    "sales.showValues": false,
    "sales.valueFormat": "number",
    "sales.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).

## Related

- [Chart component](https://www.imejis.io/components/chart.md) — full reference and FAQs
- [Line](https://www.imejis.io/components/chart/line.md) — A line chart for trends over time.
- [Area](https://www.imejis.io/components/chart/area.md) — A filled area chart — trends with volume emphasis.
- [Stacked series](https://www.imejis.io/components/chart/stacked-series.md) — Two series stacked per category with a legend.
- [Sparkline](https://www.imejis.io/components/chart/sparkline.md) — Axis-free mini line — inline trend indicators and stat tiles.
- [Multi-line](https://www.imejis.io/components/chart/multi-line.md) — Several lines compared on one chart with a legend.
