using System;
using System.Data;
using System.Text;
using System.Data.Odbc;
namespace InfoSoftGlobal
{
/// <summary>
/// 扩展
/// </summary>
public partial class FusionCharts
{
/// <summary>
/// 附带导出配置的呈现
public static string RenderChartWithExport(string chartSWF, string strURL, string strXML, string chartId,
string chartWidth, string chartHeight, bool debugMode, bool registerWithJS)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat("<!-- START Script Block for Chart {0} -->" + Environment.NewLine, chartId);
builder.AppendFormat("<div id='{0}Div' align='center'>" + Environment.NewLine, chartId);
builder.Append("Chart." + Environment.NewLine);
builder.Append("</div>" + Environment.NewLine);
builder.Append("<script type=\"text/javascript\">" + Environment.NewLine);
builder.AppendFormat("var chart_{0} = new FusionCharts(\"{1}\", \"{0}\", \"{2}\", \"{3}\", \"{4}\", \"{5}\");" + Environment.NewLine, chartId, chartSWF, chartWidth, chartHeight, boolToNum(debugMode), boolToNum(registerWithJS));
if (strXML.Length == 0)
{
builder.AppendFormat("chart_{0}.setDataURL(\"{1}\");" + Environment.NewLine, chartId, strURL);
}
else
{
builder.AppendFormat("chart_{0}.setDataXML(\"{1}\");" + Environment.NewLine, chartId, strXML);
}
builder.AppendFormat("chart_{0}.render(\"{1}Div\");" + Environment.NewLine, chartId, chartId);
//客户端导出配置
builder.Append(" var myExportComponent = new FusionChartsExportObject(\"fcExporter1\",\"FusionCharts/FCExporter.swf\");" + Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnColor = 'EAF4FD';"+Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnBorderColor = '0372AB';"+Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnFontFace = 'Verdana';"+Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnFontColor = '0372AB';"+Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnFontSize = '12'; " + Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btnsavetitle = 'Save the chart';" + Environment.NewLine);
builder.Append(" myExportComponent.componentAttributes.btndisabledtitle = 'Waiting for export'; " + Environment.NewLine);
builder.Append(" myExportComponent.Render(\"exproterDiv\");" + Environment.NewLine);
builder.Append("</script>" + Environment.NewLine);
builder.AppendFormat("<!-- END Script Block for Chart {0} -->" + Environment.NewLine, chartId);
return builder.ToString();
}
}
}
1.要素1: <script LANGUAGE="Javascript" SRC="FusionCharts/FusionChartsExportComponent.js"></script>
2.要素2: <div id="exproterDiv" align="center">导 出</div> <!--警示:该div必须出现在myExportComponent.Render()语句之前-->
3. 要素3: exportEnabled='1' exportFormats='PNG=导出为PNG|JPG=导出为JPG|PDF=导出为PDF' exportAtClient='1' exportHandler='fcExporter1'
4.要素4:
new FusionChartsExportObject 中的id必须和exportHandler='fcExporter1'中的handlerId相同