Module talk:Graph

Rotate x-axis
Is there a way to rotate x-axis text on a -45 degree angle? Otherwise text frequently overlaps when using dates.

produces:

Any help/update appreciated. T.Shafee(Evo &#38; Evo)talk 02:15, 5 October 2016 (UTC)
 * Use  or  . --Mps (talk) 15:44, 14 April 2018 (UTC)

When rotating text in bar chart, the text is offset relative to the bars
Example:

Any workaround? Segoldberg (talk) 16:28, 21 July 2020 (UTC)
 * , yes, a wider graph. Mathglot (talk) 02:15, 4 April 2022 (UTC)

Why are the charts so ugly?
I'm sorry, but maybe I don't get the point of this module. Maybe we can produce nice SVG files, but at the end the article displays very ugly (blurred) PNGs. Why not follow the way of, for example, Module:Chart. In the article they look much much better. Unfortunately a lot of plotting options are not implemented. Димитър Янков (talk) 10:38, 19 May 2017 (UTC)
 * It looks a technical decision. If you are in edit mode they are actually rendered using a Canvas element as a vector graphic. But in read mode a PNG is created instead for whatever reason (likely compatibility reasons). --Mps (talk) 15:48, 14 April 2018 (UTC)

Horizontal Bar
Hello, can anyone realize this functional? mw:Extension:Graph/Demo/HorizontalBarGraphSample. Iniquity (talk) 10:55, 6 March 2018 (UTC)

Axes text colour
I'm concerned the recent change to the text colour of the axes has a negative impact on readability for people with sub-optimal eyesight. This is particularly true when a graph appears over a grey background like this or this. I'm not sure what "color-inversion issues" the edit was trying to solve, but I think the outcome is poor.

Another issue is that an inconsistency has been introduced between the appearance of these graphs and those of Template:Graph:Lines. Gareth (talk) 07:43, 8 October 2018 (UTC)

Output display
It seems to me that the utility of this module is severely undercut by the decision to render as a poor-quality rasterized image. See also my comment at Talk:Buffalo Metro Rail. Mackensen (talk) 10:56, 30 July 2019 (UTC)

Template:Graph:Population history
Hi, the recent changes to this module may have broken some functionality in Template:Graph:Population history. I don't know anything about either template, just saw the VPT post. --Trialpears (talk) 20:37, 1 September 2019 (UTC)
 * It is a known problem, at Phabricator, "Graph not displayed if linked to a wikidata query". StarryGrandma (talk) 01:04, 3 September 2019 (UTC)

Discussion at Template talk:Graph:Chart
You are invited to join the discussion at Template talk:Graph:Chart. -- / Alex /21  08:04, 22 September 2019 (UTC)

How to change label elements' text color?
From vega.github.io/vega/docs/config/, I found the  property, but that doesn't seem to work in the Wiki interpretation of Vega. So I also tried:

See Module:Graph/sandbox for various attempts. Does anyone know how to properly implement this? ~ Tom.Reding (talk ⋅dgaf) 19:12, 8 November 2019 (UTC)


 * does it.  ~ Tom.Reding (talk ⋅dgaf)  19:24, 8 November 2019 (UTC)

Highlighting a curve by hovering only works in preview mode. Would tooltips also be possible?
Three questions:

1. When the mouse is hovering a curve, the curve is highlighed in red. Very nice feature! But it only works for me when previewing a plot, not in the real plot. Do you experience the same problem? Why? Some CSS issue or gadget?

2. Ideally, it should be possible to hover over the legend as well to highlight the corresponding curve. Is that possible to implement?

3. The module:Chart allows tooltips, for example, a popup window with exact numbers with unit and curve name, when the mouse is hovering over a certain bar or point on the curve. Would that be possible? (Also, Template:Global Heat Maps by Year allows tooltips when hovering a country on the map.) 193.10.109.173 (talk) 17:32, 22 January 2020 (UTC)

Wishlist: log option
Having an option for the horizontal and/or vertical axis to be base-10-logarithmic, showing the non-log scale(s) on the axes, e.g. "1 10 100 1000" would be nice.

Right now, an editor can, of course, calculate base-10 log of the input data, but this would defeat the point of creating tables directly from wikitables with reliably sourced data, and the meaning of the axes would be less obvious to a typical reader ("Why is the axis labelled '0 1 2 3' when the numbers go up to 1000s?"). Boud (talk) 20:49, 23 February 2020 (UTC)

I assume that this would automatically feed through to Template:Graph:Chart. Boud (talk) 20:50, 23 February 2020 (UTC)
 * ✅ See Template_talk:Graph:Chart for some equivalent requests. Boud (talk) 14:41, 26 March 2020 (UTC)

Claim that Graph:Map breaks
In, there was a claim that the 2020-03-11 version of Module:Graph breaks some maps. We need some testcases at Template:Graph:Chart/testcases.... I'm updating the sandbox and creating the testcases page. I suspect that local basemap = frame.args.basemap or "WorldMap-iso2.json" -- WorldMap name and/or location may vary from wiki to wiki is all that is needed. Let's see... Boud (talk) 14:10, 29 March 2020 (UTC)

Template:Graph:Map/testcases - the sandbox version with  local basemap = frame.args.basemap or "Template:Graph:Map/Inner/Worldmap2c-json"  looks OK to me. Boud (talk) 14:18, 29 March 2020 (UTC)
 * Yes, i think that is likely what the issue was. Bawolff (talk) 14:20, 29 March 2020 (UTC)


 * OK, just for future convenience, here are the two testcases pages: Template:Graph:Chart/testcases and the Template:Graph:Map/testcases. Boud (talk) 14:23, 29 March 2020 (UTC)


 * ✅ Boud (talk) 14:25, 29 March 2020 (UTC)

Second vertical axis
Is it possible to add a secondary vertical axis, to display two series at different scales? This would be useful for example to display an increasing series with its variation on the same graph. Papagon (talk) 12:40, 14 April 2020 (UTC)
 * Good idea. I will start working on it. Pietrasagh (talk) 09:20, 19 April 2020 (UTC)
 * After some tests it seems that this simple feature would require lots on work. Current way the module is building data structure for graph would need to be revised very deeply. For now you can try to draw graph in different way using Graph extension. Unfortunately it require to define graph in JSON and that's no easy. You can test it here in Graph Sandbox. Pietrasagh (talk) 14:37, 9 May 2020 (UTC)

Odd empty/blank space on graph
Template talk:Graph:Chart Hey! Maybe someone knows how to remove thats odd "empty, blank" space from the start and end of graph timeline? Here I explain what I meant and here too. You can clearly see that some graph from COVID-19_pandemic_in_Poland have that odd empty space, and some don't, any solutions? thx, Natanieluz (talk) 07:44, 5 May 2020 (UTC)

Possibility of bug in scaling while using date.
The following code produces

The x data series has fields till 2020-08-01, but the rendered graph shows x axis ticks marks well over 2020-08-01.

This is not a lone event. Can be seen on various chart at Special:Permalink/970633899 and Special:Permalink/970636517.

- Timbaaa -> ping me 15:03, 1 August 2020 (UTC)


 * Pinging . - Timbaaa -> ping me 06:17, 5 August 2020 (UTC)
 * I confirm this bug. Scale for axis with "date" format is not calculated correctly and marks "miss" it's place on graph by some factor. Location error changes depending on number of elements. Weirdly largest is when there are 9 elements. Please see eg. below (your have to edit this post and preview to see "correct error"):


 * Graphs and all Wikipedia are like are like onions. "They stink?" One may say. "Yes. No." "Oh, they make you cry." "No." ... "No. Layers. Onions have layers"
 * In graphs, templates are first layer, then second is the module. This module only help to translate wiki code to JSON digestible by Wikimedia extension "graph", which calls "Vega" js library that use "D3" library to create graphical representation of graph. Module doesn't calculate scale. It only setup correct value in JSON for scale format and in this case forward date data as string. Bug is somewhere in third layer or deeper. Currently Vega is in version 5.something but Wikimedia extension lags behind and use version 2. You can file this bug here Pietrasagh (talk) 17:41, 6 August 2020 (UTC)

, I think its a problem with the module(I'm not familiar with Lua). I got the debuggable JSON for the chart based on mw:Extension:Graph/Guide and tried it at mw:Special:GraphSandbox.

Here is the actual JSON for the chart.

According to the vega2 documentation, for `time` type `scale`; property `nice` has to be a string valued - "second", "minute", "hour", "day", "week", "month", or "year". But in the actual JSON it has a boolean type value(which is to be used for `linear`,`log`,... type scales), once changed to this the scale marks are clear(also, added 'clamp' to avoid white-spaces at beginning and end).

{ "legends": [], "scales": [ {     "type": "time", "name": "x", "domain": { "data": "chart", "field": "x" },     "zero": false, "range": "width" },   {      "clamp": true, "type": "linear", "name": "y", "domain": { "data": "chart", "field": "y" },     "domainMin": 0, "zero": false, "range": "height", "nice": true },   {      "domain": { "data": "chart", "field": "series" },     "type": "ordinal", "name": "color", "range": [ "#cd5c5c" ]   }  ],  "version": 2, "marks": [ {     "type": "line", "properties": { "hover": { "stroke": { "value": "red" }       },        "update": { "stroke": { "scale": "color", "field": "series" }       },        "enter": { "y": { "scale": "y", "field": "y" },         "x": { "scale": "x", "field": "x" },         "stroke": { "scale": "color", "field": "series" },         "strokeWidth": { "value": 2.5 }       }      },      "from": { "data": "chart" }   }  ],  "height": 300, "axes": [ {     "type": "x", "title": "Date", "scale": "x", "properties": { "title": { "fill": { "value": "#54595d" }       },        "grid": { "stroke": { "value": "#54595d" }       },        "ticks": { "stroke": { "value": "#54595d" }       },        "axis": { "strokeWidth": { "value": 2 },         "stroke": { "value": "#54595d" }       },        "labels": { "align": { "value": "right" },         "angle": { "value": -45 },         "fill": { "value": "#54595d" }       }      },      "grid": true },   {      "type": "y", "scale": "y", "properties": { "title": { "fill": { "value": "#54595d" }       },        "grid": { "stroke": { "value": "#54595d" }       },        "ticks": { "stroke": { "value": "#54595d" }       },        "axis": { "strokeWidth": { "value": 2 },         "stroke": { "value": "#54595d" }       },        "labels": { "fill": { "value": "#54595d" }       }      },      "grid": true } ],  "data": [ {     "format": { "parse": { "y": "number", "x": "date" },       "type": "json" },     "name": "chart", "values": [ {         "y": 1.35, "series": "y", "x": "2020-03-12" },       {          "y": 2.47, "series": "y", "x": "2020-03-13" },       {          "y": 2.38, "series": "y", "x": "2020-03-14" },       {          "y": 1.82, "series": "y", "x": "2020-03-15" },       {          "y": 1.75, "series": "y", "x": "2020-03-16" },       {          "y": 2.19, "series": "y", "x": "2020-03-17" },       {          "y": 1.99, "series": "y", "x": "2020-03-18" },       {          "y": 2.31, "series": "y", "x": "2020-03-19" },       {          "y": 1.79, "series": "y", "x": "2020-03-20" },       {          "y": 1.27, "series": "y", "x": "2020-03-21" },       {          "y": 1.94, "series": "y", "x": "2020-03-22" },       {          "y": 1.92, "series": "y", "x": "2020-03-23" },       {          "y": 1.93, "series": "y", "x": "2020-03-24" },       {          "y": 1.65, "series": "y", "x": "2020-03-25" },       {          "y": 2.31, "series": "y", "x": "2020-03-26" },       {          "y": 2.28, "series": "y", "x": "2020-03-27" },       {          "y": 2.07, "series": "y", "x": "2020-03-28" },       {          "y": 2.64, "series": "y", "x": "2020-03-29" },       {          "y": 2.56, "series": "y", "x": "2020-03-30" },       {          "y": 2.51, "series": "y", "x": "2020-03-31" },       {          "y": 2.24, "series": "y", "x": "2020-04-01" },       {          "y": 2.56, "series": "y", "x": "2020-04-02" },       {          "y": 2.43, "series": "y", "x": "2020-04-03" },       {          "y": 2.44, "series": "y", "x": "2020-04-04" },       {          "y": 2.32, "series": "y", "x": "2020-04-05" },       {          "y": 2.59, "series": "y", "x": "2020-04-06" },       {          "y": 2.59, "series": "y", "x": "2020-04-07" },       {          "y": 2.83, "series": "y", "x": "2020-04-08" },       {          "y": 2.88, "series": "y", "x": "2020-04-09" },       {          "y": 3.05, "series": "y", "x": "2020-04-10" },       {          "y": 3.21, "series": "y", "x": "2020-04-11" },       {          "y": 3.23, "series": "y", "x": "2020-04-12" },       {          "y": 3.46, "series": "y", "x": "2020-04-13" },       {          "y": 3.26, "series": "y", "x": "2020-04-14" },       {          "y": 3.29, "series": "y", "x": "2020-04-15" },       {          "y": 3.29, "series": "y", "x": "2020-04-16" },       {          "y": 3.27, "series": "y", "x": "2020-04-17" },       {          "y": 3.3, "series": "y", "x": "2020-04-18" },       {          "y": 3.22, "series": "y", "x": "2020-04-19" },       {          "y": 3.17, "series": "y", "x": "2020-04-20" },       {          "y": 3.18, "series": "y", "x": "2020-04-21" },       {          "y": 3.18, "series": "y", "x": "2020-04-22" },       {          "y": 3.16, "series": "y", "x": "2020-04-23" },       {          "y": 3.08, "series": "y", "x": "2020-04-24" },       {          "y": 3.12, "series": "y", "x": "2020-04-25" },       {          "y": 3.07, "series": "y", "x": "2020-04-26" },       {          "y": 3.12, "series": "y", "x": "2020-04-27" },       {          "y": 3.13, "series": "y", "x": "2020-04-28" },       {          "y": 3.17, "series": "y", "x": "2020-04-29" },       {          "y": 3.2, "series": "y", "x": "2020-04-30" },       {          "y": 3.26, "series": "y", "x": "2020-05-01" },       {          "y": 3.24, "series": "y", "x": "2020-05-02" },       {          "y": 3.24, "series": "y", "x": "2020-05-03" },       {          "y": 3.24, "series": "y", "x": "2020-05-04" },       {          "y": 3.39, "series": "y", "x": "2020-05-05" },       {          "y": 3.43, "series": "y", "x": "2020-05-06" },       {          "y": 3.37, "series": "y", "x": "2020-05-07" },       {          "y": 3.35, "series": "y", "x": "2020-05-08" },       {          "y": 3.32, "series": "y", "x": "2020-05-09" },       {          "y": 3.35, "series": "y", "x": "2020-05-10" },       {          "y": 3.29, "series": "y", "x": "2020-05-11" },       {          "y": 3.24, "series": "y", "x": "2020-05-12" },       {          "y": 3.25, "series": "y", "x": "2020-05-13" },       {          "y": 3.27, "series": "y", "x": "2020-05-14" },       {          "y": 3.23, "series": "y", "x": "2020-05-15" },       {          "y": 3.2, "series": "y", "x": "2020-05-16" },       {          "y": 3.16, "series": "y", "x": "2020-05-17" },       {          "y": 3.15, "series": "y", "x": "2020-05-18" },       {          "y": 3.13, "series": "y", "x": "2020-05-19" },       {          "y": 3.09, "series": "y", "x": "2020-05-20" },       {          "y": 3.06, "series": "y", "x": "2020-05-21" },       {          "y": 3.02, "series": "y", "x": "2020-05-22" },       {          "y": 2.97, "series": "y", "x": "2020-05-23" },       {          "y": 2.93, "series": "y", "x": "2020-05-24" },       {          "y": 2.9, "series": "y", "x": "2020-05-25" },       {          "y": 2.87, "series": "y", "x": "2020-05-26" },       {          "y": 2.86, "series": "y", "x": "2020-05-27" },       {          "y": 2.86, "series": "y", "x": "2020-05-28" },       {          "y": 2.84, "series": "y", "x": "2020-05-29" },       {          "y": 2.86, "series": "y", "x": "2020-05-30" },       {          "y": 2.84, "series": "y", "x": "2020-05-31" },       {          "y": 2.83, "series": "y", "x": "2020-06-01" },       {          "y": 2.82, "series": "y", "x": "2020-06-02" },       {          "y": 2.8, "series": "y", "x": "2020-06-03" },       {          "y": 2.8, "series": "y", "x": "2020-06-04" },       {          "y": 2.8, "series": "y", "x": "2020-06-05" },       {          "y": 2.81, "series": "y", "x": "2020-06-06" },       {          "y": 2.81, "series": "y", "x": "2020-06-07" },       {          "y": 2.81, "series": "y", "x": "2020-06-08" },       {          "y": 2.8, "series": "y", "x": "2020-06-09" },       {          "y": 2.8, "series": "y", "x": "2020-06-10" },       {          "y": 2.83, "series": "y", "x": "2020-06-11" },       {          "y": 2.86, "series": "y", "x": "2020-06-12" },       {          "y": 2.88, "series": "y", "x": "2020-06-13" },       {          "y": 2.87, "series": "y", "x": "2020-06-14" },       {          "y": 2.86, "series": "y", "x": "2020-06-15" },       {          "y": 2.89, "series": "y", "x": "2020-06-16" },       {          "y": 3.36, "series": "y", "x": "2020-06-17" },       {          "y": 3.33, "series": "y", "x": "2020-06-18" },       {          "y": 3.3, "series": "y", "x": "2020-06-19" },       {          "y": 3.28, "series": "y", "x": "2020-06-20" },       {          "y": 3.23, "series": "y", "x": "2020-06-21" },       {          "y": 3.22, "series": "y", "x": "2020-06-22" },       {          "y": 3.18, "series": "y", "x": "2020-06-23" },       {          "y": 3.17, "series": "y", "x": "2020-06-24" },       {          "y": 3.15, "series": "y", "x": "2020-06-25" },       {          "y": 3.12, "series": "y", "x": "2020-06-26" },       {          "y": 3.08, "series": "y", "x": "2020-06-27" },       {          "y": 3.04, "series": "y", "x": "2020-06-28" },       {          "y": 3, "series": "y", "x": "2020-06-29" },       {          "y": 2.98, "series": "y", "x": "2020-06-30" },       {          "y": 2.97, "series": "y", "x": "2020-07-01" },       {          "y": 2.95, "series": "y", "x": "2020-07-02" },       {          "y": 2.91, "series": "y", "x": "2020-07-03" },       {          "y": 2.88, "series": "y", "x": "2020-07-04" },       {          "y": 2.86, "series": "y", "x": "2020-07-05" },       {          "y": 2.82, "series": "y", "x": "2020-07-06" },       {          "y": 2.8, "series": "y", "x": "2020-07-07" },       {          "y": 2.78, "series": "y", "x": "2020-07-08" },       {          "y": 2.75, "series": "y", "x": "2020-07-09" },       {          "y": 2.72, "series": "y", "x": "2020-07-10" },       {          "y": 2.69, "series": "y", "x": "2020-07-11" },       {          "y": 2.67, "series": "y", "x": "2020-07-12" },       {          "y": 2.64, "series": "y", "x": "2020-07-13" },       {          "y": 2.62, "series": "y", "x": "2020-07-14" },       {          "y": 2.6, "series": "y", "x": "2020-07-15" },       {          "y": 2.57, "series": "y", "x": "2020-07-16" },       {          "y": 2.55, "series": "y", "x": "2020-07-17" },       {          "y": 2.53, "series": "y", "x": "2020-07-18" },       {          "y": 2.49, "series": "y", "x": "2020-07-19" },       {          "y": 2.46, "series": "y", "x": "2020-07-20" },       {          "y": 2.43, "series": "y", "x": "2020-07-21" },       {          "y": 2.41, "series": "y", "x": "2020-07-22" },       {          "y": 2.41, "series": "y", "x": "2020-07-23" },       {          "y": 2.38, "series": "y", "x": "2020-07-24" },       {          "y": 2.35, "series": "y", "x": "2020-07-25" },       {          "y": 2.31, "series": "y", "x": "2020-07-26" },       {          "y": 2.28, "series": "y", "x": "2020-07-27" },       {          "y": 2.25, "series": "y", "x": "2020-07-28" },       {          "y": 2.23, "series": "y", "x": "2020-07-29" },       {          "y": 2.21, "series": "y", "x": "2020-07-30" },       {          "y": 2.18, "series": "y", "x": "2020-07-31" },       {          "y": 2.15, "series": "y", "x": "2020-08-01" }     ]    }  ],  "width": 900 } Missed signature in last edit; pinging again with signature - Timbaaa -> ping me 07:03, 7 August 2020 (UTC)
 * You are correct! Wrong  property value seems to generate both problem: wrong scale and white-space. I changed logic behind it and will push updated code with new version of module.

Pietrasagh (talk) 17:34, 7 August 2020 (UTC)
 * , Great! thank you. It seems the main module already lags behind the sandbox for couple of versions.- Timbaaa -> ping me 02:42, 8 August 2020 (UTC)
 * Yep, it's all my fault. Testing by my self takes lot of time. To keep correct "supply chain" I need to update module on German wiki first. Pietrasagh (talk) 07:59, 8 August 2020 (UTC)

Update to newest version of vega?
The newest versions of vega have neat features like LOESS regression and this would be very useful for polling average as it is the best interpolation method used. - &#124;&#124; RuleTheWiki  &#124;&#124; (talk) 14:12, 1 May 2021 (UTC)

Could this module be fed data from a wikitable instead of as explicit parameters?
That would be real game changer for Wikipedia, as charts would be automatically updated when tables received new data. Here is a good example of how to read data from tables. The module could be called with a page name (if not its own), a table id (if not the 1st one), and the columns for labels and values (if not the 1st and 2nd, respectively). It would certainly break if the table is oddly shaped or malformed, but that could be minimised ignoring header rows. This shouldn't be too hard, as this module already converts parameter values into values on tables. Here is my first crack at it. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 01:37, 20 May 2021 (UTC)
 * , this functionality already exists. See Template:Graph:Lines and Template:Graph:Stacked. The data can be stored either as a table in the Data namespace at Commons or queried from the Wikidata database. StarryGrandma (talk) 03:29, 20 May 2021 (UTC)
 * Great! I'll use it. And I see that using data from Wikidata or Commons is much more robust, but... also less flexible. There's a ton of data on Wikipedia not imported into Wikidata or Commons (nor should it all). But still editors might see a benefit to graph it on articles. Do these methods work with wikitables? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 03:42, 20 May 2021 (UTC)
 * They are part of a project to make templates language independent. So the data is stored centrally at Commons or uses data already in Wikidata so the graph can be used in multiple language Wikipedias. See mw:Help:Tabular Data. StarryGrandma (talk) 03:50, 20 May 2021 (UTC)
 * I see. Even tables could benefit from accessing a central data depository. Is there a method for that? I had a look around, and couldn't find anything.
 * OTOH, wikitables seem to be kept up to date much more diligently than Commons Data (sort of demonstrating my point on flexibility, and therefore accessibility). Look at commons:Data:Bea.gov/GDP by state.tab, the very first source there on Template:Graph:Stacked: the data is 5 years stale, whereas the data at the List of states and territories of the United States by GDP is freshly updated.
 * That's not to say the effort of concentrating official data into a central repository isn't worthwhile--it certainly is!--but it doesn't replace the need for data in wikitables, and the willingness to graph it. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 04:07, 20 May 2021 (UTC)

Loading spinner bug
On mobile, the loading spinner appears from behind graphs drawn with this module when horizontally scrolling on them. I've filed a bug report, but maybe this can be solved directly in the module? —Somnifuguist (talk) 02:31, 13 July 2021 (UTC)

Right-side y-axis
I'd like to propose an enhancement to allow a second y-Axis. It's frequently the case that one might want to plot line graphs (or scatterplots) of two sets of numerical data that follow roughly similar patterns but where the data values of one set are roughly twice the other (or 3x, or 10x or whatever; e.g., slowly increasing backlogs of articles in two areas, where one set of numbers is triple the other). Here's an example of a time-series graph with two curves where y-axis is article count: curve 1 (blue) is a count of articles with 0 in-links (i.e. WP:Orphans; y-vals around 1200-1600) belonging to a particular WikiProject, and curve 2 (gold) is articles with 1 in-link (values around 4800-5200): I've hacked this below, by scaling down the 1-link values by 0.3, as follows (all data prior to April are fake; the last two datapoints are real, see 63580): What I'd like to see would be a second y-axis on the right, scaled from roughly 4400-5800, possibly with the addition of these parameters: The important ones are the first two, which ought to be optional and default to a calculation based on min y2 value and max y2 value, and but overrideable for fine tuning. A scale factor should be derived for biasing y2 values up or down the y-axis according to the right-side y-axis; sort of what I did with my hacky use of  on the gold curve above. The other params are cosmetic. Naturally, this only makes sense for numerical yType like integer, not date or string, etc. The last param is about deciding how to align the grid lines; default to lined up with major 'tick marks' on the left y-axis, but if 1, then align with right-side tick marks. Maybe 2 means, 'every 2nd major tick mark', to make the grid sparser. (Or maybe lines both left and right, in separate styles such as dashed or dotted?) Mathglot (talk) 00:09, 4 April 2022 (UTC)
 * 5800
 * 4200
 * count of articles
 * yAxis2Format
 * yAxis2Angle
 * yGrid2
 * Please respond at this discussion at de-wiki. Mathglot (talk) 21:36, 1 September 2022 (UTC)

Vary symbol size by data point
If Graph:Chart accepted varying symbol sizes by data point (not just by series), we could use it to essentially build bubble charts. Here are two use cases: Using the same current syntax for y1Title, y2Title, etc, there could params y1showSymbols, y2showSymbols, etc, to vary symbol sizes by data point. Further, so as to minimise template sizes (and error!), in cases where the same bubble size is used for all series on the same x level (e.g. date), as in (1) above, the template could check whether the number of values in showSymbols exceed the number of series, and in that case interpret them to mean varying symbol size by x, not by series (as it already does). — Guarapiranga ☎ 22:32, 3 May 2022 (UTC)
 * 1) Opinion polls (such as this one), in which bubble sizes could reflect sample sizes (or confidence levels); and
 * 2) Country statistics (say GINI x GDP per capita), in which bubble sizes could reflect the countries populations.

Curvature parameter for bundle interpolation method
The default d3 curvature parameter for the bundle interpolation method, .85, can often be too "erratic" in some applications (as pointed out here, and seen there). The basis method is even more "erratic," as it's standard spline bolted at the extremities, corresponding to a bundle beta of 1, but d3 also accepts other betas. Is that an option with this module (and accompanying template)? I couldn't figure it out from perusing the code. Cheers. — Guarapiranga ☎ 11:15, 4 May 2022 (UTC)

LOESS/LOWESS trendlines
I see Vega has LOESS trendlines. How can we go about adding it to Module:Graph? — Guarapiranga ☎ 13:07, 8 May 2022 (UTC)

Data table
About a year ago, I suggested adding the ability to read data from a wikitable. That hasn't moved forward, but it has just occurred to me that an easier solution would be embed the datatable into the template, collapsible and collapsed, so that editors can easily paste data into it using Visual Editor, and readers can easily see the actual data the charts are based on. — Guarapiranga ☎ 23:37, 29 June 2022 (UTC)


 * Like that (sorta). — Guarapiranga ☎ 23:44, 3 July 2022 (UTC)

Graph module for Vega 3+
Hi, recently development of Graph Extension is more active. There's a slim shade of hope that Vega framework will be updated to a more recent version in the near future. Most of the graphs in Wikipedia articles are generated by template and associated Scribunto module – it's based on Vega 2 syntax. It's incompatible with Vega 3+.

Is anyone currently working on a new version (or complete rewriting) of this module Module:Graph prepared for Vega 3+?

Some part of code are workarounds of bugs in current version extension. Many bugs mentioned by editors can't be solved by module or template. For reference please see Template_talk:Graph:Chart and Module_talk:Graph

Current module is handling the most of the processing of user provided data. It seems that Vega 3+ can do the bulk of this work, presumably with better results and faster. It also can handle and transform external data (eg. Wiki data or tables) very well.

Maybe it would be a good idea to switch to Vega-Lite syntax. It's more human friendly and easier to understand. Syntax is even simpler and requires less input for typical charts.

Any ideas? Volunteers? Unfounded critique? Please post here Graph_module_for_Vega_3+ - Pietrasagh (talk) 12:06, 21 August 2022 (UTC)

Graph issues in the mobile app
Hello, I have noticed on the wikipedia mobile app that many graphs, in particular the line graphs, do not show up. I use the dark mode version, and I believe this is a bug. Is there any way to fix this? Quinby ( talk ) 17:23, 7 January 2023 (UTC)
 * Is there any chance that anyone could answer this query (and the one below), as a small number of users are using these failures as an excuse to remove graphs (which are more easily updatable by editors) and replace them with their own static images. Thanks, Number   5  7  00:13, 28 January 2023 (UTC)
 * I agree with @Number 57 that if the regression was accessible on mobile, it would probably prompt more users to use the Moduel:Graph method for graphs as opposed to static images. CoaxAndBotany (talk) 00:38, 28 January 2023 (UTC)
 * @Quinnnnnby, which dark mode version? We have a gadget, a user script, both apps support it, and I have seen a few dark mode scripts in the wild that have ended up copy-pasted here. Izno (talk) 04:04, 28 January 2023 (UTC)
 * @Izno I use the 'black' theme, though I just went onto the default theme to check that as well, and the graphs were not visible either. Quinby  ( talk ) 12:45, 28 January 2023 (UTC)
 * @Quinnnnnby, I need more info than "black" theme. Where do you select what theme you picked? Izno (talk) 18:34, 28 January 2023 (UTC)
 * @Izno in the mobile app, there's a button along a sidebar at the bottom 'Theme'. You can then choose one of four themes. However, this doesn't seem to matter because the graphs won't show up whatever theme is used. Quinby  ( talk ) 18:41, 28 January 2023 (UTC)
 * Ok, mobile app isn't displaying graphs (correctly), particularly line graphs. Is that iOS or Android? cc @Seddon (WMF) Izno (talk) 18:45, 28 January 2023 (UTC)
 * To the best of my knowledge this is where we are:
 * The graph extension currently doesn't work with parsoid which is what is behind the Page Content Service (PCS). That service is what the apps depends on. Fixing this will be necessary due to the plan for parsoid to be used for read-views so I would expect this will get fixed in the medium term.
 * My understanding is that the apps don't run client-side javascript within the article webview. I think we'd need to change that to enable charts to work in their current form. This is controlled by PCS and right now the majority of that teams resources are being taken up by the parsoid unification mentioned above. This would be a big change for the apps though and it'll likely need security, performance and other reviews.
 * I think everything described above is feasible to achieve but it's one that is going to take time and right now it's sitting in a dependency chain and so we need to patient whilst the content transform team do their thing. I think once that first task is done, we can look to make some progress on the apps side. Seddon (WMF) (talk) 01:20, 29 January 2023 (UTC)
 * It’s not just an app issue, they also don’t display in browser on older iOS 78.17.151.251 (talk) 15:45, 3 June 2023 (UTC)

Local Regressions/Moving Averages
Is there a way we could implement a form of local regression or moving averages for the line graphs (as the French wiki has)? It would greatly improve graphs for opinion polls especially. Quinby ( talk ) 17:36, 7 January 2023 (UTC)


 * This would require someone knowledgeable about the graph extension. It does appear that Vega supports regressions but it is not obvious to me if the version of Vega supported in the extension does. If French wiki is also using the graph extension to implement theirs, you can leave a comment on their page and I'm happy to talk to them about support here. Or perhaps @Pietrasagh can help. Izno (talk) 04:08, 28 January 2023 (UTC)

Compatibility with module:political party
module:political party uses &amp;#35; instead of # for colors. any objections to making this module auto-correct these for compatibility? Frietjes (talk) 21:48, 27 February 2023 (UTC)

Vega 5
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). For details please see here mw:Extension_talk:Graph Pietrasagh (talk) 14:34, 2 September 2023 (UTC)