Chart

Displays a chart.

Frontmatter

blocks:
  - type: chart
    heading: {} # (optional)
      surtitle: '' # string (optional)
      title: '' # string (optional)
      text: '' # markdown (optional)
    chart: {}
      type: '' # [bar, pie, line, polarArea, radar]
      title: '' # string, used as the accessible label
      indexAxis: '' # [x, y] (optional)
      backgroundColor: '' # color (optional)
      borderColor: '' # color (optional)
      items: []
        label: '' # string
        value: '' # number
        color: '' # hexadecimal color (optional)
      data: {} # (optional, alternative to items)
        json: '' # text, a raw Chart.js dataset
    ui: {} # (optional)
      theme: '' # [accent, black, dark, highlight, light, neutral, white] (optional)
      grid: '' # [xsmall, small, medium, large, container, full] (optional)
      offset: '' # [start, center, end] (optional)
      align: '' # [start, center, end] (optional)

Filling items also renders a <table> alternative inside a <details>, which is what the canvas points to through aria-describedby. A chart built from data.json alone has no such fallback.

See Common keys for heading, footing and the full ui reference.

Params

/config/_default/params.yaml

Default series colour, used when an item sets none.

params:
  chart:
    color: '' # color
Demo visual renderer

Files

CMS availability

CMSHugolify Admin v2
CloudCannonAvailable
Decap CMSAvailable
Netlify CMSAvailable
Pages CMSAvailable
Static CMSAvailable
Sveltia CMSAvailable
Tina CMSAvailable