# Change the names of a legend in a chart within a widget

**URL:** <https://community.gladysassistant.com/t/changer-les-noms-dune-legende-dun-graphique-dans-un-widget/11629>\
**Category:** Demande de fonctionnalités\
**Tags:** integration-externe, demande-core\
**Created:** [November 20, 2026, 2:45pm UTC](https://community.gladysassistant.com/t/changer-les-noms-dune-legende-dun-graphique-dans-un-widget/11629 "2026-11-20T14:45:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [November 20, 2026, 2:45pm UTC](https://community.gladysassistant.com/t/changer-les-noms-dune-legende-dun-graphique-dans-un-widget/11629/1 "2026-11-20T14:45:15Z")

</div>

In a widget with a chart, I would like to be able to:

- automatically change the name → have **Room Temp.** instead of **Room Temperature** (which comes from the device’s feature) and **Setpoint** instead of **Temperature** for example, using the names of the 2 default pills if they are the ones providing the values to the chart
- retrieve the room name to have **Living Room Temp.** instead of **Room Temp.** for example
- have the legend translated into the 4 languages currently supported by Gladys if the legend is “modified” automatically
- be able to manually edit the legend names.

 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/original/3X/6/5/65227b4ca39decc3fee570ca304ad7eee52cd69c.jpeg)

I am currently working on this topic.

---

<div class="post-metadata">

**Author:** ![mutmut](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/mutmut/32/14064_2.png) [@mutmut](https://community.gladysassistant.com/u/mutmut)\
**Post date:** [November 20, 2026, 2:57pm UTC](https://community.gladysassistant.com/t/changer-les-noms-dune-legende-dun-graphique-dans-un-widget/11629/2 "2026-11-20T14:57:07Z")

</div>

Here is the PR:

> <https://github.com/GladysAssistant/Gladys/pull/3425>
>
> \### Description
> 
> A widget \`chart\` bound to \`device\_features\` takes its legend fr…om the features' own names. An integration cannot give those curves a better name.
> 
> Requested on the forum (topic linked below), from a heat pump widget: a French user sees "Room temperature" and "Temperature" under the 24 h curve, where "Temp. salon" and "Consigne" would make sense. A feature name cannot fill that role:
> 
> \- it is one string, chosen by the integration in a single language when it publishes the device;
> \- it is shared with the scenes and the history;
> \- every Discovery "Update" overwrites it, and the user cannot edit it.
> 
> A widget, on the other hand, answers \`widget.get\` in the user's language and knows its context, such as the room the unit is in.
> 
> \*\*What changes\*\*
> 
> \- \`chart\` accepts an optional \*\*\`series\_names\`\*\* next to \`device\_features\`.
> - It holds one text per feature, in the same order.
> - Each text is a plain string or a multi-language object, ≤ 24 characters per language value, like an inline series name.
> \- \`normalizeWidgetContent\`:
> - keeps at most one entry per kept feature;
> - turns an entry that is not a valid text into \`null\`;
> - drops the field when no entry is valid or when it is not an array;
> - ignores it on the inline form, whose series carry their own \`name\`.
> \- The device reference resolution carries \`series\_names\` through unchanged.
> \- Front (\`WidgetComponents.jsx\`): each series is named by its entry in the user's language. Without one, it keeps the feature's name, so today's legend is unchanged when the field is absent, shorter, or \`null\` at an index. \`getDeviceFeaturesAggregatesMulti\` returns the features in the requested order, so names and curves stay aligned.
> \- Spec: \`docs/specs/external-integrations/capabilities/dashboard-widgets.md\` updates the component table (section 4), the behavior and its rationale (section 8), and the test list (section 14).
> 
> \*\*Backward compatibility\*\*
> 
> The field is optional and additive:
> 
> \- An integration that sends it to an older core loses nothing: unknown fields are already dropped there.
> \- The SDK's dev-mode check does not flag unknown chart fields, so integrations can send it now.
> \- Adding the field to the SDK's TypeScript types and to its dev-mode check would be a follow-up in \`integration-sdk-js\`.
> 
> \### Related request
> 
> Forum: https://community.gladysassistant.com/t/changer-les-noms-dune-legende-dun-graphique-dans-un-widget/11629
> 
> The topic asks for four things. This PR gives integrations the means for the first three:
> 
> \- short names instead of the feature names, such as "Room temp." and "Setpoint";
> \- the device's room in the name, such as "Living room temp.";
> \- the legend translated into the languages of Gladys, since \`series\_names\` takes multi-language texts.
> 
> The fourth, letting the user edit the legend names by hand, is not part of this PR. An integration can offer it with its own widget settings on top of \`series\_names\`, without another core change.
> 
> \### Tests
> 
> \*\*Server\*\*
> 
> \- \`externalIntegration.normalizeWidgetContent.test.js\` has two new cases:
> - order kept and capped at the number of kept features;
> - invalid entries become \`null\`;
> - 24-character bound with an ellipsis;
> - a shorter array is kept as is;
> - non-array, all-invalid and inline-form cases are dropped.
> \- \`externalIntegration.widgetContent.test.js\`: \`series\_names\` comes out of the content route next to \`device\_feature\_selectors\`.
> \- \`normalizeWidgetContent.js\` is at 100% lines and branches (c8, over the \`external-integration\` tests: 1010 passing).
> \- Full \`npm run coverage\` locally: 10169 passing, 8 failing, all in code this PR does not touch:
> - 7 in \`energy-sensor.getConsumptionByDates\`, which depend on the time zone (Europe/Paris here) and pass with \`TZ=UTC\`;
> - 1 \`EPIPE\` in \`jsonBodyMiddleware\`, a socket error on macOS.
> 
> \*\*Cypress\*\* (\`DashboardExternalWidgetBox.cy.js\`, 7/7 passing)
> 
> \- New case: a device-bound chart with three features and two \`series\_names\`. The legend reads "Living room temp.", "Setpoint", then the third feature's own name.
> \- Run against the front without the change, it fails with the feature names, as expected.
> 
> \*\*Front\*\*: \`eslint\`, \`prettier-check\`, \`compare-translations\` and \`npm run build\` pass.
> 
> \### Checklist
> 
> \- \[x\] If a forum topic or GitHub issue exists, the description links it (\`Forum:\` line above).
> \- \[x\] Tests pass: \`cd server && npm run coverage\` (100% on changed lines; the 8 local failures above are unrelated) and Cypress for the changed UI.
> \- \[x\] Linter and prettier pass on both front and server.
> \- \[x\] No undocumented breaking change: the field is optional and documented in the spec.
> 
> 🤖 Generated with \[Claude Code\](https://claude.com/claude-code)
> 
> 
> 
> 
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Device-bound dashboard charts can now display custom, localized names in their legends. Names correspond to chart series and are shown when available in the selected language.
> \* If a custom name is missing or unavailable, the chart falls back to the device feature name, configured device name, or series number. Inline-series charts are unchanged.
