Page MenuHomePhabricator

Add support for chart titles
Closed, ResolvedPublic

Description

User Story

As a Wikipedia editor, I want to be able to define a translatable title for charts so that readers have context for the chart they are viewing in their local wiki language.

Design

The styling of chart titles, including subtext, is defined in T375235.

From T375235

  • Title text should be font size 16
  • Title text color should be #101418 in light mode, #F8F9FA in dark mode (color-emphasized)
  • Font weights can remain the defaults
Acceptance Criteria
  • It's possible to define a .chart file that accept a new parameter title for all chart types (line, area, bar, pie) with a map of language codes to title names (e.g. { "title": { "en": "Energy Sources of Canada" } }.
  • Charts do not automatically pull the title from the tabular data description.
  • Charts with a title defined render the title of the chart on preview in the appropriate language of the wiki if available.
  • Charts with a title defined can be embedded in an article to render a chart with the title in the appropriate language of the wiki if available.
  • Chart titles wrap across multiple lines if they are too long to fit inside the preset dimensions.
  • The chart title on the SVG returned by the chart render service is readable in full e.g. when JavaScript is disabled

Event Timeline

CCiufo-WMF triaged this task as Medium priority.Aug 26 2024, 6:48 PM

I believe this is already done?

No, pie charts implement titles using the tabular data description, but we actually want to have user-provided titles for all chart types.

CCiufo-WMF edited projects, added Charts (Sprint 9); removed Charts.
CCiufo-WMF moved this task from Sprint 9 to Backlog on the Charts board.
CCiufo-WMF edited projects, added Charts; removed Charts (Sprint 9).
Jdlrobson raised the priority of this task from Medium to High.Nov 1 2024, 9:55 PM

Change #1086577 had a related patch set uploaded (by Jdlrobson; author: Aude):

[mediawiki/extensions/Chart@master] Render title in charts from chart definition

https://gerrit.wikimedia.org/r/1086577

CCiufo-WMF lowered the priority of this task from High to Medium.Nov 4 2024, 7:31 PM
CCiufo-WMF moved this task from Backlog to Sprint 10 on the Charts board.
CCiufo-WMF edited projects, added Charts (Sprint 10); removed Charts.

Do we want some limit on length of chart titles?

Change #1086577 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] Render title in charts from chart definition

https://gerrit.wikimedia.org/r/1086577

Do we want some limit on length of chart titles?

I don't know what a reasonable length would be. I think we can leave it up to editors who are coming up with the title to decide what is an appropriate length.

@CCiufo-WMF though perhaps we should have some limit to avoid anything crazy (e.g. from security perspective)?

"Chart titles wrap across multiple lines if they are too long to fit inside the preset dimensions."

How many lines do we want to allow the title to wrap? Or keep it to one line and truncate the title text? (easiest is one line)

Change #1087270 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] Responsive chart title width

https://gerrit.wikimedia.org/r/1087270

@CCiufo-WMF though perhaps we should have some limit to avoid anything crazy (e.g. from security perspective)?

"Chart titles wrap across multiple lines if they are too long to fit inside the preset dimensions."

How many lines do we want to allow the title to wrap? Or keep it to one line and truncate the title text? (easiest is one line)

Okay let's keep it to one line with truncation for now. We can come back to this later and tweak the visual design.

Change #1087270 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] Responsive chart title width

https://gerrit.wikimedia.org/r/1087270

Jdlrobson moved this task from Doing to Ready for Signoff on the Charts (Sprint 10) board.
Jdlrobson moved this task from Ready for Signoff to Doing on the Charts (Sprint 10) board.
Jdlrobson moved this task from Doing to Ready for Signoff on the Charts (Sprint 10) board.
Jdlrobson added a subscriber: aude.
Jdlrobson moved this task from Ready for Signoff to Code Review on the Charts (Sprint 10) board.
Jdlrobson updated the task description. (Show Details)

Found some additional acceptance criteria on T375235

  NODES
Note 5
Project 9