Ask
Support a description on a plot, so a chart can carry explanatory text alongside its title and subtitle.
Current state
Plots support title and subtitle, but not description.
crates/settings/src/chart.rs:12-24
const ALLOWED_PLOT_KEYS: [&str; 11] = [
"inset", "margin", "margin-bottom", "margin-left", "margin-right",
"margin-top", "marks", "subtitle", "title", "x", "y",
];
title / subtitle are parsed at chart.rs:372-373 (optional_string(plot_yaml, …)) and carried on PlotCfg (crates/settings/src/plot_source.rs:10-12). A description: key on a plot is silently dropped by sanitize_hash_with_keys(plot_hash, &ALLOWED_PLOT_KEYS) (chart.rs:215).
Note that metrics already have exactly this — ALLOWED_METRIC_KEYS includes "description" (chart.rs:51-58), parsed at chart.rs:861. So there is an established pattern to follow, and the inconsistency between metrics and plots is itself a small wart.
Suggested change
Mirror the metric handling for plots:
- Add
"description" to ALLOWED_PLOT_KEYS.
let description = optional_string(plot_yaml, "description"); alongside the existing title/subtitle reads, and pass it into the PlotCfg construction (chart.rs:~835).
- Add
pub description: Option<String> to PlotCfg with the same #[serde(skip_serializing_if = "Option::is_none")] treatment as title/subtitle.
- Extend the existing round-trip test (
chart.rs:~1780-1838) to assert a plot description parses and that unknown keys are still dropped.
- Surface it wherever
title/subtitle are rendered in the chart UI.
Context
Split out of #446 ("Add titles for axes in charts"), which is closed as delivered — axis labels, plot titles and subtitles all parse with round-trip test coverage. In that thread @Siddharth2207 additionally asked for "title, subtitle, description"; description is the one part of that request that was never implemented, so it is tracked here rather than lost in a closed issue.
Ask
Support a
descriptionon a plot, so a chart can carry explanatory text alongside its title and subtitle.Current state
Plots support
titleandsubtitle, but notdescription.crates/settings/src/chart.rs:12-24title/subtitleare parsed atchart.rs:372-373(optional_string(plot_yaml, …)) and carried onPlotCfg(crates/settings/src/plot_source.rs:10-12). Adescription:key on a plot is silently dropped bysanitize_hash_with_keys(plot_hash, &ALLOWED_PLOT_KEYS)(chart.rs:215).Note that metrics already have exactly this —
ALLOWED_METRIC_KEYSincludes"description"(chart.rs:51-58), parsed atchart.rs:861. So there is an established pattern to follow, and the inconsistency between metrics and plots is itself a small wart.Suggested change
Mirror the metric handling for plots:
"description"toALLOWED_PLOT_KEYS.let description = optional_string(plot_yaml, "description");alongside the existing title/subtitle reads, and pass it into thePlotCfgconstruction (chart.rs:~835).pub description: Option<String>toPlotCfgwith the same#[serde(skip_serializing_if = "Option::is_none")]treatment astitle/subtitle.chart.rs:~1780-1838) to assert a plotdescriptionparses and that unknown keys are still dropped.title/subtitleare rendered in the chart UI.Context
Split out of #446 ("Add titles for axes in charts"), which is closed as delivered — axis labels, plot titles and subtitles all parse with round-trip test coverage. In that thread @Siddharth2207 additionally asked for "title, subtitle, description";
descriptionis the one part of that request that was never implemented, so it is tracked here rather than lost in a closed issue.