Extension talk:Graph

Block limitations
It seems that the block now is being spreaded to all width of content of the page. Thus in current page state it also covers the space above infobox and thus infobox's links to uncollapse hooks and the link to twn are unclicable. --Base (talk) 15:58, 29 September 2014 (UTC)
 * Base, I am not sure what you mean. --Yurik (talk) 10:59, 18 May 2015 (UTC)

Map distortion
Why is every continent except Africa & South America all squashed in the map tool? All this political correctness is going too far—Kelvinsong (talk) 21:23, 13 May 2015 (UTC)
 * No idea what you mean - I am using a standard Mercator projection on top of a known file. If its incorrect, please find another topojson world map (size-optimized to 2nd floating digit), and upload. I don't think this has anything to do with PC :) --Yurik (talk) 10:49, 18 May 2015 (UTC)
 * Kelvinsong: correction, the same map data can be used, you simply need to specify a different projection parameter. See example at de:template:Graph:Map. --Yurik (talk) 14:16, 20 January 2016 (UTC)

2015-05-14 Tech talk notes
-- SPage (WMF) (talk) 21:23, 14 May 2015 (UTC)
 * Word cloud is coming, needs to be deployed.
 * A separate Graph namespace turned out not be useful, because you can't put template stuff in a strict JSON file. It's better to make graphs as MediaWiki templates, where you can have headings and additional info outside the  tag, and template expansion within it.
 * en:User:Milimetric/MinardNapoleon is a famous graph recreated using uwdata's lyra to generate the JSON for Vega graph description.
 * no standards for graph layout, we need lots of MediaWiki templates for standard graph types, Lua modules for typical transformations, etc.
 * All API calls return JSON. Problem is we don't let Graph extension/Vega run arbitrary JavaScript transforms on-wiki. Meanwhile Lua modules on-wiki can do data transforms, but are not able to make API call (yet).
 * Slides from the talk are here
 * Made a few minor corrections. --Yurik (talk) 10:51, 18 May 2015 (UTC)

Bug?

 * Hello, as this function was originally deployed it allowed a certain level of visually appealing interactivity when hovering over items. This is still the case for me when I go directly to Extension:Graph/SampleGraph. However, it is no longer true when I use a graph anywhere else on-wiki. Specifically, in this week's Signpost the  trigger was working correctly when the story was being drafted, but broke sometime before publication. I have checked with some other editors and they report the same.

The interactivity is what makes the extension in the first place&mdash;static data can be represented only very slightly worse with images. Resident Mario (talk) 05:05, 17 May 2015 (UTC)


 * The hover only works when the graph is rendered on the client. Sadly, this was very slow, since it required MediaWiki to download d3 and vega libraries, plus all the external data needed by the graph. This could be over 1MB uncompressed. Instead, now graphs are rendered on the server, which makes them significantly faster, but do not allow for the hover effect. The power of graphs is not in their hover effect, which is a sugar coating. The power is in the fact that now you can have data stored on wiki, and update that data at any point to update the graph. You never need to generate maps or graphs in a 3rd party program like Draw/Excel/OpenOffice/etc and upload the results - if you do that, no one else except the original author can easily modify the picture - they would have to recreate the whole source file. Now, anyone can change the source of data for the map/graph to reflect the change. --Yurik (talk) 10:58, 18 May 2015 (UTC)
 * Sugar-coating? Yes; perhaps. But it's important sugar-coating because it introduced an entirely new element of interactivity, however surface, into Wikipedia software, and so I am very sad to see it gone. It felt like something fresh and new, but now that feeling is lost to me... Resident Mario (talk) 04:50, 21 May 2015 (UTC)
 * "hover effect" is only sugar coating. BUT, fear not, something much bigger is in the pipeline - take a look at the interactive examples of Vega 2 in http://vega.github.io/ - I plan to bring them over fairly soon, most likely in the "click to play" mode - you see a static image, you click on it, and it turns into an interactive graph, which will also have hover effect ;) --Yurik (talk) 09:32, 21 May 2015 (UTC)
 * Oooooh! That is really something! Resident Mario (talk) 01:44, 22 May 2015 (UTC)
 * If the issue is speed, perhaps it would be possible to first load just the simple image, and then automatically replace it later with the full interactive graph after the full set of libraries and data load? And maybe that could also be used for real interactivity, instead of the "play" buttons currently shown in the demos? --Yair rand (talk) 06:13, 20 January 2016 (UTC)
 * the play button simply indicates that the graph is interactable - you can drag things around, hover over elements, etc. Play button is the closest to the "interactable" icon I could think of. And yes, show the image + load the data afterwards automatically has been considered - perhaps we could make it an option for the users for now, I just feel it is a bit wasteful bandwidth wise, especially on the mobile devices. Still on the fence on this one. Please consider filing a task in  - this way we can track and discuss it there. Thanks! --Yurik (talk) 14:12, 20 January 2016 (UTC)
 * Done: T124254. --Yair rand (talk) 00:01, 21 January 2016 (UTC)

Image marks only working in preview
Well, subj! Graphs with images work perfectly well in preview, but break the extension after saving. It seems to be entirely graphoid's fault.

E.g. en:User:Primaler/Graphs:
 * preview mode uses canvas and shows the two graphs with images,
 * but in regular mode graphoid throws a 503.

Primaler (talk) 23:19, 21 May 2015 (UTC)
 * , thanks for reporting! One thing to note - phabricator is a much better way to report bugs - more people will notice. I created T99994 --Yurik (talk) 02:45, 22 May 2015 (UTC)
 * the image issues have been fixed, please take a look, and also check vega2 on demo page. --Yurik (talk) 14:14, 20 January 2016 (UTC)

Image paths
On a related note, Graph only works with static image urls. So, in the example above one of the urls looks like this: " http://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Det_Radikale_Venstre_logo.svg/200px-Det_Radikale_Venstre_logo.svg.png ".

This is — how should I put it — not ideal %)

What is the intended work-around?

Oh! On pressing google a bit harder, I've just found the filepath keyword, substituting that awful url for " ". Magic words are scary, so enwiki also has a wrapper template: "".

Still, this trick would not work e.g. for paths stored in a separate csv file. And with function transform understandably disabled, one would probably need to resort to some Lua magic (as if wikitext and json were not enough for one task).

On the other hand, the extension only works with local data anyway. May be you could enable automatic filepath extraction server-side, then? Semantics-wise, it would certainly be in keeping with how most other image-related features work here.

Primaler (talk) 01:28, 22 May 2015 (UTC)
 * , not exactly sure of how to solve this best. I was contemplating custom protocols, e.g. article://Article_name, but haven't really thought about images yes. Please add a task to the phabricator - this way everyone interested in graphs can discuss it and come up with a good solution. Thx! --02:53, 22 May 2015 (UTC)

Please help with a grouped bar chart
Hi, I have looked at Lyra, but I don't know how to approach this kind of bar chart layout. Would someone please help? I am guessing it has to be done outside Lyra, but I can't see how from the tutorial or, either. EllenCT (talk) 16:43, 24 May 2015 (UTC)
 * There is a very similar "grouped_bar" example here. Primaler (talk) 20:46, 24 May 2015 (UTC)
 * Fixed link (a little trick there :). --Yurik (talk) 21:47, 24 May 2015 (UTC)
 * Thank you both. I was having trouble earlier because I couldn't find http://trifacta.github.io/vega/data/groups.json (why is it in vega/data instead of vega/editor/data?) and I would still like to know how to make it horizontal. EllenCT (talk) 04:55, 27 May 2015 (UTC)

Wikilink in graph
Is possible to insert wikilinks in graphs header or legend labels ?--Moroboshi (talk) 07:39, 21 July 2015 (UTC)
 * Not at this point. I am still thinking of how to do it better, or if at all (you can already use html tricks to overlay the image with a clickable map or link). Once we have interactive graphs, there might be some clickability there, but again, it will need to be discussed. I wouldn't want the user to click the image just so that it loads all javascript and data required to render the graph client side, only so that the user can click the link and navigate away. Seems wasteful. --Yurik (talk) 15:40, 21 July 2015 (UTC)
 * Update: I think this should be done via switching Graphoid to SVG.  T96309. --Yurik (talk) 14:06, 20 January 2016 (UTC)

Seeking help moving away from Wikipedia template:Line chart
Last year I added several dozen line charts to Wikipedia based on US Department of Labor OLMS reports covering union membership and finances using Template:Line chart. However, the process of gathering the data (their database is awful) and reformatting it (the template has many limitations) was so exhausting I gave up for a year. I'm now looking to update and to continue this effort, and this new method might make the process much easier and result better, but converting it seems overwhelming.

I put the details of the project on my Wikipedia talk page.

It's a big project and I bit off more than I could chew. Any help would be appreciated and would benefit dozens of articles. Djr13 (talk) 08:48, 7 October 2015 (UTC)
 * Djr13, have you seen the w:Template:GraphChart? It might be possible to convert parameters of your template to use that other one, and also put a big note saying that the template is obsolete and users should move to the new one? I will try to find some time to work on this, but it might be a bit tough - I am trying to get graph extension to the new interactive version of vega, see samples here --Yurik (WMF) (talk) 04:44, 13 November 2015 (UTC)
 * Sorry I had not responded, I am rarely on this wiki and in general had not been editing much over the winter. I did see that template before, and I notice I mentioned it on my talk page, but honestly it has been such a long time since I created these graphs that I will need to relearn how to code them anyway. Really, I think a good starting point would be to have a sample of a graph that accomplishes what is needed for the usecase and looks relatively attractive for the large number of articles it will be in. I hoped I could somehow separate the graph formatting, and even the graph data, from the article space to make it more manageable. JSON seems to open a big opportunity there, but I wouldn't know where to start. One big problem for me is that the OLMS website is very inaccessible, so I am forced to collect and arrange data somewhere, which I wish could be online. Djr13 (talk) 15:44, 5 February 2016 (UTC)

upgrade vega1 to vega2
I'm trying to install the master release on MW26 I've got the following error : Call to undefined method XCacheBagOStuff::makeKey Using the mediawiki-extensions-Graph-REL1_26 is working fine but only vega1 json format working. Any idea ?