原創|使用教程|編輯:郝浩|2013-06-26 10:18:16.000|閱讀 334 次
概述:使用AnyMap除了創建Self Drilldown Maps之外,還可以創建Self Drilldown Maps。下面看一下具體的示例。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
使用Flash地圖控件AnyMap除了創建Self Drilldown Maps之外,還可以創建Self Drilldown Maps。下面看一下具體的示例——地圖由兩部分組成,第一部分將包含美國的地圖,當用戶單擊特定的州——該州的地圖就將在地圖的第二部分進行顯示。
創建儀表板布局
創建這樣的地圖需要使用AnyChart儀表板功能,儀表板將包含兩個部分,以下面的代碼進行創建:
<?xml version="1.0" encoding="UTF-8"?> <anychart> <dashboard> <view type="Dashboard"> <title> <text>USA Drilldown Map</text> </title> <hbox width="100%" height="100%"> <view name="Country" type="Chart" width="50%" height="100%" source="USA" /> <view name="State" type="Chart" width="50%" height="100%" /> </hbox> </view> </dashboard> </anychart>
為地圖創建圖表
以下面的代碼進行創建:
<chart plot_type="Map" name="USA"> <chart_settings> <title enabled="false" /> <chart_background enabled="false" /> <data_plot_background enabled="false" /> </chart_settings> <data_plot_settings> <map_series source="usa/country/states.amap"> <projection type="orthographic" /> <undefined_map_region palette="Default"> <actions> <action type="updateView" view="State" source_mode="internalData" source="State"> <replace token="{$region_amap}">{%REGION_ID}</replace> <replace token="{$title}">{%REGION_NAME}</replace> </action> </actions> </undefined_map_region> </map_series> </data_plot_settings> </chart>
這個操作定義意味著AnyChart應在"State"視圖中加載"State"圖表,并使用{%REGION_ID}和{%REGION_NAME}關鍵字參數來取代{$region_amap}和{$title}符號。
中間結果——具有一個定義地圖的Dashboard
如果將描述的圖表添加到儀表板,將會得到如下所示的地圖:
州地圖的XML
創建美國所有州的XML,需要使用一個參數化的XML,{$title}和{$region_amap}符號將會由主圖表<action>進行處理:
<chart plot_type="Map" name="State"> <chart_settings> <title> <text>{$title}</text> </title> <chart_background enabled="false" /> <data_plot_background enabled="false" /> </chart_settings> <data_plot_settings> <map_series source="usa/states/counties/{$region_amap}.amap"> <projection type="orthographic" /> <undefined_map_region palette="Default" /> </map_series> </data_plot_settings> </chart>
最終的Drilldown Dashboard
只需要將 "State" 圖表添加到<charts>部分,儀表板就完成了
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網