SMW D3 charts

From semantic-mediawiki.org

Hi James - I'm following up on: http://semantic-mediawiki.org/wiki/Help_talk:D3_chart_format Do you know of any extension or output format to integrate D3 with SMW? Thanks!

19:08, 31 August 2012

Since I'm the only one who is driving the integration between D3 and SMW/SRF, I can say that currently available are two chart types as explained here and will be released as part of SMW/SRF 1.8. (A preview of the code is available here.)

Those two implemented chart/graph types are using the SMWAggregatablePrinter class with values defined as a simple array of [label, value] pairs which means that as for the moment data series are not possible and not planned. D3 chart corresponds to a similar approach held by jqplotchart/jqplotseries

One reason why D3 chart is released with SRF 1.8 is to show how easy the integration between D3 and SMW/SRF is achieved and allow access to chart types that yet have not been available.

I do think the available examples are self-explanatory and easy to understand (I tried to make comments where necessary) and I would encourage anyone with a vital interest in making this integration work to coordinate efforts.

D3 graph[edit]

A more comprehensive and elaborate integration is planned with D3 graph (which I have no idea when I have time to work on as part of the SRF D3 integration). Some preliminary notes on D3 graph can be found [1], [2] but I'm sure the uploaded examples won't work because during now and then I had to change the data model and the SMWResultPrinter class has changed as well.

Wordcloud[edit]

Another example that uses D3 in connection with SMW/SRF 1.8 is wordcloud which is part of the tagcloud format.

See also[edit]

Data visualization

20:35, 31 August 2012

Thanks for the tips, looks like a promising start. Good luck!

04:11, 1 September 2012
 

Just throwing my 2 cents in here. I can imagine being able to store D3 javascript straight into a wiki page (say, "myD3.js") and then using it like so:

 {{#ask:[[Category:MyCat]]
 |?#
 |?myProp
 |format=myD3.js
 }}
22:48, 29 January 2013

As for SMW/SRF this will not be the way we will handle JavaScript. We will always separate wiki content from "printer" logic and when looking further into the future, being able to separate user actions from wikipage actions is required in order to allow independent user actions (unrelated to the stored wikipage) to be handled by a JavaScript module.

As a side note, storing JavaScript in wikipages (as side the ContentHandler in MW 1.21 or GadgetModule) should be avoided because it can create security vulnerabilities.

23:59, 29 January 2013

Ah. I'm not at all familiar with the inner workings of SMW, etc. Let me back up a step then. Mike Bostock's gallery (https://github.com/mbostock/d3/wiki/Gallery) has a lot of really nice examples of d3 in action, most of which can serve as a basis for building one's own visualizations; what do you see as being the simplest way of using one of those to create a new d3chart charttype ?

Thanks, Andrew

17:38, 30 January 2013