apyhub
IMAGE PROCESSING · SMART GENERATION

Bar Chart Generator

Hosted on ApyHub

What it does

Bar Chart Generator creates a bar chart image from your data and returns it as either a pre-signed image URL or a binary download, depending on the endpoint you use.

Send a title and a data array of bar objects. Each bar can include a label, value, and optional color as a 6-character hex value without #. You can also set theme to light or dark, and fine-tune the chart with options such as width, height, axis font sizes and colors, spacing, bar width, background padding and color, title styling, and canvas color.

Use it when you need charts for dashboards, reports, email exports, admin panels, or generated documents. The same input structure works whether you want a shareable chart link from /link or a direct image file from /download.

Bar Chart Generator is a fit for applications that need consistent, programmatic chart rendering without building chart logic in the client.

▣ ENDPOINT 02 / 02
POST
Generate bar chart image
https://api.eu.apyverse.com/deepak/generate-bar-chart/download

QUICKSTART

GUIDE

Quickstart

Generate a bar chart image from a minimal set of bar data and save it using the output query parameter.

curl -X POST "https://api.eu.apyverse.com/deepak/generate-bar-chart/download?output=quarterly-sales-bar-chart" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Quarterly Sales by Region",
    "data": [
      { "color": "3B82F6", "label": "North America", "value": 42000 },
      { "color": "10B981", "label": "Europe", "value": 37500 },
      { "color": "F59E0B", "label": "Asia Pacific", "value": 28900 }
    ]
  }'

What you'll get back

Returns a binary file (string with format: "binary"), not a JSON object.

TRY ITLIVE · 10 ATOMS
Loading playground…

About this endpoint

What it does

Generates a bar chart image from the chart configuration you send in the request body, then returns the rendered image as binary data.

Request Body

ParameterTypeMandatoryDescription
titleStringYesChart title. Minimum length: 1.
dataObject ArrayYesCanonical list of bar values. Must contain at least 1 item.
data[].colorStringNoBar color as a 6-character hex value without the leading # symbol.
data[].labelStringYesBar label.
data[].valueNumberYesBar value.
barsObject ArrayNoAlias for data. Deprecated. Use either data or bars, not both.
bars[].colorStringNoBar color as a 6-character hex value without the leading # symbol.
bars[].labelStringYesBar label.
bars[].valueNumberYesBar value.
themeENUMNoChart theme. Allowed values: light, dark. Default: light.
optionsObjectNoChart styling and layout options.
options.widthIntegerNoChart width in pixels. Minimum: 1.
options.heightIntegerNoChart height in pixels. Minimum: 1.
options.x_axisObjectNoX-axis styling options.
options.x_axis.font_sizeNumberNoFont size in pixels. Minimum: 1.
options.x_axis.font_colorStringNoX-axis font color as a 6-character hex value without the leading # symbol.
options.y_axisObjectNoY-axis styling options.
options.y_axis.font_sizeNumberNoFont size in pixels. Minimum: 1.
options.y_axis.font_colorStringNoY-axis font color as a 6-character hex value without the leading # symbol.
options.spacingIntegerNoSpacing in pixels. Minimum: 0.
options.bar_widthIntegerNoBar width in pixels. Minimum: 1.
options.backgroundObjectNoBackground styling options.
options.background.colorStringNoBackground color as a 6-character hex value without the leading # symbol.
options.background.paddingIntegerNoPadding in pixels. Minimum: 0.
options.title_styleObjectNoTitle styling options.
options.title_style.paddingIntegerNoPadding in pixels. Minimum: 0.
options.title_style.font_sizeNumberNoFont size in pixels. Minimum: 1.
options.title_style.font_colorStringNoTitle font color as a 6-character hex value without the leading # symbol.
options.canvas_colorStringNoCanvas color as a 6-character hex value without the leading # symbol.

Response

Returns a binary response containing the generated chart image. The success response is a single binary payload, not a JSON object.

AttributeTypeMandatoryDescription
binaryBinaryYesRendered bar chart image.

Notes

The request body supports both data and the deprecated bars alias for the bar list, but the schema indicates data is the canonical field. Use data for new integrations, and note that data must contain at least one item.

Query parameters

Name
Type
Description
outputOPTIONAL
string

Body

Name
Type
Description
bodyREQUIRED
object
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.