DokuWiki plugin | Older version

Chart2 Plugin

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. This plugin supports XML/SWF Charts version 5.x.

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

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.

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

This plugin does not require cache plugin that was neccessary for the older version.

Examples

Dynamic xml coding

Use 'chart2' tag for creation of the charts.

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

Bar

<chart2 240 200 barchart FFFFFF RIGHT> <chart> <!– 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> </chart2>

<chart2 240 200 barchart FFFFFF RIGHT>
<chart>
<!-- 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>
</chart2>

Pie

<chart2 240 200 pichart FFFFFF right> <chart>

<chart_type>pie</chart_type>  
<chart_data>
  <row>
    <null/>
    <string>Academic</string>
    <string>Others</string>
  </row>
  <row>
    <string>Data</string>
    <number label='35.1 %'>35.1</number>
    <number label='64.9 %'>64.9</number>
  </row>
</chart_data>
<chart_rect x='30' y='10' width='150' height='150'/>
<chart_label size='12'/>
  <legend layout='vertical' width='100' height='30'
         bullet='circle' font='arial' bold='true'
         size='12' color='CC0000' alpha='90' fill_color='FFFFFF'/> 
  <draw>
    <text size='14' bold='true' x='45' y='160' color='00dd33'>
      Accessed domain
    </text>
  </draw>
</chart>

</chart2>

<chart2 240 200 pichart FFFFFF right>
<chart>
  <chart_type>pie</chart_type>  
  <chart_data>
    <row>
      <null/>
      <string>Academic</string>
      <string>Others</string>
    </row>
    <row>
      <string>Data</string>
      <number label='35.1 %'>35.1</number>
      <number label='64.9 %'>64.9</number>
    </row>
  </chart_data>
  <chart_rect x='30' y='10' width='150' height='150'/>
  <chart_label size='12'/>
    <legend layout='vertical' width='100' height='30'
           bullet='circle' font='arial' bold='true'
           size='12' color='CC0000' alpha='90' fill_color='FFFFFF'/> 
    <draw>
      <text size='14' bold='true' x='45' y='160' color='00dd33'>
        Accessed domain
      </text>
    </draw>
  </chart>
</chart2>

Static XML file

<chart2 (media file / URL) (width) (height) (name) (bgcolor) (align)></chart2>

<chart2 chart2_example.xml 200 180 pie2 FFFFFF RIGHT></chart2> Put file path of external xml file in the <chart2> 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.

Examples

<chart2 computer:en:chart2_example.xml 200 180></chart2>

<chart2 {{:computer:en:chart2_example.xml|}} 200 150></chart2>

Extensions

Scripts within XML

<chart2 http://www.symplus.com/legacy/wiki/lib/plugins/chart2/include_test.php 220 200 include_test FFFFFF left></chart2> You can use XML source generated by script such as PHP. Put a URL of the script instead of media file.

<chart2 (script URL) (width) (height)...></chart2>

Example

<chart2 http://wiki.symplus.co.jp/lib/plugins/chart2/include_test.php 220 200 include_test FFFFFF></chart2>

include_test.php

<?php
$ret ='<chart><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></chart>';
echo $ret;
?>

Installation

  1. Download and extract chart2_081113.zip (329.8KB)
  2. Upload 'chart2' 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.11.13 bug fixed
    • encoding of labels
    • minimization of xml_data after edit
  • 2008.10.30 Uploaded

Links

 
en/chart2_plugin.txt · Last modified: 2010/01/24 12:04 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
2010 I.Obataya