Defaults, sections and inheritance
Defaults let related charts share settings without repeating them. A chart uses its own setting first, then its section’s setting, then the chartpack default. If none is supplied, the template chooses an automatic value where that is allowed. Delta charts always need two specified endpoint years.
| Where to put a setting | Settings that can be shared |
|---|---|
chartpack.defaults | start_year, end_year, y_axis bounds and, in 1.4, its label |
section | The same settings, plus a chart title and a complete series list |
Individual chart | Chart type, caption, selected year, X axis, controls and other type-specific options |
A section’s label is its report heading; it is not a chart default. Chart types and report controls cannot be inherited.
Chartpack-wide years
- chartpack:
format: gcubed-chartpack
version: 1
title: Policy experiment
defaults:
start_year: 2025
end_year: 2040
- chart:
series:
- variable: INFL(USA)
Group charts in a section
- section:
label: Macroeconomic outcomes
start_year: 2025
end_year: 2050
y_axis:
min: -5
max: 10
- chart:
title: Inflation
series:
- variable: INFL(USA)
- chart:
title: Real GDP
y_axis:
max: 15
series:
- variable: GDPR(USA)
The second chart inherits min: -5 and replaces only max. A section lasts until the next section or the end of the document. Each new section replaces the previous section completely; omitted settings fall back to chartpack defaults, not to the previous section.
label is the visible section heading. The separate title property, when used on a section, is inherited as the title of each chart in that section.
Add a table of contents
Set table_of_contents: true in the chartpack metadata and give each visible section a label. This needs version "1.1.0" or later:
- chartpack:
format: gcubed-chartpack
version: "1.1.0"
title: Policy experiment
table_of_contents: true
- section:
label: Macroeconomic outcomes
- chart:
title: Inflation
series:
- variable: INFL(USA)
- section:
label: Sector outcomes
- chart:
title: Sector output
series:
- variable_prefix: OUP
selectors:
regions: [USA]
sectors: all
The updated template places the table of contents above the charts. It links named sections and the charts they contain. Unlabelled sections still provide defaults but do not create a heading or table-of-contents entry. Charts before the first named section are not grouped into the table of contents.
Inherit a complete series list
- section:
series:
- variable: INFL(USA)
- chart: {}
A chart’s own series replaces an inherited sequence; series are never concatenated. A section does not need a following chart: standalone, consecutive and final sections are permitted. The renderer keeps an empty section in the report and warns that it contains no charts.
G-Cubed