Dokuwiki for science

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

chart_plugin [2016/10/30 23:44] (現在)
ライン 1: ライン 1:
 +======Chart Plugin======
 +
 +:!: This plugin is no longer maintained. :!:
 +
 +This DokuWiki plugin creates a chart in a DokuWiki page by using [[http://​www.maani.us/​xml_charts/​index.php|XML/​SWF Charts]]. XML/SWF Charts is a Flash application that creates various charts of nice appearance.
 +
 +  ***[[http://​www.maani.us/​xml_charts/​index.php|XML/​SWF Charts]]**
 +
 +<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 =====
 +^Download|{{computer:​source:​chart.zip|chart.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 [[chart2_plugin|new plugin]] for the new XML/SWF Charts.
 +
 +^Download|{{:​computer:​source:​chart2_081113.zip}} (328.9 KB)|2008-11-13|
 +
 +
 +=====Examples=====
 +  *See detailed coding at [[http://​www.maani.us/​xml_charts/​index.php?​menu=Reference|XML/​SWF Charts'​s reference]]
 +  *This plugin uses '​chart'​ namespace for the caching of dynamic coding.
 +  *Access analytics of this site uses this plugin. -> [[:​analytics0711]]
 +
 +====Dynamic xml coding====
 +Use '​chart'​ tag for creation of the charts.
 +
 +<​code>​
 +<!-- parameters are optional -->
 +<chart (width) (height) (name) (bgcolor) (align)>
 +   ...
 +   ​XML/​SWF Charts codes
 +   ...
 +</​chart>​
 +</​code>​
 +===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>​
 +<​code>​
 +<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>​
 +</​code>​
 +===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>​
 +<​code>​
 +<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>​
 +</​code>​
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +====Static XML file====
 +<​code>​
 +<chart (XML file path) (width) (height) (name) (bgcolor) (align)></​chart>​
 +</​code>​
 +
 +<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.
 +
 +
 +
 +<​code>​
 +<chart computer:​en:​chart_example.xml 200 180></​chart>​
 +
 +<chart {{computer:​en:​slide_example2.xml|}} 200 150></​chart>​
 +
 +</​code>​
 +
 +
 +{{computer:​en:​chart_example.xml|chart_example.xml}}
 +
 +
 +===== Extensions =====
 +
 +
 +
 +
 +====Clearing of cache files====
 +You can clear cache files in '​chart'​ namespace by using '​clear_cache'​ command.
 +
 +<​code>​
 +<chart clear_cache></​chart>​
 +
 +</​code>​
 +
 +:!: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**
 +<​code>​
 +<chart 240 200 random2 FEFFFF RIGHT>
 +<​include>​include_test.php</​include>​
 +</​chart>​
 +</​code>​
 +**include_test.php**
 +<​code>​
 +<?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;
 +?>
 +</​code>​
 +<​clear/>​
 +
 +
 +
 +
 +=====Installation=====
 +  -Install [[cache plugin]] if not installed.
 +  -Download and extract {{computer:​source:​chart.zip}} (171KB)
 +  -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 [[http://​www.maani.us/​xml_charts/​index.php?​menu=License|maani.us'​s site]]
 +
 +
 +{{computer:​en:​chart_config_en.jpg?​400}}
 +
 +
 +
 +
 +
 +
 +
 +=====History=====
 +  *2008.3.22
 +    *Cache mechanism was allocated to [[cache plugin]].
 +  *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.
 +
 +=====Links=====
 +<float left>​{{icon>​compass_large}}</​float>​
 +<float left>
 +  *[[dokuwiki_plugin|Symplus'​s DokuWiki plugin]]
 +    *[[chart_plugin|XML/​SWF Chart plugin]]
 +    *[[slideshow_plugin|XML/​SWF Slideshow plugin]]
 +  *[[http://​www.maani.us/​xml_charts/​index.php|XML/​SWF Charts by maani.us]]
 +</​float>​
 +<​clear/>​
 +{{tag>​Plugin}}
 +