apyhub
SMART GENERATION

Generate Stacked Graph API

Hosted on ApyHub

What it does

Stacked Bar Chart Generator creates stacked bar chart images from structured chart data. Send a title, a data array, and optional styling options, and get back either a pre-signed chart URL or a binary image depending on the endpoint you use.

Each data item includes a name and an array of values. Each value can include a label, numeric value, and optional 6-character hex color. You can also set the chart theme to light or dark, and adjust canvas size, axis font settings, spacing, bar width, title styling, canvas color, and background padding through the options object.

Use it when you need to render quarterly revenue breakdowns, compare category totals, or generate dashboard graphics from application data. The structure is simple enough to build charts from analytics output, reporting pipelines, or admin tools without assembling the image yourself.

Stacked Bar Chart Generator is useful when your app needs consistent chart output with controlled layout and colors. The /link endpoint returns a pre-signed URL in data, while /download returns the image directly as binary.

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

Quickstart

Generate a stacked bar chart from a minimal JSON payload with a title and one data series.

curl -X POST "http://localhost:8080/apyhub/generate-stacked-bar-chart/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Quarterly Revenue and Cost",
    "data": [
      {
        "name": "Q1",
        "values": [
          {
            "label": "Revenue",
            "value": 100000
          },
          {
            "label": "Cost",
            "value": 62000
          }
        ]
      }
    ]
  }'

What you'll get back

Returns a binary file response (string with format: binary), typically the generated chart image itself.

TRY ITLIVE · 60 ATOMS
Loading playground…

About this endpoint

What it does

Generates a stacked bar chart image from the chart data you provide in the request body and returns the image as binary content.

Request Body

ParameterTypeMandatoryDescription
titleStringYesChart title. Must be at least 1 character long.
dataObject ArrayYesStacked bar groups to render. Each item must include name and values.
data[].nameStringYesLabel for the bar group.
data[].widthIntegerNoBar width in pixels. Must be at least 1.
data[].valuesObject ArrayYesStacked segments for the bar group. Must contain at least 1 item.
data[].values[].colorStringNoSegment color as a 6-character hex value without the leading #.
data[].values[].labelStringYesLabel for the stacked segment.
data[].values[].valueNumberYesNumeric value for the stacked segment.
themeENUMNoChart theme. Allowed values: light, dark. Default: light.
optionsObjectNoOptional chart styling and layout settings.
options.widthIntegerNoChart width in pixels. Must be at least 1.
options.heightIntegerNoChart height in pixels. Must be at least 1.
options.x_axisObjectNoX-axis styling.
options.x_axis.font_sizeNumberNoFont size in pixels. Must be at least 1.
options.x_axis.font_colorStringNoX-axis font color as a 6-character hex value without the leading #.
options.y_axisObjectNoY-axis styling.
options.y_axis.font_sizeNumberNoFont size in pixels. Must be at least 1.
options.y_axis.font_colorStringNoY-axis font color as a 6-character hex value without the leading #.
options.spacingIntegerNoSpace between bars in pixels. Must be at least 0.
options.bar_widthIntegerNoDefault bar width in pixels. Must be at least 1.
options.title_styleObjectNoTitle styling.
options.title_style.paddingIntegerNoPadding in pixels. Must be at least 0.
options.title_style.font_sizeNumberNoTitle font size in pixels. Must be at least 1.
options.title_style.font_colorStringNoTitle font color as a 6-character hex value without the leading #.
options.canvas_colorStringNoCanvas background color as a 6-character hex value without the leading #.
options.background_paddingIntegerNoPadding around the chart background in pixels. Must be at least 0.

Response

Returns the generated chart as binary content. The output schema is a binary string, so the success response is the image file itself rather than a JSON object.

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.