Template talk:Graph:Chart/Archive 2

Latest comment: 2 years ago by Cypp0847 in topic Typo of parameter
Archive 1Archive 2Archive 3Archive 4

Symbols and line-widths upgrade

Hi, I made small upgrade for showSymbols, and linewidths. Now new option are available:

  • linewidths: linewidths may be defined for for series with csv (may be useful for crowded charts)
  • showSymbols: number as size or default 2.5, may be defined for for series with csv
  • symbolsShape: circle, x, square, cross, diamond, triangle_up, triangle_down, triangle_right, triangle_left - may be defined for series with csv
  • showSymbols: number or default 2.5,
  • symbolsNoFill: if true symbol without fill (only stroke),
  • symbolsStroke: symbol stroke, default 2.5 if "x" of symbolsNoFill

For debugging I added function "chartDebugger" that return vega JSON and other runtime info. It's work in progress... tell me what more you would like.

-- contribs) 18:36, 11 April 2020 (UTC) 
Debugging took some time, but well... please tests new options. New version of module is in Module:Graph/sandbox and Template:Graph:Chart/sandbox I've upgraded test-cases little bit to show changes but it's hard to know where something would go wrong in real life examples, please see examples above. Target of changes was to make crowded charts readable. It can be achieved by different line-widths applied to specific series or different symbols. Just as reminder: to have scattered graph you can set set "type = line | showSymbol = | linewidth = 0" for some series. Now it can be combined with other line graphs (series).
Now new option are:
  • linewidths: linewidths may be defined for for series with csv eg. "1, 3, 4, 0"
  • showSymbols: number or default 2.5, may be defined for for series with csv eg. "1, 3, 4, 0"
  • symbolsShape: circle, x, square, cross, diamond, triangle_up, triangle_down, triangle_right, triangle_left or default circle, - may be defined for series with csv eg. "circle, diamond, square"
  • symbolsNoFill: if true symbol without fill (only stroke), for now, global for all symbols
  • symbolsStroke: symbol stroke, default 2.5 if "x" of symbolsNoFill, for now, global for all symbols
  • chartDebugger()
In near future (maybe):
- marks:
- line strokeDash + serialization,
- symStroke serialization
- symbolsNoFill serialization
- arbitrary SVG path symbol shape as symbolsShape argument
- annotations
- vertical / horizontal line at specific values
- rectangle shape for x,y data range

--Pietrasagh (talk) 19:48, 10 May 2020 (UTC)

Sorry to ping you all @Mps:, @Yurik:, @Toohool:, @Tom.Reding: but I had no feedback so far. It would be great if you could take a look at it. -- Pietrasagh (talk) 20:23, 25 May 2020 (UTC)

Standard way to add a title and a source

Some writers might be interested to have an easy and regular way to provide some title or some source for their graphs, such as:

My title
Source(s): WHO[1], WHO_2[2]
  1. ^ Any http reference
  2. ^ a second source for a specific set of data

Not sure if any source or reference is useful in wikipedia, but in case it is, what is the standard way to to it for a graph?

Documentation recommends to use Image frame or Side box templates -- Pietrasagh (talk) 09:15, 24 May 2020 (UTC)
For the French Wikipedia, template: fr:Modèle:Vignette multiple documentation does not document such a thing.
Moreover some page layout makes the picture needs to be full width rather than boxed on the right. — Preceding unsigned comment added by 88.136.209.92 (talk) 06:42, 1 June 2020 (UTC)

That strange "empty,blank" space on timeline.

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) 09:24, 4 May 2020 (UTC)

It was bug in module. Now it partially corrected (works for xType = date) --Pietrasagh (talk) 14:56, 8 August 2020 (UTC)

Reordering even strings like integers

How can i make all graphs look the same except different values on the x axis? xType = string only stops "interpolating", values continue to be ordered like integers. Error/bug of the template?

Second: How can i increase font-size of the x-axis? Thanks, 92.116.88.169 (talk) 23:36, 15 June 2020 (UTC)

I checked it. It seems that template and it's module is working correctly. It might be a problem with Graph extension. Workaround would be to add some non visible character like "​" to numbers in `x` and it will be treated as string. There's no need to add `xType = string`.
Regarding second issue: in this template, you can't. To adjust it and anything else beyond options described in template documentation use Special:ExpandTemplates to get from template to JSON for graph extension <graph></graph> tag. Documentation for extension is heremw:Extension:Graph and for Vega is here. You can test your code in Special:GraphSandbox --Pietrasagh (talk) 17:37, 12 August 2020 (UTC)

Wrong position of date label in type=stackedarea xType = date

Active cases vs recovered&deaths

Original xAxis lable positions is next: Active cases in hospital per day

185.66.253.38 (talk) 16:59, 7 August 2020 (UTC)

It is fixed in the latest module version. - Timbaaa -> ping me 01:54, 9 August 2020 (UTC)

Wrong position of date: Case 2

a) 20 apr both y1 and y2 is empty, so "20 apr" kick off from xAxis. (2 and 4 may too)
b) 31 jul only y1 is empty, so "31 jul" kick out to the end of xAxis. But all OK when empty only y2 (3 aug).

185.66.252.235 (talk) 12:32, 13 August 2020 (UTC)

Bar chart for this many data points is on border of readability.
To keep continuity of graph for dates with empty data you should use `0` instead of ` `. Space or no value after comma is interpreted as "no data point". With `ordinal` scale of x axis those dates are excluded from x axis.
I would suggest you to change type to `line` or `area`. You can get "bar-like" chart with option `interpolate=step-after'. Overlapping area charts can be formatted with transparency in `colors`. Other issue is formatting of x axis. To clear out axis ticks labels I would suggest to add option `xType =date` and change dates in `x` to ISO format. Date type x axis doesn't work for bar charts. Other solution is to split graph e.g. in half.
--Pietrasagh (talk) 09:31, 15 August 2020 (UTC)
Thanks, but I realy don`t need tech support with only chart. I just publish example chart which contains error.
Let me disagree with you cause "ISO 8601 is only specifying numeric notations and does not cover dates and times where words are used in the representation."(link) Most peoples in the world use "19 Aug", but not US "Aug 19" (just check all charts in "COVID-19_pandemic_in_..." pages).
Lets interpret "31 jul" not as date just text. Chart should save (!!!) order that user set and don't move anything to the end.
What I realy want with chart features is additional parameters "dontShow0" (in showValues) and "blankAs0" or "dontMissBlank" on axis. 185.66.252.235 (talk) 05:15, 19 August 2020 (UTC)
You can set the date format for the chart accordingly [1]

Multiple series should be should be made into single series as `field` to use in vega(on which the graph extension is built). While using `fold` property to do that(which reads series one after another and stores as single field with multiple values and corresponding labeld), series are read in order and stored in order of reading. In this case, y1 had `null` value on 31Jul, it is omitted while reading y1 and included when reading y2(which is read after going through all y1 values). That's why it is stored at last.This can be overcome by using |xType=date. Or, it will be considered as `ordinal` and plot as is stored.

Does this explanation good enough?

About What I realy want with chart features is additional parameters "dontShow0" (in showValues) and "blankAs0" or "dontMissBlank" on axis. can you elaborate? Are you suggesting to replace `null`s(black) to `0`? - Timbaaa -> ping me 03:12, 20 August 2020 (UTC)

Thanks, I've guessed so about vega, but let me be an ordinary user.
As a user I want chart with order of values that I gave in the fields (x=, y1=, y2=, etc) without axis modifications.
Chart should include showValues parameter (so it's type=rect only) and axe x could be not a date-type (just apple, peach, grape with numbers or not :-)).
Chart shouldn't display "0" values by showValues. (By the way, erasing all "0" came me to the bugs started this thread)
185.66.252.235 (talk) 10:57, 20 August 2020 (UTC)

type=rect

showSymbols with type=rect shift symbols

Graph with showSymbols= and type=rect parameters shift symbols right (examples [2], [3], [4], [5]).

185.66.252.235 (talk) 06:53, 19 August 2020 (UTC)

Case2 shift symbols down

Graph with showSymbols= and type=stackedrect parameters shift symbols down (examples [6], [7], [8]).

185.66.252.235 (talk) 06:53, 19 August 2020 (UTC)

Thanks for notifying, it is already being working on for the fix.- Timbaaa -> ping me 02:42, 20 August 2020 (UTC)
Scales for bar charts are a mess. I will disable symbols for bar graph for now. It will be possible in future with mixed types of charts (e.g. bar + line). --Pietrasagh (talk) 16:41, 20 August 2020 (UTC)

showValues and negative Values

showValues with type=rect always swow values up, but even value is negative (examples [9], [10])

185.66.252.235 (talk) 07:24, 19 August 2020 (UTC)

Do you mean the shown numerical values? If yes, i don't think it is possible in vega to have separate properties for individual values in a series.- Timbaaa -> ping me 02:40, 20 August 2020 (UTC)
Yeap. I'm not expert in vega, but it seems to be simplest operation change expression from
Position=Value+Offset to Position= Sign(Value)*(Abs(Value)+Offset).
Is vega calculating module let the same? 185.66.252.235 (talk) 10:57, 20 August 2020 (UTC)
It's not that easy. Offset is defined by graph module for whole chart. Vega (or D3) calculate position for each value. Maybe it would be possible to define offset in JSON as expression based on value of `y` but I'm not sure.
It's quite specific use of bar graph. Maybe it would be easier for you for define your own template with `<graph>` tag. You can make base JSON by expanding template for this chart and test changes in Graph Sandbox. For details please see other posts above. Procedure was already described somewhere above.
Other solution is to get rid of values labels. Many crowded bar graphs are almost unreadable. It makes values labels useless. Maybe change chart type to `area`, `interpolate=step-after` and `xType=date`. It looks similar to bar but axis ticks and grid is more readable. You have to change dates in `x` to ISO dates format YYYY-mm-dd. Also see above for examples--Pietrasagh (talk) 16:41, 20 August 2020 (UTC)

Repeated y-values

A recent updated has caused y-values to be repeated when the y-values only encompass a small range. An example can be seen at List of The Flash episodes#Ratings. A similar post was made at Template talk:Graph:Chart/Archive 1#y axis numbers go wrong for low integers without a fix, as well as at Template talk:Graph:Chart/Archive 1#X axis labeling bug with fewer than 8 items?, where the issue was with the |xType= parameter, and the solution was to use |xType=string. This doesn't work for |yType=. Can we either revert recent updates or get a fix for this, please? -- /Alex/21 05:50, 24 August 2020 (UTC)

Alex 21, Thanks for notifying, working on it. - Timbaaa -> ping me 07:03, 24 August 2020 (UTC)
Alex 21, Worked out a fix in sandbox. Does the test cases bar chart 2 solved the problem you posed? - Timbaaa -> ping me 07:38, 24 August 2020 (UTC)
Timbaaa, absolutely, works perfect. -- /Alex/21 09:37, 24 August 2020 (UTC)

@Pietrasagh: Take note of this discussion, update including this in next patch.- Timbaaa -> ping me 11:38, 24 August 2020 (UTC)

Encountering problem when saving, despite preview being fine

Allies to Axis GDP ratio between 1938 and 1945
 
Allies to Axis GDP ratio between 1938 and 1945.

I designed the graph at right for World War II to replace the static image below it. It worked fine in preview, but when I saved, it displayed a "file not found" icon with the rest blank (I'll see if it does the same thing here). I see in the preview here Note: In the editor preview the graph extension creates a canvas element with vector graphics. However, when saving the page a PNG raster graphics is generated instead. So I assume that there's some error happening behind the scenes. Help? {{u|Sdkb}}talk 20:45, 30 August 2020 (UTC)

Okay, so it's displaying fine here, even though I used the exact same code, so there must be something about World War II that's leading to this. Any thoughts? {{u|Sdkb}}talk 20:47, 30 August 2020 (UTC)
Graphs for preview and normal page are rendered in different way. Please see mw:Extension:Graph#Graphoid service. You have to patient little bit for graphoid service to create .png of new graph - it may take a while. Way graphs are rendered will change soon - see above Template_talk:Graph:Chart#Graphs_moving_to_client-side_rendering --Pietrasagh (talk) 11:26, 1 September 2020 (UTC)
Pietrasagh, so I can insert it, and just have to wait a bit and it'll hopefully render? Okay, I'll try that. {{u|Sdkb}}talk 16:54, 1 September 2020 (UTC)

Vertical lines in Wikipedia charts

Hi, I am trying to plot a line graph using this Template. Is there a way to draw vertical and horizontal lines(Not the grids) parallel to axes?Timbaaa (talk) 15:56, 18 April 2020 (UTC)

As someone who's currently working on election result graphs for Canadian constituencies, it would be nice if I could use this as a label for when a redistricting happens. Username6892 16:31, 19 April 2020 (UTC)

It may be possible in near future. Vega engine standing behind Graph:Chart template module allow to put any symbol mark (defined by svg path). As you can see on my example above on the right you can put banana as symbol so vertical or horizontal line should also be possible. Example is generated by sandbox version of module under development. In current version of module to have horizontal line you can add data series with constant value.
{{Graph:Chart | x = 1,2,3,4,5 | y1 = 2,4,0,1,3 | y2 = 2, , , ,2 }}
Thanks for your response, I will be waiting for those vertical lines.Timbaaa (talk) 10:15, 22 April 2020 (UTC)
Timbaaa, have you seen this? https://www.mediawiki.org/wiki/Extension:Graph/Demo/falkensee . Does not use this template, tho. HLHJ (talk) 03:17, 23 April 2020 (UTC)
@HLHJ: Thanks, I'll try using it. Looks frightening tho. :( Timbaaa (talk) 03:52, 23 April 2020 (UTC)
Timbaaa: It isn't the friendliest UI. You could cut-and-paste the whole thing into the sandbox here and change it incrementally. HLHJ (talk) 15:07, 23 April 2020 (UTC)

@HLHJ: Yes, thats what in doing in my user sandbox. Timbaaa (talk) 01:48, 24 April 2020 (UTC)

There's new template feature as solutions for this request:
  • Annotations
    • vAnnotatonsLine and hAnnotatonsLine: display vertical or horizontal annotation lines on specific values e.g. hAnnotatonsLine=4, 5, 6
    • vAnnotatonsLabel and vAnnotatonsLabel: display vertical or horizontal annotation labels for lines e.g. hAnnotationLabel = label1, label2, label3
Many thanks to Timbaaa for contribution
--Pietrasagh (talk) 17:52, 1 September 2020 (UTC)

Graphs moving to client-side rendering

As part of the architecture and overhead cleanup of MediaWiki, graph rendering will be deprecated from server-side and moved to client-side rendering. This change will largely only affect users with Javascript disabled; users will have to change their browser setting (if possible) to allow Javascript in order to properly render the graph.

There is no further action required by the community as this change does not affect the code to write graphs. This change should be deployed within the next few weeks, I'll keep the community updated when we get closer to the change-over date. Keegan (WMF) (talk) 20:37, 11 May 2020 (UTC)

@Keegan (WMF): Are the individuals responsible for this decision aware that circumstances on the English Wikipedia have recently-ish changed somewhat, such that many of the most-viewed articles on the site now use graphs? (Eg the Covid-19-by-country articles, many of which have 6 or 7 graphs and have been getting many millions of views.) The impact of the delayed rendering would likely be quite considerable. --Yair rand (talk) 21:26, 11 May 2020 (UTC)
@Yair rand: Everyone is aware of the importance of the Covid-19 graphs; there's separate work going on to shore up part of the graphs infrastructure to support this wide-scale use. As it relates to this change, the results to the end user should be an improvement from the current graph experience. Keegan (WMF) (talk) 16:54, 12 May 2020 (UTC)
If my theory is true (see below), clientside rendering will greatly improve the reading experience, and that might very well be why this change is happening. I doubt clientside rendering will be very slow. An easy way to test it is to preview any section containing a graph. What you see is a canvas element, not an image. Depending on how big the graph is, it might actually be faster to display clientside. MusikAnimal talk 21:36, 11 May 2020 (UTC)
@Keegan (WMF): Does this mean we get nice, crisp graphs rather than the blurry dithering that we see now? Also what about fetching data from a .tab file on Commons -- will it re-fetch the data more quickly? I ask because when we preview an edit, the graph is rendered clientside and it doesn't have the aforementioned problems. It's only post-save that it looks blurry, and Commons updates take up to 24 hours to show up (!!). Thanks for the update, MusikAnimal talk 21:29, 11 May 2020 (UTC)
For the first question, that's one end goal - clean, crisp, quickly rendered graphs. As to the question about .tab files, I don't know right now. I'll see what I can find out. Keegan (WMF) (talk) 16:54, 12 May 2020 (UTC)

@Keegan (WMF): will this help fix the issue discussed on the section above ? --Hagnat (talk) 18:50, 13 May 2020 (UTC)

I do not think so, as those look like problems coming from the Graph extension itself. This only regards where the graph renders. Keegan (WMF) (talk) 17:10, 15 May 2020 (UTC)

@Keegan (WMF): if you don't mind, could I have an update on this? Also looking forward to crisp graphs; currently legibility is poor. ɱ (talk) 02:16, 25 October 2020 (UTC)

@: apologies for the delay in replying, I was finding out the answer. Undeployment from enwiki will likely not take place until some point after December. At this point there's no firm date, but there should be at least two weeks' notice at minimum once it is decided when to proceed. Keegan (WMF) (talk) 18:13, 19 November 2020 (UTC)

Lots of JS errors

See Special:Permalink/1000499955#Data. The errors persist even when I turn on safemode. The full stack trace, with debug turned on:

Extended content
Uncaught TypeError: func is undefined
    itemBounds jQuery
load.php:630:859
    jQuery 2
    forEach self-hosted:206
    jQuery 5
    recurse self-hosted:1161
    jQuery 30
    runScript https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:13
    execute https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:14
    doPropagation https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:7
    (Async: requestIdleCallback handler)
    requestIdleCallback self-hosted:1161
    requestPropagation https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:7
    setAndPropagate https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:8
    implement https://en.wikipedia.org/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:20
    <anonymous> jQuery

I'm doing something wrong with the template, right? Enterprisey (talk!) 10:08, 15 January 2021 (UTC)

Seems like if you rearrange the parameters, you get really weird errors? Enterprisey (talk!) 10:18, 15 January 2021 (UTC)
Yeah, in the bar graph example, moving the type=rect parameter up to just after the width and height parameters will crash: Special:Permalink/1000503424. Enterprisey (talk!) 10:27, 15 January 2021 (UTC)
In both examples you are using wrong type of graph. type=bar is not correct, please use type=rect instead. Pietrasagh (talk) 11:40, 24 January 2021 (UTC)
Indeed. Wonder how I missed that. Enterprisey (talk!) 20:15, 24 January 2021 (UTC)

Using data from commons .tab file

How should one use this graph, where data is provided by the commons .tab file?- Timbaaa -> ping me 02:26, 14 July 2020 (UTC)

Acc. to mw:Help:Tabular_Data#Usage .tab data should work directly with <graph> of mw:Extension:Graph. I tried to find good example here and found this. There's is also Template:Graph:Lines that use <graph> and Wikidata Query Service directly. If you will figure out how to define it nicely in JSON I cant try to implement it in module and template. --Pietrasagh (talk) 14:34, 1 September 2020 (UTC)
I used Template:Graph:Lines for it. I don't remember the exact the reason why I asked this question. Here's an example
See or edit source data.
JSON expansion
Extended content
{ "version": 2, "width": 900, "height": 400, "padding": "strict", "signals": [{"name": "rightwidth", "expr": "width + padding.right"}], "data": [{ "name": "chart", "url": "tabular:///COVID-19 cases in Tamil Nadu.tab", "format": {"type": "json" , "property": "data" , "parse": {"date": "date"} }, "transform": [ {"type": "formula", "field": "_xfield", "expr": "datum.date" } , {"type": "sort", "by": ["_xfield"]} , {"type": "fold", "fields": ["activeCases"]} , {"type": "formula", "field": "_yfield", "expr": "datum.value" } ] }, { "name": "labels", "url": "tabular:///COVID-19 cases in Tamil Nadu.tab", "format": {"type": "json", "property": "fields"} } ], "scales": [ { "name": "x", "type": "time", "domain": {"data": "chart", "field": "_xfield"}, "range": "width", }, { "name": "y", "type": "linear", "range": "height", "domain": {"data": "chart", "field": "_yfield"}, }, { "name": "color", "type": "ordinal", "domain": {"data": "chart", "field": "key"}, "range": "category10" }, { "name": "labels", "type": "ordinal", "domain": {"data": "labels", "field": "name"}, "range": {"data": "labels", "field": "title"}, } ], "legends": [{ "fill": "color", "stroke": "color", "title": "Legend", "properties": { "labels": { "text": {"scale": "labels", "field": "data"} } } }], "axes": [ {"scale": "x", "type": "x", "tickSizeEnd": 0 , "ticks": 7 , "title": "Date" , "grid": true }, {"scale": "y", "type": "y", "tickSizeEnd": 0 , "title": "Count" , "grid": true } ], "marks": [ { "type": "group", "from": { "data": "chart", "transform": [{"type": "facet", "groupby": ["key"]}] }, "marks": [ { "type": "line", "properties": { "enter": { "y": {"scale": "y", "field": "_yfield"}, "x": {"scale": "x", "field": "_xfield"}, "stroke": {"scale": "color", "field": "key"}, "interpolate": {"value": "monotone"}, "strokeWidth": {"value": 2.5} } } } ], } ] }

Timbaaatalk 14:48, 1 September 2020 (UTC)

There is other template de:Vorlage:WikidataChart and module that uses de:Modul:Graph code and support easy Wikidata queries. It should be easy to integrate other existing options from Template:Graph:Chart. Funny thing is that it's exclusively used only in articles about chess players, churches and political parties --Pietrasagh (talk) 16:34, 1 September 2020 (UTC)
Unfortunately, Template:Graph:Lines doesn't allow the same formatting. It would be great to be able to switch directly from embedded data to Commons (or maybe even Wikidata) data. The RedBurn (ϕ) 09:32, 21 February 2021 (UTC)

xAxisMax

Could some guidance be provided in the template documentation on how xAxisMax is calculated for dates in line graphs? I have just fixed the graph at 2016 Peruvian general election#Presidential election by trial and error as I have no idea how the figure input (1460000000000) corresponds to what the end date of the graph is (something around 7 April 2016). Cheers, Number 57 12:52, 19 February 2021 (UTC)

Actually 0:00 on 7 April 2016 should be 1459980000 ;-). Value is Unix time - number of seconds since 01 January 1970. As mentioned in other sections above Vega framework used for graphs on Wikipedia is based on outdated version 2. In this version it doesn't accept time format for xAxisMax. Pietrasagh (talk) 15:11, 21 February 2021 (UTC)

xAxisMin and xAxisMax

Hi,

@Snaevar: mentioned (at the very bottom) that "xAxisMin does support using the timestamp, not an formated date". I tried different types of timestamps but couldn't find one that worked, what is the actual format?

Example with xAxisMin = 1586037600:

The RedBurn (ϕ) 22:46, 28 February 2021 (UTC)

At Template:COVID-19 pandemic data/United Kingdom new cases by day reported chart, I'm struggling to get the x-axis to cover more than 1 whole year- tried expanding size, removing 'direction: rtl;', inserting extra commas after x & y data sets, but no fix because problem seems related to it only wanting to show one year's worth and the first date was 28 Feb last year... if I introduce |xaxismin/ max it just wraps around- there's probably a trivial fix but I can't find it... TIA, Yadsalohcin (talk) 02:34, 1 March 2021 (UTC)

Slept on it- of course it's trivial, we haven't included the year in the dates, so naturally it's wrapping around... Yadsalohcin (talk) 09:12, 1 March 2021 (UTC)
PS regretfully, in my experiments to fix this I could shed no light on the Xaxismin/ timestamp issue. Rgds, Yadsalohcin (talk) 09:15, 1 March 2021 (UTC)

Not visible in PDF version

The Graphs don t appear in the PDF Version. Is this a known problem and is there any solution? Yomomo (talk) 21:20, 27 May 2021 (UTC)

Needs table attribute

I am working on graphs for opinion polling. The problem is I have two options: either I use Graph:Chart but I have to store all the data within the graph (as in here), or I use Graph:Lines but I can't have individual dots for individual polls (as in here, and I'm not sure the basis interpolation works well either). Can it please be possible to use Commons tabular data for this template (at least for scatter plots)? Julio974 (Talk-Contribs) 17:24, 12 March 2021 (UTC)

Current version of Template:Graph:Lines doesn't show symbols and not allow to change interpolation. Please test your graph with Template:Graph:Lines/sandbox with additional parameters | interpolate = bundle | symbols = 1. For just scatter plot without lines you can use linewidth = 0. If you like it I will push changes form sandbox. Pietrasagh (talk) 12:29, 22 May 2021 (UTC)
After some testing it looks like it is working perfectly, you can push the changes, thank you for your help! Julio974 (Talk-Contribs) 20:47, 22 May 2021 (UTC)
  DonePietrasagh (talk) 15:44, 23 May 2021 (UTC)
After using it for a while, there are a few problems with using Graph:Lines instead of this, mostly with the symbols or the layout. I think these problems need to be adressed by allowing this module to pull data directly out of tabular data files from Commons. Julio974 (Talk-Contribs) 06:58, 1 July 2021 (UTC)

showvalues configurations

The configuration options for showValues (format, fontcolor, fontsize, offset, angle) do not appear to be working for pie charts. Or maybe just the documentation is so terrible I'm not doing it right. Either way, something needs to be fixed. {{u|Sdkb}}talk 02:52, 21 July 2021 (UTC)

Ah, finally figured it out. I updated the doc (which was way too hard to find itself) to reduce the suffering of those who come after. {{u|Sdkb}}talk 03:07, 21 July 2021 (UTC)

Line breaks in graph legends

Is there any way to force a line break in a graph legend? The normal br html and {{br}} both don't work. {{u|Sdkb}}talk 03:54, 28 July 2021 (UTC)

@Sdkb: Pretty sure it's not possible, and even if it were possible, you wouldn't want to because it wouldn't push the following item downward so you'd have overlapping/overlayed text. --Yair rand (talk) 06:24, 28 July 2021 (UTC)
Ack, that's unfortunate. This feature still has a ways to go. Thanks for the response, though. {{u|Sdkb}}talk 06:51, 28 July 2021 (UTC)

Standard chart width?

Is there a standard (MOS) way to specify graph chart width? specifically defining the pixel width doesn't seem like the best approach, is there a way to do it that aligns to WP:IMAGESIZE? Aeonx (talk) 03:56, 5 August 2021 (UTC)

Tooltip

Has anyone succeeded in, when hover, showing a tooltip with the value? Bouzinac (talk) 21:56, 23 May 2021 (UTC)

@Bouzinac, that would be really nice to have. {{u|Sdkb}}talk 02:53, 21 July 2021 (UTC)
It would be possible to edit this template so that this is an option. (Assuming we're talking about tooltips like this, and not the native tooltips like we have for links.) I don't know if we'd want this on by default, though. Maybe a flag. --Yair rand (talk) 06:32, 28 July 2021 (UTC)
I would say yes, have it on by default. Defaults are powerful, and tooltips are a clear plus. {{u|Sdkb}}talk 06:51, 28 July 2021 (UTC)
Is this feature on its way?   --Bouzinac (talk) 22:01, 31 August 2021 (UTC)

Reading from Wikidata?

 

Template:Graph:Lines does have support for getting the data from Wikidata, using the tabletype and table parameter. It would be great if Template:Graph:Chart would support this, so we use direct querying instead of just providing x and y values. Direct proposal: replace images like the one on the left with a datadriven alternative. I realise that a higher density of values in recent years might result in an unbalanced presentation, but other usage can be better of. Thanks, RonnieV (talk) 15:22, 4 June 2021 (UTC)

Hi RonnieV, shouldn't this template be doing the job  ? --Bouzinac (talk) 22:07, 31 August 2021 (UTC)

Partially changing the scale of the x axis?

In the above, most of the values only changed once during the year, however in 2013 and 2014, the values changed multiple times. Is there any way to elongate just those sections of the x-axis to make those data points more readable? --TorsodogTalk 03:36, 6 August 2021 (UTC)

You can use graph as above. xType have to be string. To avoid "natural" sorting of x values I added "." to dates without month and day. This is ugly hack but outdated Vega 2.0 framework used by this template doesn't allow arbitrary sorting of axis values. --Pietrasagh (talk) 06:29, 25 September 2021 (UTC)

Controling significant figures when using showValues in a pie chart

I think the ability to show values (as percentages) on the pie chart is very handy, but the default setting for showValues=format:% is for 6 significant figures, which is rather excessive. I've been fiddling around for the last half hour and I can't find a solution. Could anyone help? --Project Osprey (talk) 12:40, 5 October 2021 (UTC)

@Project Osprey: Use the precision indicator before the "%" in the format. For example, format:.0% would show zero figures after the decimal point, format:.1% for 1 figure after the decimal point, etc. --Yair rand (talk) 17:50, 5 October 2021 (UTC)
Thanks. I tried so many combinations trying to get to the bottom of that. Any objection with me adding a note to this effect at Template:Graph:Chart/doc? Pie charts are best suited to descibing percentages after all, so this may come up again. --Project Osprey (talk) 18:15, 5 October 2021 (UTC)

Titles

Would it be possible to add a | Title = option so that the graphs can be labeled? --Project Osprey (talk) 15:46, 8 October 2021 (UTC)

:32 values in X axis?

Can anyone here explain why the graph in the South Carolina article's Demographics section, displays ":32" for the last three values along the X axis? I'd like to correct this if possible. Thanks —ADavidB 16:30, 23 October 2021 (UTC)

Tick density

Is there a way to set tick density on a Graph:Chart line graph? Or is the best bet to use Template:Graph:Lines? For context, I'm looking to have fewer ticks on Template:WikiProject Anarchism cleanup issue graph, e.g., one for the start of each year or even quarters and if I set |xAxisFormat= to just "%y", I get a bunch of ticks that repeat the year. (not watching, please {{ping}}) czar 00:18, 25 October 2021 (UTC)

Code

Hi, I'd just like to copy the template and its subpages code to lt wiki, how can I access the code (read only mode)? Also, could someone give me some tips in regards to localization - setting thousand and decimal separator characters, etc. Wolfmartyn (talk) 22:03, 28 November 2021 (UTC)

Hi Wolfmartyn (talk · contribs), just check here https://lt.wikipedia.org/wiki/%C5%A0ablonas:Graph:Chart . --Bouzinac (talk) 22:53, 28 November 2021 (UTC)
That's perfect - thanks.Wolfmartyn (talk) 23:35, 28 November 2021 (UTC)

Line styles in line charts

Is doing a dotted, dashed and a combination of those possible? Howard the Duck (talk) 11:40, 19 October 2021 (UTC)

@Howard the Duck: Not currently with this template, no. It would be possible to add this feature to the module, using the strokeDash parameter in the marks, though.
(Bit of a tangent, but I think part of what stops people from adding certain features to this template might be hesitancy to fiddle around with the template parameters, to avoid having a giant mess of piecemeal-added disorganization that's hard to fix. I wonder if we should just hold a big "what are all the somewhat useful things it would be good to have in this template?" discussion (maybe an RfC, even), and then figure out a way to have a reasonable number of easily usable parameters to accommodate them all. Currently, there's no specification to work towards or anything.) --Yair rand (talk) 17:49, 19 October 2021 (UTC)
Yes, that'd be great. I can also see you can customize plot points too, so you can make multiple series with the same color, but different line style plot points.
As for adding features, sometimes, people don't know it, and yes, people don't want to screw up the template. You guys can do an RFC, as that gets to be binding in the end. Howard the Duck (talk) 14:31, 21 October 2021 (UTC)
Some time ago I added few features to module used by this template. Some of them were my ideas based on problems to make graphs look as I wanted. Most of my word was useless because almost nobody use those features. Basic problem is outdated (current versions is 5.3, Mediawiki uses version 2) Vega framework working in background. Many problems with this template is solved and many requested features can be added without much effort in new Vega (and VegaLite). There's not much sense to do fight with outdated code. When hardcore developers of MediaWiki will update extension code large part of underlying module will have to be rewritten for new Vega anyway.
Please push developers to update the code on Phabricator T165118 or contact main developer directly. Development had stuck since May 2019. If you (anyone) know JS and/or PHP please help. Pietrasagh (talk) 10:33, 28 December 2021 (UTC)

Typo of parameter

Greeting. There seems to be typing mistakes over parameters of "vAnnotatonsLabel" and "vAnnotatonsLine", which should be "Annotations" instead. May this be therefore amended? Thanks. ~~ J. Dann 12:29, 1 September 2022 (UTC)