Mobile app version of vmapp.org
Login or Join
Caterina187

: In MediaWiki can external data be rendered into a chart? I've got the extensions ExternalData and GoogleCharts installed. Can External data (e.g., the result of a SQL query from a database) become

@Caterina187

Posted in: #Mediawiki

I've got the extensions ExternalData and GoogleCharts installed.

Can External data (e.g., the result of a SQL query from a database) become the numbers for a chart (via any extension e.g. for GoogleCharts)?

Can you point to any page on a wiki that shows the syntax?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Caterina187

1 Comments

Sorted by latest first Latest Oldest Best

 

@Speyer207

Yes. This worked on a local wiki (so no URL available, sorry).

First add to LocalSettings.php

$srfgFormats[] = 'googlepie';
$srfgFormats[] = 'googlebar';


In the wiki, create a property of type page called Id Field in List.

Then in the page where you want to show the data:

{{#get_db_data:
db=data
|from=MyTable as I
|where=1 GROUP BY MyField
|limit=999
|order by=COUNT(*) DESC
|data=Field=MyField,count=COUNT(*)
}}


Store the data

{{#store_external_table:Is Field in List |Has field={{{Field}}} |Has count={{{count}}}}}


Display the stored data excluding the first column as a table

{{#ask:[[Is Field in List::{{PAGENAME}}]]|?Has field=Field |?Has count=Count |format=table|mainlabel=-}}


Display the stored data excluding the first column as a googlebar

{{#ask:[[Is Field in List::{{PAGENAME}}]]|?Has field|?Has count|format=googlebar|mainlabel=-}}


Display the stored data excluding the first column as a googlepie

{{#ask:[[Is Field in List::{{PAGENAME}}]]|?Has field|?Has count|format=googlepie|mainlabel=-}}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme