User Tools

Site Tools


Sidebar

DokuWiki plugins

There are DokuWiki plugins for research & education which I developed. All plugins are under GPL2 license, so feel free to use them in your DokuWiki.

Dokuwiki Official

Scientific plugins

DokuWiki plugins for bioscience and biotechnology.

General plugins

chart_plugin

Chart Plugin

:!: This plugin is no longer maintained. :!:

This DokuWiki plugin creates a chart in a DokuWiki page by using XML/SWF Charts. XML/SWF Charts is a Flash application that creates various charts of nice appearance.

<chart computer:en:chart_example.xml 200 180 chart FFFFFF RIGHT></chart>

The XML/SWF Charts reads XML file that contains the data and the styles of appearance. You can directly edit the XML contents by using this plugin as you edit Wiki page. This plugin also supports reading static xml files for the XML/SWF Charts.

for XML/SWF Charts ver 4.x

Downloadchart.zip (170.5 KB)2008-03-22

:!:This plugin requires cache plugin

for XML/SWF Charts ver 5.x

XML/SWF Charts has been updated to version 5. Use a new plugin for the new XML/SWF Charts.

Downloadchart2_081113.zip (328.9 KB)2008-11-13

Examples

Dynamic xml coding

Use 'chart' tag for creation of the charts.

<!-- parameters are optional -->
<chart (width) (height) (name) (bgcolor) (align)>
   ...
   XML/SWF Charts codes
   ...
</chart>

Bar

<chart 240 200 barchart FFFFFF RIGHT> <!– Default chart_type –>

 <chart_data>
    <row>
       <null/>
       <string>2001</string>
       <string>2002</string>
       <string>2003</string>
       <string>2004</string>
    </row>
    <row>
       <string>Data</string>
       <number>5</number>
       <number>10</number>
       <number>30</number>
       <number>63</number>
    </row>
 </chart_data>

</chart>

<chart 240 200 barchart FFFFFF RIGHT>
<!-- Default chart_type -->
   <chart_data>
      <row>
         <null/>
         <string>2001</string>
         <string>2002</string>
         <string>2003</string>
         <string>2004</string>
      </row>
      <row>
         <string>Data</string>
         <number>5</number>
         <number>10</number>
         <number>30</number>
         <number>63</number>
      </row>
   </chart_data>
</chart>

Pie

<chart 240 200 pichart FFFFFF RIGHT>

<chart_type>pie</chart_type>  
<chart_data>
  <row><null/>
    <string>Academic</string>
    <string>Others</string>
  </row>
  <row><string>Data</string>
    <number>35.1</number>
    <number>64.9</number>
  </row>
</chart_data>
<chart_value_text>
  <row><null/><null/><null/></row>
  <row><null/>
    <string>34.9%</string>
    <string>65.1%</string>
  </row>
</chart_value_text>
<chart_rect x='30' y='10' width='150' height='150'/><chart_value size='12'/>
<legend_label layout='horizontal' size='10'/><legend_rect x='10' y='20' width='0' height='40'/>
<draw><text size='14' bold='true' x='45' y='160' color='00dd33'>Accessed domain</text></draw>

</chart>

<chart 240 200 pichart FFFFFF RIGHT>
  <chart_type>pie</chart_type>  
  <chart_data>
    <row><null/>
      <string>Academic</string>
      <string>Others</string>
    </row>
    <row><string>Data</string>
      <number>35.1</number>
      <number>64.9</number>
    </row>
  </chart_data>
  <chart_value_text>
    <row><null/><null/><null/></row>
    <row><null/>
      <string>34.9%</string>
      <string>65.1%</string>
    </row>
  </chart_value_text>
  <chart_rect x='30' y='10' width='150' height='150'/><chart_value size='12'/>
  <legend_label layout='horizontal' size='10'/><legend_rect x='10' y='20' width='0' height='40'/>
  <draw><text size='14' bold='true' x='45' y='160' color='00dd33'>Accessed domain</text></draw>
</chart>

Static XML file

<chart (XML file path) (width) (height) (name) (bgcolor) (align)></chart>

<chart computer:en:chart_example.xml 200 180 pie2 FFFFFF RIGHT></chart> Put file path of external xml file in the <chart> tag. The location should be full path including root namespace. Since you can use Wiki syntax of {{XXXX.xml}}, it is convinient for you to put it by icon_picture in toolbar.

<chart computer:en:chart_example.xml 200 180></chart>

<chart {{computer:en:slide_example2.xml|}} 200 150></chart>

chart_example.xml

Extensions

Clearing of cache files

You can clear cache files in 'chart' namespace by using 'clear_cache' command.

<chart clear_cache></chart>

:!:Since 'clear_cache' deletes all cached files from 'chart' namespace, a cached Wiki page doesn't show charts sometimes. Therefore, use ~~NOCACHE~~ command in the page to recreate XML files everytime.

Scripts within XML

You can include external PHP scripts within an XML source by using '<include>' tag. Notice that the base directory is '/lib/plugins/chart/'. The PHP scripts should return string data.

<chart 220 200 random2 FFFFFF RIGHT> <include>include_test.php</include> </chart>

Example

<chart 240 200 random2 FEFFFF RIGHT>
<include>include_test.php</include>
</chart>

include_test.php

<?php
$ret ='<chart_data><row><null/>
         <string>2001</string>
         <string>2002</string>
         <string>2003</string>
         <string>2004</string>
      </row>
      <row>
         <string>Data</string>';
         
// Creation of random values here.
for ($cnt = 0;$cnt < 4;$cnt++){
  $val = rand(0,1000);
  $ret.= '<number>'.$val.'</number>\n';
}

$ret.='</row></chart_data>';
return $ret;
?>

Installation

  1. Install cache plugin if not installed.
  2. Download and extract chart.zip (171KB)
  3. Upload 'chart' folder including SWF files to your DokuWiki server at /lib/plugins/.

The 'charts.swf' and files in 'charts_library' are redistributed unregistered version of XML/SWF Charts. See the license page at maani.us's site

chart_config_en.jpg

History

  • 2008.3.22
  • 2008.3.16
    • Vulnerability of XSS was fixed. (Thanks, Andy)
    • bug fix to make an appropriate swf library path.
  • 2007.12.30
    • bug fix
  • 2007.12.18
    • Enabled to use [[wiki link]] and <include>.
  • 2007.12.08 ver. 0.4.1
    • Enabled to start without configurations
  • 2007.12.07 ver. 0.4
    • Media format {{XXXX.jpg}} translation
    • Fix around directory-creation & ACL setting.
    • Fetch URL was abolished. ← This configuration has bothered people.
Translations of this page:
chart_plugin.txt · Last modified: 2016/10/31 08:44 by swadmin