Generate chart
generate_chartRender displacement metrics for one or more countries as Chart.js, Vega-Lite, Mermaid, or SVG chart specs. Supports normalization and changepoint markers.
Instructions
Render a displacement metric for one or more countries as a chart specification. Formats: "chartjs" (Chart.js v4 config JSON), "vega-lite" (v5 spec), "mermaid" (xychart block), "svg" (standalone image markup). Set normalize_by to plot per 1,000 residents or per US$1bn GDP. show_changepoints=true marks detected structural breaks (svg, vega-lite; Chart.js via chartjs-plugin-annotation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Chart type (default line) | |
| role | No | "asylum" = people hosted IN the country; "origin" = people displaced FROM the country | |
| format | Yes | Output format | |
| locale | No | Language of the human-readable text output: "en" (default) or "ar" (Modern Standard Arabic, right-to-left). Structured JSON fields, ISO3 codes and dataset ids stay in English either way. | |
| metric | No | Metric to plot (default refugees) | |
| year_to | No | Last year of the range (default: latest available) | |
| countries | Yes | Countries to plot | |
| year_from | No | First year of the range (default: 10 years back) | |
| normalize_by | No | Normalize values by a denominator: "population" → per 1,000 residents, "gdp" → per US$1bn GDP. Requires the worldbank provider. | |
| show_changepoints | No | Mark detected changepoints (structural breaks) per series. Default false. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | ||
| unit | Yes | ||
| title | Yes | ||
| format | Yes |