< previous | next > |
21.link_data | リンクデータ機能 |
<link_data url='string' target='string' /> |
(説明)
link_dataは、グラフの要素をクリックしたときに処理するためのレスポンスのURLを設定します。
これは、グラフのより細かな詳細を得ることを可能にします。
この特性は、登録ユーザのみ利用できます。(フリーライセンスでは利用できません)
登録されていない場合は、すべてのグラフをクリックするとこのウェブサイト(http://www.maani.us/xml_charts/)にリンクします。
それぞれのリンクデータには、以下の属性があります。
クリック変数(Click-Variables)
|
http://yourServer/script.php |
http://yourServer/script.php?col=1&row=2&value=100&category=2001&series=大阪 |
追加変数(Additional Variables)
http://yourServer/script.php?clientID=56745&chartID=10 |
http://yourServer/script.php?clientID=56745&chartID=10&col=1&row=2&value=100&category=2001&series=大阪 |
Javascriptコミュニケーションへのフラッシュ(Flash to Javascript Communication)
javascript:function_name(var1, var2, ...) |
<chart> <link_data url="javascript:display_info( _col_, _row_, _value_, _category_, _series_, 'Hello World!' )" target='javascript' /> </chart> |
<script type="text/javascript"> function display_info ( var1, var2, var3, var4, var5, var6 ){ alert ( var1 ); } </script> |
FlashコミュニケーションへのJavascript(Javascript to Flash Communication)
document.charts.SetVariable ( "update_url", "http://your_server/update.xml" ); |
document.charts.SetVariable ( "update_xml", " |
(例)
<chart> <!-- 相対url スクリプトdocument:link_data.php --> <link_data url='link_data.php' target='_blank' /> </chart> |
サンプルグラフは、www.maani.usサイトを直接ご覧ください。 >link_dataサンプルグラフ
「link_data.php」のスクリプトはこのように変数を読みます。
<?php $column = $_REQUEST['col']; $row = $_REQUEST['row']; $value = $_REQUEST['value']; $category = $_REQUEST['category']; $series = $_REQUEST['series']; ?> |
スクリプトはこのように要求を処理するかもしれません。
<?php if ( $_REQUEST['col'] == 0 ){ echo "The legend was clicked."; }else{ switch ( $_REQUEST['row'] ){ case 0: echo "A category label was clicked."; break; case 1: echo "Region A data was clicked."; break; case 2: echo "Region B data was clicked."; break; } } ?> |
または、このように他のウェブページに要求を向け直すかもしれません。
<?php //no text should be sent to the browser before a redirect. Make sure there are no spaces before "<?php" //table of web pages to redirect the request to (corresponds to the chart's data table) $url = array ( array ( "", "http://server/page", "http://server/page", "http://server/page" ), array ( "http://server/page", "http://server/page", "http://server/page", "http://server/page" ), array ( "http://server/page", "http://server/page", "http://server/page", "http://server/page" ), array ( "http://server/page", "http://server/page", "http://server/page", "http://server/page" ) ); //redirect Header("Location: " . $url [ $_REQUEST['row'] ][ $_REQUEST['col'] ] ); //no text should be sent to the browser after a redirect. exit; ?> |
< previous | このページのTOP | next > |