Page MenuHomePhabricator

[Epic] Charts should work at least for the use cases graphs had
Open, Needs TriagePublic

Description

The current approach for chart doesn't work in most of the cases we used to have with graphs.

A good example is in the article [[:eu:Altsasu]], where both graphs are still broken. (Remember all uses of "graph" extension are broken forever -- someone must port uses to Chart before they will render.)

This problem affects 7.7% of articles at Basque Wikipedia: https://eu.wikipedia.org/wiki/Kategoria:Pages_with_disabled_graphs

Related Objects

Event Timeline

Assuming this is about https://eu.wikipedia.org/wiki/Altsasu (please always provide full links).

That page seems to use

{{Graph:Weather monthly history
| width=900
| table=Altsasu-alsasua-MAN.tab
| title=Altsasuko hilabeteroko eguraldiaren grafikoa
}}

and

{{biztanleria grafiko automatikoa|barrak=14}}

?

Yes, that's an example of two graphs that worked and now are impossible with charts.

I also wish to highlight that there seems no replacement for pageview graph. See https://www.mediawiki.org/wiki/Template:Graph:PageViews

@MilkyDefer: See T393500: Support page view graphs in Charts extension (Graphs parity request) instead.

I am not sure that this very task is actionable/realistic if it becomes a catch-all for complete parity of Charts with the previous MediaWiki-extensions-Graph extension when it comes to custom local modules coming into play.

The task is actionable: "Charts should work at least for the use cases graphs had"

If it is realistic is another issue. It was realistic when we had graphs. It was realistic in every discussion we had (online and in person). If it is not realistic now, the problem is within those that decided to adopt a wrong way.

Try to give specific examples of graphs that we can then break down into individual tasks. This task isn't actionable and will likely be turned into an "epic" that just hangs other tasks off of it.

bvibber renamed this task from Charts should work at least for the use cases graphs had to [Tracking] Charts should work at least for the use cases graphs had.Jun 10 2025, 7:26 PM
bvibber updated the task description. (Show Details)

I also wish to highlight that there seems no replacement for pageview graph. See https://www.mediawiki.org/wiki/Template:Graph:PageViews

Indeed page view charts require additional development work: T393500

Assuming this is about https://eu.wikipedia.org/wiki/Altsasu (please always provide full links).

That page seems to use

{{Graph:Weather monthly history
| width=900
| table=Altsasu-alsasua-MAN.tab
| title=Altsasuko hilabeteroko eguraldiaren grafikoa
}}

and

{{biztanleria grafiko automatikoa|barrak=14}}

?

Ok this looked like this before:

image.png (1,074×718 px, 67 KB)

which probably means it'll have to go through a lua transform grouping column data. That can probably be handled after the Lua transforms roll out. I'll make a separate task specifically for porting it to ensure it works correctly. T396522

Ok this looked like this before:

One of those looked like that. There are two different graphs, one working as requested (via .tab) and the other one pulling data from Wikidata. None of those are working.

Aklapper renamed this task from [Tracking] Charts should work at least for the use cases graphs had to [Epic] Charts should work at least for the use cases graphs had.Jun 10 2025, 7:51 PM
Aklapper added a project: Epic.

Ok this looked like this before:

One of those looked like that. There are two different graphs, one working as requested (via .tab) and the other one pulling data from Wikidata. None of those are working.

right that was the first one, haven't investigated the second one.

Wikidata fetches may require additional work too, depending on what it's querying (eg SPARQL queries). We'll probably want to open a second task for that.

Try to give specific examples of graphs that we can then break down into individual tasks.

https://www.mediawiki.org/wiki/Extension:Graph/Guide#External_data lists a number of data sources (although I think some are missing):

  • Commons Data:*.tab files – covered by the MVP
  • Commons Data:*.map files
  • Commons regular (File-namespace) files as image marks
  • Raw wiki pages; if I understand correctly, this even means interwiki transclusion
  • Action and REST API requests (this includes the T393500 use case)
  • Geoshapes from Wikidata items or SPARQL queries
  • Map snapshots

Other data sources not on that list include:

  • Inline data (from the above list, this could cover Commons Data:*.tab and Data:*.map pages as well as raw wiki pages except for interwiki transclusion)
  • Commons Data:*.tab files – covered by the MVP

Sorry, but that's not the case.

Can you be specific in what is not the case? Chart is literally written around fetching Data:*.tab pages from Commons.

Are you mistakenly under the impression that existing uses of the graph extension will magically start working under charts? Because that's not true. All uses have to be ported.

  • Commons Data:*.tab files – covered by the MVP

Sorry, but that's not the case.

Why isn’t it? Commons Data:*.tab files is exactly what the MVP was built around. (I’m speaking about data sources here, not chart types. Yes, we could also create a list of chart types that were supported by Graph, but the two lists are orthogonal.)

In that case, yes, it works. However, we can't see them.

In that case, yes, it works. However, we can't see them.

Great! Next step is to create Data:*.chart pages for each separate chart format and change the templates and one-off uses of graph to refer to their .chart and .tab pages together.

https://www.mediawiki.org/wiki/Extension:Chart

Then change the invocation of graph into a {{#chart:Foobar.chart}} when using the data source referenced from the chart description, or {{#chart:Foobar.chart|data=Override.tab}} for per-item overrides.

This won't cover all possible uses of graphs, as we know and you know alike! But it will cover many simple cases, and as we (we all, collectively) put in effort to port the old uses we'll (we devs and task editors) be better able to specify what additional work needs to be prioritized to make more of them work, or enable new capabilities.

Are you mistakenly under the impression that existing uses of the graph extension will magically start working under charts?

Not magically. They should work, that's the point.

Are you mistakenly under the impression that existing uses of the graph extension will magically start working under charts?

Not magically. They should work, that's the point.

They will only work if someone ports them to the new system.

The old system worked with raw JavaScript source code and was wildly unregulatable and unsafe; there is not an automatic conversion.

Are you mistakenly under the impression that existing uses of the graph extension will magically start working under charts?

Not magically. They should work, that's the point.

They will only work if someone ports them to the new system.

There are instructions at commons:User:Tomastvivlaren/graphDataImport that are really straightforward to follow, if that helps any, @Theklan

Thanks @OwenBlacker. As far as I have tested, that solution doesn't import the data nor graphs we are talking about here.

Ah, fair enough @Theklan; I found it worked really well with line charts, but I didn't even attempt it with other kinds, as I thought that might be the case 🙁

How might this work with a 3rd party wiki that doesn't have a Commons-like sister wiki?

@Bugreporter2: What exactly is "this" in your sentence?

@Bugreporter2: What exactly is "this" in your sentence?

sorry, I commented on the wrong task.

T405861: Add support for generating non-interactive SVG images via Scribunto is a solution more flexable than Chart extension, and it is thus not necessary for Chart to 100% replicate behavior of Graph. (we need a solution for Chart based on pageview or WDQS though.)

T405861: Add support for generating non-interactive SVG images via Scribunto is a solution more flexable than Chart extension, and it is thus not necessary for Chart to 100% replicate behavior of Graph. (we need a solution for Chart based on pageview or WDQS though.)

In this case, there should be some generic module code for graphs using SVG in this case. It will take years if every user that wants to do this will draw every vertical bar by themself.

See Module:Graph:Chart and Template:WikidataChart -- effectively, we now have graphs with dynamic data (e.g. from Wikidata) working again.

@Wellverywell I have copied the module and the template but this is not working at euwiki:

Modulu:WikidataChart at line 34:Commons chart required.

I'm using the example code.

There are two required parameters, a chart and Wikidata property to display on Y axis. Have you tried the examples slightly below?

I have tried now one below, and it works only for Elo ratings. I want to show population charts, so I think I need to create an specific chart fot that at Commons, isn't it?

There already is one. You can take the code from here: {{WikidataChart|P1082|pageIds={{{from|}}}|chart=Wikidata population (with dynamic data)}

Thanks! That's what I have been looking for in the last two years!

I can't make width and height parameters to work, but the results are coming. I have checked the module, and the width and height parameters are missing.

Yeah, currently I introduced with some hacks only the size parameter. Some more info here: https://phabricator.wikimedia.org/T376845#11417667