FusionChart 注意事项和关键问题

FusionChart 一些关键问题

1.在html中可以根据不同情况选择插入xml文件 还是 JS字符串
setDataXML(testvalue);//用于导入JS字符串
myChart.setDataURL("../FrameData.xml"); //用于导入XML文件
  1>setDataXML()和setDataURL()这2中方式生产fusioncharts图形,用过的可能会发现使用setDataXML()图形可能会出现一些bug,例如图形只显示一小块或者其他的各种问题,这个问题困扰了我很长时间,一次偶然的机会换成了setDataURL()方式发现这个问题貌似基本上不出现了,使用setDataURL()方式感觉缓存问题比较严重,解决方法,在生产fusioncharts需要的xml文件的jsp页面加上(我是在jsp页面调用后台的java方法拼装fusioncharts需要的xml文件):

          
response.setHeader("Pragma","No-cache"); 
	response.setHeader("Cache-Control","no-cache"); 
	response.setDateHeader("Expires", 0); 


2. JS字符串要注意的问题
1>当字串中要插入link的TAG时候 只能传递数字类型 不能是字符串 因为会有双引号的冲突
testvalue+="<set name='S. Korea' value='86' link='JavaScript:myJS(11);' color='8E468E' /> ";
2>加入link 传入字符串时候需要%26apos; 解释 在HTML中单引号 ' 是"&apos;" 双引号"&quot;" 但在JS中 还需转换 escape(&apos;) 所以&变成了 %26
testvalue+="<set name='China' value='90' link='JavaScript:myJS(%26apos;abc%26apos;);' color='D64646' /> ";
  --这种转换格式貌似只适用于通过setDataXML()生产的fusioncharts图形
3> 如果我们适用setDataUrl()方式生产fusioncharts图形时,应写成这种格式:
"<set name='China' value='90' link='JavaScript:myJS(\"abc\");' color='D64646' /> ";

3. chart2.0 相关参数介绍 在xml中可以设置
1> if tag is <graph>
the root-tag' name only can use <graph></graph>
in the root tag,you can set some arrtributes
animation='0/1' show chart by active 动画效果展示
alternateHGridColor='f8f8f8' Color of the alternate horizontal grid bands
alternateHGridAlpha='60' Alpha (transparency) of the alternate horizontal grid bands.
bgColor='FFFFDD' flash's background color DO NOT need to assign a "#"
bgAlpha='70' set the alpha
bgSWF="Path of SWF File" load an external .swf file as a background for the chart
caption='Monthly Unit Sales' the caption of the chart
decimalPrecision='0' show the number with decimal like "1,761.0" flag: '0' is none
divlinecolor='c5c5c5' color of the grid divisional line
divLineThickness="5" Thickness (in pixels) of the grid divisional line.
divLineAlpha='60' Alpha (transparency) of the grid divisional line
formatNumberScale='0' show the number with formatted like "1k" flag: '0' is none
link=urlencode("http://www.ethos.com.cn") add a link to bar $strXML .="<set value='30' link='".urlencode("http://www.ethos.com.cn")."'/>";
numberPrefix='$' precede each number with this character
rotateNames='1/0' text boxes would be rotated or not. 类别文字是否横放还是竖放
showNames='1' sub-tag's name is appear or disappear flag: '0' is none
showValues='0'
showDivLineValue="1/0" : Option to show/hide the textual value of the divisional line.
showColumnShadow='1'
showAlternateHGridColor='1' show alternate colored horizontal grid bands
showLimits='1' show/hide the chart limit textboxes 表格y端是否显示最大值
xAxisName='Month' x-Axis text title
yAxisName='Units' y-Axis text title
yAxisMinValue="3" This attribute determines the lower limit of y-axis.
yAxisMaxValue="3"(yaxismaxvalue='3')This attribute determines the upper limit of y-axis.当所有数值为零时候,不设置此项图形将超出表格不能控制
bgSWF='sample.jpg' add background picture 增加背景图片
chartLeftMargin='100' chart's margin with flash 表格与flash边框的距离
2>
if tag is <set>
color='FFFFDD' flash's bar's color DO NOT need to assign a "#"

对照表名称
Chart Type Description
Column2D Single Series Column 2D Chart
Column3D Single Series Column 3D Chart
Line Single Series Line Chart
Pie3D Single Series Pie 3D Chart
Pie2D Single Series Pie 2D Chart
Bar2D Single Series Bar 2D Chart
Area2D Single Series Area 2D Chart
Doughnut2D Single Series Doughnut 2D Chart
MSColumn3D Multi-Series Column 3D Chart
MSColumn2D Multi-Series Column 2D Chart
MSArea2D Multi-Series Column 2D Chart
MSLine Multi-Series Line Chart
MSBar2D Multi-Series Bar Chart
StackedColumn2D Stacked Column 2D Chart
StackedColumn3D Stacked Column 3D Chart
StackedBar2D Stacked Bar 2D Chart
StackedArea2D Stacked Area 2D Chart
MSColumn3DLineDY Combination Dual Y Chart
(Column 3D + Line)
MSColumn2DLineDY Combination Dual Y Chart
(Column 2D + Line)

numdivlines='2' in background, how many line will split the x axis 横向等分线的条数
numVdivlines='5' in background, how many line will split the y axis 纵向等分线的条数

4.v3.1版本fusionchart 可以生成jpg和pdf

生成png,jpg,pdf服务器端的配置 (Server-side exporting)
1.xml文件的头
<chart yAxisName='Sales Figure' caption='Top 5 Sales Person' numberPrefix='$' useRoundEdges='1' bgColor='FFFFFF,FFFFFF' showBorder='0' exportEnabled='1' exportHandler='./PHP/FCExporter.php' exportAtClient='0' exportAction='save' >
exportHandler='./PHP/FCExporter.php' 注明你fusionchart给的类文件的目录 其中包括3个文件 FCExporter_PDF.php FCExporter_IMG.php FCExporter.php
exportAction='save' 生成图片后会保存到你 FCExporter.php 文件的路径下
exportAction='download' 会出现保存图片的问答框 ie会给你选择的机会, ff之间下载到桌面
exportAtClient='0' 表示用服务器端生成图片,不从客户端(Whether to use client side export handlers, or server side export handlers )
exportEnabled='1' 是否允许有生成jpg、pdf功能
exportFileName='zgy' 定义新生成的图片文件名 , 默认文件名为 FusionCharts
exportCallback='zgyjs' 在html中回调自己定义的JS函数(函数名为zgyjs) 默认的为回调 function FC_Exported(objRtn) 函数
exportShowMenuItem='0' 隐藏flash生成图片的菜单
exportFormats='PDF=Export as PDF|PNG=Export as PNG' 在生成图片菜单上定义显示出来的文字

2.当文件存储在服务器端,设置文件存储的目录
设置FCExporter.php 中
define ( "SAVE_PATH", "../zgy" ); 以FCExporter.php文件为根,设置相对目录


生成png,jpg,pdf客户端的配置 (Client-side exporting)
1.
exportAtClient='1' 表明是在客户端应用

你可能感兴趣的:(PHP,xml,应用服务器,IE,Flash)