Chartjs Bar

Category: Charts

Live preview
No numbers to draw as bars.

Draws a static, accessible bar chart as HTML (no script, no chart library) from labels and datasets, in grouped, stacked, relative or overlaid bars, vertical or horizontal, negative values, a linear or log value axis, d3 number formats, optional value labels and a legend. Series differ by fill pattern as well as colour, and a hidden table holds every value.

Surfaces
webgoogle-apps-script-webmcp-appsandroid
Degraded on
SurfaceNote
google-meet-stageBars are positioned HTML with container queries; a stage iframe that drops them shows the hidden table only.
google-chatHTML is not rendered; only the text of the hidden table is shown.
emailStyle blocks, container queries and absolute positioning are stripped by most clients; the table is what survives.
Fields
FieldTypeRequired
labelsarray of strings. Category labels (up to 40 drawn; the hidden table lists all).required
datasetsarray of {label, data, color}. One series each (up to 8 drawn); data is numbers, anything else is skipped with a note; color is an optionaloptional
modegroup (default) | stack | relative | overlay. stack adds the signed values; relative stacks positives up and negatives down separately; overlay draws every series on the baseline.required
orientationv (default) | h.required
show_valuesboolean. Value labels on the bars; they hide when the chart is too narrow to fit them (the table keeps every value).required
value_formatd3-format string for the value labels, for example ',.0f' or '.1%'. Types b c o p r x X are not supported.required
y_formatd3-format string for the axis labels (and the value labels when value_format is absent).required
y_scalelinear (default) | log. A log axis ticks at powers of ten, leaves out numbers that are not above zero (with a note) and cannot stack.required
y_rangearray of two numbers, min then max. Fixes the value axis; bars past it are cut at the axis with a note.required
y_ticksinteger 2 to 12 (default 5). Target tick count.required
y_reverseboolean. Reverse the value axis.required
gapnumber 0 to 0.8 (default 0.3). Share of each category slot left empty.required
legend_positiontop | bottom | right | none. Default top with more than one series, none otherwise.required
versioninteger (optional, default 1). Only version 1 exists; a higher whole number is drawn as version 1 with a note.optional
Example payload
{
  "type": "chartjs_bar",
  "labels": [
    "Category A",
    "Category B",
    "Category C",
    "Category D"
  ],
  "show_values": true,
  "value_format": "Value format",
  "y_format": "Y format",
  "y_range": 75,
  "y_reverse": true
}
ARD catalog entry
{
  "identifier": "urn:air:a2uicatalog.ai:atom:chartjs_bar",
  "displayName": "Chartjs Bar",
  "type": "application/vnd.a2ui.atom+json",
  "url": "https://a2uicatalog.ai/atoms/chartjs_bar/",
  "capabilities": [
    "web",
    "google-apps-script-web",
    "mcp-apps",
    "android"
  ],
  "description": "Draws a static, accessible bar chart as HTML (no script, no chart library) from labels and datasets, in grouped, stacked, relative or overlaid bars, vertical or horizontal, negative values, a linear or log value axis, d3 number formats, optional value labels and a legend. Series differ by fill pattern as well as colour, and a hidden table holds every value.",
  "representativeQueries": [
    "show a static accessible bar chart (group, stack, relative, overlay; vertical or horizontal; log axis)",
    "draws a static, accessible bar chart as html (no script, no chart library) from labels and datasets,",
    "render a chartjs bar"
  ]
}
← Full ARD catalog
Deploy your own Google Apps Script renderer

The renderer is an open-source Google Apps Script web app. Deploy your own instance in 4 commands — you own the URL, no dependency on the demo endpoint.

git clone https://github.com/a2uicatalog/a2ui
cd a2ui/apps-script-surface/gas-wired-renderer
clasp push && clasp deploy
Full deploy guide →