Chart years and axis bounds
Year and Y-axis settings can be placed in chartpack defaults, a section or a chart.
Limit one chart
- chart:
title: Near-term real GDP
start_year: 2025
end_year: 2035
y_axis:
min: -5
max: 10
series:
- variable: GDPR(USA)
end_year must not precede start_year; both are four-digit integers. For time-series charts, the range may extend beyond the observations in the CSV. Missing years are shown as gaps, not zeroes or estimated values. Omitted bounds normally use the first and last available years. Delta charts instead require two specified endpoints with observations at both years. Compositions require complete observations throughout their displayed range. Numeric axis bounds must be finite, with max no lower than min.
Override one inherited bound
- section:
start_year: 2025
end_year: 2050
y_axis:
min: -10
max: 10
- chart:
y_axis:
max: 25
series:
- variable: GDPR(USA)
This chart keeps the section’s min: -10 and uses its own max: 25. Omit an automatic bound; do not set it to null.
Ordinary line-chart years follow chart, section and chartpack inheritance. Series-delta charts also permit start_year and end_year on an individual series, where they override the inherited endpoints for that bar.
Write your own axis titles
With version: "1.4.0", put label inside x_axis or y_axis. Use everyday words that explain what the reader is seeing:
- chart:
title: Inflation in 2030
chart_type: series-value
year: 2030
x_axis:
label: Inflation rate (%)
y_axis:
label: Region
series:
- variable: INFL(USA)
- variable: INFL(CHN)
These labels replace the automatically inferred axis titles. x_axis.label belongs on the chart. y_axis.label can also be set in chartpack defaults or a section; a chart’s own label wins. Labels work on numeric and category axes. For example, a horizontal bar chart has numeric X values and region names on Y.
Bound the numeric X axis
In a 1.4 chartpack, x_axis.min and x_axis.max can limit values on horizontal bars or paired-scatter charts. Put bounds on y_axis for vertical bars, lines, small multiples, compositions, waterfalls and the scatter Y value. Bounds on a category axis do not change the plot. Heatmaps have category axes on both sides; use color_axis for their value scale instead.
The selected year on single-year charts is a chart field, not an inherited start_year or end_year. See Year controls for the types that let report readers change it.
A single-year chart’s year is independent of the inherited year window. The window limits the other years offered by its Year control, while a valid initial year remains available even outside that window. For a scatter trajectory, the window selects the annual pairs shown across time.
Explicit numeric bounds on category axes cause warnings and do not change the chart. Inherited Y-axis bounds are silently ignored by horizontal bars and heatmaps, so shared defaults can still serve line charts in the same pack.
G-Cubed