Charts · Gutenberg
Metric Comparison block for WordPress
Before/after KPI comparison cards with change arrows and color-coded indicators.
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.
What it actually does
Before/after KPI comparison cards with change arrows and color-coded indicators.
Inspector panels on this block: Settings, Card Style, Metrics. Those titles come from index.js, not from a shared template.
Behavior controls: “Format” options: Number, Currency, Percent.
Metric Comparison has no render.php and no frontend.js. The saved Gutenberg HTML is what visitors see, plus Blockenberg layout/typography CSS.
Where to find it
Gutenberg inserter → Charts → search “Metric Comparison” (block name `blockenberg/metric-comparison` in block.json). Style it in the sidebar after insert.
How to use Metric Comparison block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Metric Comparison”, insert it. Category: Charts.
- Configure inspector controls that exist on this block. Open Settings. Set “Settings — Title”, “Show Title”, “Before Label”, “After Label”.
- Publish. Save the page. Output is the saved block HTML; typography/colors follow Blockenberg shared panels.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Settings — Title | Text field in the inspector. block.json default: Q3 vs Q4 Performance. Saved as `title`. |
| Show Title | On/off toggle in the inspector. On by default. Saved as `showTitle`. |
| Before Label | Text field in the inspector. block.json default: Q3. Saved as `beforeLabel`. |
| After Label | Text field in the inspector. block.json default: Q4. Saved as `afterLabel`. |
| Columns | Numeric range control in the inspector. Range 1–6. block.json default: 3. Saved as `columns`. |
| Show Change | On/off toggle in the inspector. On by default. Saved as `showChange`. |
| Show Arrows | On/off toggle in the inspector. On by default. Saved as `showArrows`. |
| Show Bar | On/off toggle in the inspector. On by default. Saved as `showBar`. |
| Border Radius | Numeric range control in the inspector. Range 0–30. block.json default: 12. Saved as `borderRadius`. |
| Card Style — Padding | Numeric range control in the inspector. Range 8–48. block.json default: 20. Saved as `cardPadding`. |
| Wrapper BG | Color control in the inspector. block.json default: #ffffff. Saved as `bgColor`. |
| Card BG | Color control in the inspector. block.json default: #f9fafb. Saved as `cardBg`. |
| Positive | Color control in the inspector. block.json default: #10b981. Saved as `posColor`. |
| Negative | Color control in the inspector. block.json default: #ef4444. Saved as `negColor`. |
| Neutral | Color control in the inspector. block.json default: #6b7280. Saved as `neutralColor`. |
| Colors — Title | Color control in the inspector. block.json default: #111827. Saved as `titleColor`. |
| Value Text | Color control in the inspector. block.json default: #111827. Saved as `textColor`. |
| Labels | Color control in the inspector. block.json default: #6b7280. Saved as `labelColor`. |
| Label | Text field in the inspector. |
| Unit | Text field in the inspector. |
| Format | Select control; the chosen value is saved on the block. Options: Number; Currency; Percent. |
| Higher is better | On/off toggle in the inspector. |
When this is the right block
- Before/after KPI comparison cards with change arrows and color-coded indicators — that is the job of Metric Comparison, not a generic content block.
- Use it when you need the editor control labeled “Settings — Title”, which exists on this block’s inspector.
- Inserter grouping: reports, dashboards, and data-heavy pages.
Notes from the implementation
Static block: markup is saved in post content; no PHP render callback in this folder.
FAQ
How do I add the Metric Comparison block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Metric Comparison”. It sits under Charts. After insert, open Settings and set “Settings — Title”, “Show Title”, “Before Label”, “After Label”.
What makes Metric Comparison different from other Blockenberg blocks?
Before/after KPI comparison cards with change arrows and color-coded indicators. Inspector labels on this block include “Settings — Title”, “Show Title”, “Before Label”, “After Label”.
Is the Metric Comparison Gutenberg block free?
Yes. Metric Comparison ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Metric Comparison 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: Settings, Card Style, Metrics).
Related charts blocks
Area Chart
Smooth filled area chart with multiple datasets, gradient fills, and animation using Chart.js (CDN). Great for showing trends over time.
Bar Chart
Vertical or horizontal bar chart with multiple datasets using Chart.js (CDN). Supports stacked, border radius, and custom colors.
Box Plot
Box-and-whisker statistical chart showing min, Q1, median, Q3, max, mean, and outliers for multiple data series.
Bubble Chart
Interactive bubble chart powered by Chart.js.
Bullet Chart
Stephen Few's bullet chart — shows actual performance against a target, with background bands for Poor / Satisfactory / Good ranges.
Bump Chart
Ranking chart that shows how positions change over time — each series is a curved line with rank labels at each column.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Metric Comparison from the Gutenberg inserter.