: 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
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?
More posts by @Caterina187
1 Comments
Sorted by latest first Latest Oldest Best
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=-}}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.