The support for the evaluation of nested plugins opens the door for charts and graphs with dynamic data.
A great "data generator" is the JavaScript evaluator plugin JSPlugin. Note that you will need to use the parameter setting scriptResult=xml to generate raw data instead of HTML (the default).
The next example uses a nested call to JSPlugin to create a simple Bar Chart of strings and their lengths:
[{ BarChartPlugin title='Name Lengths' [{JSPlugin scriptResult='xml' var countries = new Array("Norway", "France", "Denmark", "Venezuela"); var result = ":Country|String, Value\n"; for ( i = 0; i < countries.length; i++ ) { result += countries[i] + ", " + countries[i].length + "\n"; }; result; }] }]
This example uses the JSPlugin interface to the wiki internals to generate a Pie Chart with the aggregation of recent changes per author.
[{ PieChartPlugin title='Recent Changes By Author' [{JSPlugin scriptResult=xml var myDate = new Date(); myDate.setDate(myDate.getDate() - 30); result = ""; authors = new Array(); for ( i = wikiInfo.pages.iterator(); i.hasNext(); ) { page = i.next(); if (page.getVersions().size() > 0) { version = page.getVersions().get(0); pageJavaDate = version.getModified(); pageDate = new Date(); pageDate.setTime(pageJavaDate.getTime()); if (pageDate > myDate) { if (! authors[version.author]) { authors[version.author] = 1; } else { authors[version.author] += 1; } } } } for (author in authors) { result += author + ", " + authors[author] + "\n"; } result; }] }]
Add new attachment
Only authorized users are allowed to upload new attachments.
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
png |
Name Lengths.png | 6.3 kB | 1 | 08-Aug-2006 20:29 | Nascif Abousalh-Neto | |
png |
Recent Changes By Author.png | 17.7 kB | 1 | 08-Aug-2006 20:30 | Nascif Abousalh-Neto |