用amcharts做報表工具時,遇到了好幾個小問題。第一是破解問題,如果不破解amcharts的LOGO圖標就會顯示在flash上面,讓人感覺非常不好。第二個就是關於XXX_setting.xml中小數點的問題,如果你在data.xml文件中的數據是12.56,那麼默認情況下在flash中顯示的是12,56,它用逗號代替了小數點。網上搜索半天,終於找到方法。
第一個比較簡單,網上很多,但我就用了其中最簡單的一種,就是在amcharts目錄下找到amcharts_key.txt,輸入AMCHART-LNKS-1966-6679-1965-1082保存,LOGO問題解決。
第二個在你的XX_setting.xml文件中,找到<decimals_separator></decimas_separator>,寫上.就可以了。
餅圖顏色設置:
如果不想使用默認的顏色的話 那麼可以自己來設置顏色
例如一個餅圖分3塊 則需要3個顏色來分別表示這些圖形
就需要在setting.xml文件中加上
<pie>
<colors>FF9E01,F8FF01,B0DE09</colors> //設置顏色
<x>320</x>
<y>100</y>
<radius>100</radius>
<inner_radius>30</inner_radius>
<height>10</height>
<angle>35</angle>
<alpha>90</alpha>
</pie>
<colors>FF9E01,F8FF01,B0DE09</colors> //設置顏色
<x>320</x>
<y>100</y>
<radius>100</radius>
<inner_radius>30</inner_radius>
<height>10</height>
<angle>35</angle>
<alpha>90</alpha>
</pie>
柱狀圖的顏色設置:
<graphs>
<graph gid="0">
<color>FEC514</color>//設置顏色
</graph>
</graphs>
<graph gid="0">
<color>FEC514</color>//設置顏色
</graph>
</graphs>
柱狀圖的 柱子寬度設置
<column>
<width>20</width>//設置寬度
<balloon_text>{value}</balloon_text>
<grow_time>3</grow_time>
</column>
<width>20</width>//設置寬度
<balloon_text>{value}</balloon_text>
<grow_time>3</grow_time>
</column>
柱狀圖的虛線背景想要取消怎麼辦
請看代碼 我們也可以設置背景爲白色框 什麼都不加
<grid>
<category>
<alpha>0</alpha> //設置成0 當然不爲0就有虛線
<dashed>1</dashed>
</category>
<value>
<alpha>0</alpha>//設置成0 當然不爲0就有虛線
<dashed>1</dashed>
</value>
</grid>
<category>
<alpha>0</alpha> //設置成0 當然不爲0就有虛線
<dashed>1</dashed>
</category>
<value>
<alpha>0</alpha>//設置成0 當然不爲0就有虛線
<dashed>1</dashed>
</value>
</grid>
圖形頁面的邊距
<plot_area>
<margins>
<left>50</left>
<left>25</left>
<right>20</right>
<top>20</top>
<bottom>60</bottom>
</margins>
</plot_area>
<margins>
<left>50</left>
<left>25</left>
<right>20</right>
<top>20</top>
<bottom>60</bottom>
</margins>
</plot_area>
鼠標移到圖形時 顯示圖形代表塊的數據
<column>
<width>20</width>
<balloon_text>{titile}:{value} ({percents}%) balloon_text> //這三個參數可以取捨 第一個是顯法標題,第二個是顯示具體值,第三個是百分比
<grow_time>3</grow_time>
</column>
<width>20</width>
<balloon_text>{titile}:{value} ({percents}%) balloon_text> //這三個參數可以取捨 第一個是顯法標題,第二個是顯示具體值,第三個是百分比
<grow_time>3</grow_time>
</column>
沒有數據時圖形的顯示
1 沒有數據時可以顯示一個默認圖形 這個自己定義 想顯示成什麼樣就什麼樣 看需求了
2 沒有數據時 有的用戶希望有一個友好的提示 所以請看提示功能
<strings>
<no_data>沒有數據</no_data>
</strings>
<no_data>沒有數據</no_data>
</strings>
小數點的形式
<thousands_separator>,</thousands_separator>
<decimals_separator>.</decimals_separator>
<decimals_separator>.</decimals_separator>
整個圖形的寬度與高度 即圖形大小了
呵呵
new SWFObject(swfURI, chartType, "100%", chartHeight, "7", "");//第三個參數是寬度 第四個是高度
設置標題欄的位置 默認是在左下方 圖形的下方 這此的需求是放在上方
/*這是默認的設置 可以在legnd裏面加上自定義x y 的值*/
<legend>
<enabled>0</enabled>
</legend>
/*自定義 標題欄的位置*/
<legend>
<x>15</x>
<y>5</y>
</legend>
如果是pie 餅圖的話 enable應設爲true纔會顯示<legend>
<enabled>0</enabled>
</legend>
/*自定義 標題欄的位置*/
<legend>
<x>15</x>
<y>5</y>
</legend>
<legend>
<align>center</align>
</legend>
如果柱狀圖 不是柱狀 而成了四邊形 不是柱子形 此時也是需要設置的
<depth>20</depth> //設置柱子形狀 如果值爲0 你可試試 就不是柱狀 而是四邊形