Charts · Gutenberg

Bar Chart block for WordPress

Vertical or horizontal bar chart with multiple datasets using Chart.js (CDN). Supports stacked, border radius, and custom colors.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Vertical or horizontal bar chart with multiple datasets using Chart.js (CDN). Supports stacked, border radius, and custom colors.

Inspector panels on this block: Chart Title, Labels & Data, Chart Options, Background. Those titles come from index.js, not from a shared template.

Behavior controls: “Data (CSV)” (e.g. 10,20,35,18); “Orientation” options: Vertical, Horizontal; “Legend Position” options: Top, Bottom, Left, Right.

Where to find it

Gutenberg inserter → Charts → search “Bar Chart” (block name `blockenberg/bar-chart` in block.json). Style it in the sidebar after insert.

How to use Bar Chart block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Bar Chart”, insert it. Category: Charts.
  3. Configure inspector controls that exist on this block. Open Chart Title. Set “Label”, “Data (CSV)”, “Title (optional)”, “Category Labels (CSV)”.
  4. Check the published page. The view script reads HTML data attributes: data-bar-radius, data-datasets, data-grid, data-height, data-labels, data-legend, data-legend-pos, data-orientation. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
LabelText field in the inspector.
Data (CSV)Text field in the inspector. e.g. 10,20,35,18.
Title (optional)Text field in the inspector. Saved as `title`.
Category Labels (CSV)Text field in the inspector. block.json default: Q1,Q2,Q3,Q4. Saved as `labels`.
OrientationSelect control; the chosen value is saved on the block. Options: Vertical; Horizontal. block.json default: vertical. Saved as `orientation`.
StackedOn/off toggle in the inspector. Off by default. Saved as `stacked`.
Bar Border RadiusNumeric range control in the inspector. Range 0–20. block.json default: 6. Saved as `barRadius`.
Height (px)Numeric range control in the inspector. Range 160–700. block.json default: 340. Saved as `height`.
Show GridOn/off toggle in the inspector. On by default. Saved as `showGrid`.
Show LegendOn/off toggle in the inspector. On by default. Saved as `showLegend`.
Legend PositionSelect control; the chosen value is saved on the block. Options: Top; Bottom; Left; Right. block.json default: top. Saved as `legendPos`.
Card Border Radius (px)Numeric range control in the inspector. Range 0–32. block.json default: 12. Saved as `borderRadius`.
Card BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `bgColor`.
Typography — TitleShared Blockenberg typography popover (family, size, weight, spacing). Saved as `titleTypo`.
Legend Font Size (px)Numeric range control in the inspector. Range 8–20. block.json default: 12. Saved as `legendFontSize`.
Axis Label Font Size (px)Numeric range control in the inspector. Range 8–18. block.json default: 11. Saved as `axisLabelFontSize`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Bar Chart block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Bar Chart”. It sits under Charts. After insert, open Chart Title and set “Label”, “Data (CSV)”, “Title (optional)”, “Category Labels (CSV)”.

Does Bar Chart need a server or extra plugin?

No. After Blockenberg is active, the view script runs in the browser with the values you saved on the block.

Is the Bar Chart Gutenberg block free?

Yes. Bar Chart ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Bar Chart to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Chart Title, Labels & Data, Chart Options, Background).

Related charts blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Bar Chart from the Gutenberg inserter.

Get Blockenberg