Chart Units
Chart Units let you label a chart's axes with consistent unit names: USD, Tonnes, Visitors, Percent, and so on. The unit you pick appears alongside (or as) the axis title on the rendered chart, so readers immediately know what the numbers mean.
Units are stored as a standard WordPress taxonomy named Chart Units, attached to the Charts post type. The taxonomy is hierarchical: parent terms are groups (Money, Time, Length, …) and child terms are the units the user can actually pick (USD, Seconds, Meter, …). The plugin ships with a set of common groups and units out of the box, and you can add your own at any time.
Default groups
M Chart creates these groups when the plugin is activated. It creates them again when the chart edit screen opens and no unit has a group yet:
| Group | Units |
|---|---|
| Time | Seconds, Minutes, Hours, Days, Weeks, Months, Quarter, Years, Decades, Centuries |
| Money | USD, EUR, GBP, JPY, CNY |
| Length | Inch, Foot, Yard, Mile, Millimeter, Centimeter, Meter, Kilometer |
| Weight | Tonnes, Tons, Kilograms, Grams, Milligrams, Pounds, Ounces |
| Other | Percent |
| Website/Traffic | Visitors, Unique Visitors, Clicks, Referrers, Active Users, Pages |
| Sales | Units, CPM |
You don't have to use any of these. They are starting points. You can rename or delete them from the admin like any other WordPress term. Reactivating the plugin recreates any default group or unit that is missing, matched by name. A deleted default comes back. A renamed one gets a fresh copy under the original name.
If a chart export has unit slugs but no term definitions, the importer creates each unit as a top-level term with no group. When the plugin is next activated, or the chart edit screen opens while no unit has a group, M Chart creates the default groups. It then moves default units into them by exact name and leaves other units where they are.
Adding new units
- In the WordPress admin, open Charts → Chart Units.
- To add a unit: fill in the
Namefield, pick the parent group from theParent Chart Unitdropdown, and clickAdd New Chart Unit. The slug can be left blank — WordPress derives it from the name. - To add a new group: fill in the
Namefield, leaveParent Chart Unitset toNone, and clickAdd New Chart Unit. A top-level term with no parent becomes a new group that other units can be nested under.
A top-level term with nothing nested under it is listed in the Units dropdown under Other. This lets you pick a unit created without a group, or one added by an import. It turns into a group as soon as a unit is added beneath it. Within each group the units are listed alphabetically.
Group order
Groups appear in the chart Units dropdown alphabetically. Name them with that in mind if ordering matters.
Applying units to a chart
The unit pickers live in the Chart meta box on the chart edit screen, in the same row as each axis title field:
- Open a chart for editing.
- Find the
Vertical axis titleandHorizontal axis titlerows in the chart settings panel. - Each row has a
Unitsdropdown next to the title field. Pick the unit that matches the axis's values.
The dropdown lists the units under their group name. Only units can be picked. The group names are labels, not choices. Choose N/A to clear the unit.
When the chart renders:
- If you also filled in the axis title, the unit appears in parentheses after it: a chart with
Vertical axis title=YieldandUnits=Tonnes/hectarerenders the y-axis label as Yield (Tonnes/hectare). - If the axis title is blank, the unit name is the axis label.
Listing charts by unit
Each unit has a public archive page at /m-chart-units/<slug>/ that lists every published chart using that unit. For example, https://example.com/m-chart-units/usd/ shows all charts measured in US dollars. Developers can query charts by unit in code. See Chart Units Taxonomy in the developer docs.
Limits and gotchas
- Units only apply to chart types that have axes — bar, column, line, area, scatter, bubble, treemap (no axes; dropdown hidden), boxplot, violin, etc. On pie, doughnut, radar, radar area, and polar charts there are no x/y axes, so the
Unitsrow doesn't appear in the chart settings. - Custom units survive plugin updates — they're standard WordPress terms stored in your site's database.
- The unit name shown on the chart is whatever you type into the term's
Name. If you need different display text for one chart, the cleanest workaround is to leave Units set toN/Aand put the unit text directly into the axis title field. - Treemap renders the rectangles' value prefix/suffix from each row's data cell (e.g.,
$4500,2200kg), not from this taxonomy. The Units dropdown isn't shown for treemap charts.