apyhub

Generate Bar Graph API

Hosted on ApyHub

What it does

Bar Chart Generator creates bar chart images and shareable chart links from a title and a list of bar values. Send a title, data array, and optional theme or options; get back either a binary image from /download or a pre-signed image URL from /link.

Each bar item can include a label, value, and optional color hex code. The options object lets you control the chart size, spacing, bar width, axis font size and color, background padding and color, title styling, and canvas color. Use theme to switch between light and dark output.

This is a fit when you need charts for dashboards, reports, internal admin pages, or generated documents without rendering them in the browser. For example, you can turn quarterly sales by region, usage totals, or category counts into a consistent bar chart image for email, PDF, or a web app preview.

Bar Chart Generator keeps the payload simple and the output predictable: a chart image file or a URL pointing to the generated image.

▣ ENDPOINT 01 / 02
POST
Generate bar chart image
http://localhost:8080/apyhub/generate-bar-graph/download
QUICKSTARTGUIDE

Quickstart

Generate a bar chart image from a minimal JSON payload.

curl -X POST "http://localhost:8080/apyhub/generate-bar-graph/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Quarterly Sales by Region",
    "data": [
      { "label": "North America", "value": 42000 }
    ]
  }'

What you'll get back

Returns a binary file response which is the generated bar graph image.

TRY ITLIVE · 60 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
bars
Alias for data. Use either data or bars, not both.
data*
Canonical list of bar values.
data-1*
6-character hex color without the leading # symbol.
Chart theme.
options
Chart width in pixels.
Chart height in pixels.
x_axis
Font size in pixels.
6-character hex color without the leading # symbol.
y_axis
Font size in pixels.
6-character hex color without the leading # symbol.
Spacing in pixels.
Bar width in pixels.
background
6-character hex color without the leading # symbol.
Padding in pixels.
title_style
Padding in pixels.
Font size in pixels.
6-character hex color without the leading # symbol.
6-character hex color without the leading # symbol.

About this endpoint

What it does

Generates a bar chart image from the chart configuration in the request body and returns the image as binary data.

Request Body

ParameterTypeMandatoryDescription
dataObject ArrayYesCanonical list of bar values. Each item supports label and value, and may include color. Requires at least 1 item.
data[].colorStringNo6-character hex color without the leading # symbol.
data[].labelStringYesBar label.
data[].valueNumberYesBar value.
barsObject ArrayNoAlias for data. Deprecated. Use either data or bars, not both. Each item supports label and value, and may include color.
bars[].colorStringNo6-character hex color without the leading # symbol.
bars[].labelStringYesBar label.
bars[].valueNumberYesBar value.
themeENUMNoChart theme. Allowed values: light, dark. Default: light.
titleStringYesChart title. Must be at least 1 character.
optionsObjectNoChart layout and styling 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_colorStringNo6-character hex color without the leading # symbol.
options.y_axisObjectNoY-axis styling options.
options.y_axis.font_sizeNumberNoFont size in pixels. Minimum: 1.
options.y_axis.font_colorStringNo6-character hex color without the leading # symbol.
options.spacingIntegerNoSpacing in pixels. Minimum: 0.
options.bar_widthIntegerNoBar width in pixels. Minimum: 1.
options.backgroundObjectNoBackground styling options.
options.background.colorStringNo6-character hex color 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_colorStringNo6-character hex color without the leading # symbol.
options.canvas_colorStringNo6-character hex color without the leading # symbol.

Response

Returns a binary response body containing the generated chart image.

Notes

bars is a deprecated alias for data. Use one or the other, not both.

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.