Page MenuHomePhabricator

Rewrite wiki graph modules written in older schemas for compatibility with Vega 5
Open, MediumPublicFeature

Related Objects

StatusSubtypeAssignedTask
OpenBUG REPORTNone
ResolvedSecurityJdlrobson
DuplicateNone
OpenNone
StalledJdlrobson
StalledBUG REPORTNone
OpenNone
OpenFeatureJdlrobson
ResolvedBawolff
DeclinedNone
DeclinedNone
DeclinedNone
Resolved Jseddon
ResolvedJdlrobson
ResolvedJdlrobson
Resolvedsbassett
ResolvedFeatureJdlrobson
OpenFeatureNone
OpenJdlrobson
OpenNone

Event Timeline

I wrote some code (with tests) that automatically maps graphs from the version 2 spec to 5: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Graph/+/909761/6/modules/ext.graph.lite/mapSchema.js so hopefully this makes this moot (and we could at some later date add this to VE for run a script to make this migration happen)

See also related T120319

I wrote some code (with tests) that automatically maps graphs from the version 2 spec to 5: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Graph/+/909761/6/modules/ext.graph.lite/mapSchema.js so hopefully this makes this moot (and we could at some later date add this to VE for run a script to make this migration happen)

See also related T120319

Thank you! But in any case, in the future we should completely get rid of the fallback for vega 2, so it's better to start sooner rather than later.

Should be straight forward to create a page with a textarea that pulls https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Graph/+/909761/6/modules/ext.graph.lite/mapSchema.js and allows you to convert the JSON to aid editors. Feel free to experiment and let me know if there's any problems with that code so I can improve it as it's not well battle tested!

Change 911414 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Graph@master] Sandbox supports editors rewriting schemas

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

Jdlrobson renamed this task from Rewrite inwiki graphs modules for compatibility with Vega 5 to Rewrite inwiki graphs modules written in older schemas for compatibility with Vega 5.Apr 24 2023, 11:01 PM

I've updated the Special:GraphSandbox tool to support updating schemas. @Iniquity would this help editors like yourself and is this what you had in mind when you raised this issue? The bottom left is a schema 5 equivalent of the text area on the right and is copy/pasteable.

Screenshot 2023-04-24 at 3.56.13 PM.png (866×1 px, 152 KB)

Jdlrobson triaged this task as Medium priority.Apr 24 2023, 11:57 PM

I've updated the Special:GraphSandbox tool to support updating schemas. @Iniquity would this help editors like yourself and is this what you had in mind when you raised this issue? The bottom left is a schema 5 equivalent of the text area on the right and is copy/pasteable.

Hello! Cool, yes, it will help a lot for updating inline graphs. Maybe the right way would be to do the opposite, to insert the old code in the bottom field, and in the right one already receive the new version?

@Iniquity if it worked that way, what would happen if you put an old schema code in the box on the right? What would happen if I accidentally edited the left box (my thought was the left box would be read only)?

@Iniquity if it worked that way, what would happen if you put an old schema code in the box on the right?

Error reporting an outdated schema and the need to put the code in a different field. Of course, can make them replaceable, and if the old version is determined, then change the behavior.

What would happen if I accidentally edited the left box (my thought was the left box would be read only)?

An "convert" button appears.

Maybe do it differently? Create a separate conversion sandbox with two independent fields and independent graphs one below the other: code on the left, graph on the right. Above is the field for Vega 2, below is for Vega 5. If a code is added to Vega 2, then the "Convert" button appears. When pressed, the code for Vega 5 appears with a graph.

I'm gonna go ahead with the patch I've got right now as I want to prioritize providing some kind of tool for upgrading schemas and I haven't had the time to run this by a designer. We can revisit the user experience later when we are in a better place. Hope that works for you!

Change 911414 merged by jenkins-bot:

[mediawiki/extensions/Graph@master] Sandbox: Support editors re-writing schemas

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

I'm gonna go ahead with the patch I've got right now as I want to prioritize providing some kind of tool for upgrading schemas and I haven't had the time to run this by a designer. We can revisit the user experience later when we are in a better place. Hope that works for you!

As an MVP, this is a very good start, thanks! :)

Waiting on deployment now, I suspect.

And many more:

Add to this:
eu:Template:Graph:Weather monthly history
eu:Template:biztanleria grafiko automatikoa

And many more:

Add to this:
eu:Template:Graph:Weather monthly history
eu:Template:biztanleria grafiko automatikoa

I have added base templates.

Observation: The en:Template:Map_with_marks listed above is supposed to just be a copy of https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks but I notice that various edits - including some debugs and a change of name (!) have been made to the en: version - despite the quite firm instructions at the top of the code. I have no idea if the many other language versions have copied from en: or from mw:. I'm guessing it would streamline things to have a single harmonised version again, but that may be harder than tackling them all individually.

Seddon renamed this task from Rewrite inwiki graphs modules written in older schemas for compatibility with Vega 5 to Rewrite on wiki graphs modules written in older schemas for compatibility with Vega 5.Apr 27 2023, 4:57 PM

https://www.mediawiki.org/wiki/Template:Graph:PageViews
Hmm, this graph has started using "dates with words", is there any way to make localization so that, for example, dates are shown in the interface language? It also mixes the name of the month and the name of the day of the week in all graphs.
@domoritz hi, it is possible? :)

Localization for Vega is described in https://vega.github.io/vega/docs/api/locale/. If you want to go back to formatting with numbers, you could also do that.

Does anyone else is working on update of modules for graphs to Vega 5? I'm doing my best here https://en.wikipedia.beta.wmflabs.org/wiki/Module:Graph/sandbox but progress is very slow (see here https://en.wikipedia.beta.wmflabs.org/wiki/Template:Graph:Chart/sandbox).

I suspect more people will be working on this once Graph is actually re-enabled.

Module:Graph for Template:Graph:Chart is updated to Vega 5 but only for "Chart" part is here https://en.wikipedia.beta.wmflabs.org/wiki/Module:Graph/sandbox. Function p.map() used by Template:Graph:Map is not updated yet.

Please enable "external data" access for Vega on en.wikipedia.beta.wmflabs.org. It's not possible to update modules and templates that use data from commons, wikidata etc. and Graph:Module/map because it use data geodata via wikiraw

Novem_Linguae renamed this task from Rewrite on wiki graphs modules written in older schemas for compatibility with Vega 5 to Rewrite wiki graphs modules written in older schemas for compatibility with Vega 5.Sep 16 2023, 7:52 PM
Pppery renamed this task from Rewrite wiki graphs modules written in older schemas for compatibility with Vega 5 to Rewrite wiki graph modules written in older schemas for compatibility with Vega 5.Sep 16 2023, 9:28 PM

Module:Graph p.chart() is ready. Other templates are not updated mostly because they use URL for data source. Since this is disabled on beta.wmflabs it's not possible to work on them effectively and debug.

This comment was removed by Pietrasagh.