最近、自分のアプリケーションを ColdFusion 10 から ColdFusion 11 に移行しました。移行は成功しましたが、グラフが壊れてしまいました。ColdFusion 10 まではwc50.jar
、\lib
ディレクトリに という WebCharts JAR ファイルがありました。などのチャートモジュールが含まれていましたcom.gp.api.jsp.MxServerComponent
。この JAR ファイルは ColdFusion 11 にはありません。したがって、「チャート コード」を更新し、新しい ZingChart を使用することにしました。
ZingChart は JSON ベースです。私が分析したところ、ColdFusion 11 には XML を JSON に変換するためのユーティリティがあることがわかりました。ユーティリティの名前はcfchart_xmltojson.bat
. これが私の分析です。私の質問は-このユーティリティを実行/使用して変換を行い、チャートコードを変更する方法は?
私の現在のチャートコードは次のようになります。
<cfsaveContent variable="chartStyle">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<frameChart isMultiline="false" is3D="#is3D#">
<frame outline="##666666"/>
<yAxis scaleMin="0" scaleMax="100"/>
<legend allowSpan="true" equalCols="false" placement="Right" isMultiline="true">
<decoration style="None"/>
</legend>
<cfif ShowPyramidNums>
<dataLabels style="value" placement="Inside" font="Arial-12-bold" >
</dataLabels>
</cfif>
<elements place="Stacked" shape="PyramidCut" shapeSize="100">
<movie framesPerSecond="2"/>
<cfset sPerfCtr = 0>
<cfloop index="i" from="#q_PerformanceDetailsByTemp.RecordCount#" to="1" step="-1">
<series index="#Evaluate(sPerfCtr)#">
<paint color="###q_PerformanceDetailsByTemp.ChartColor[i]#"/>
</series>
<cfset sPerfCtr = sPerfCtr+1>
</cfloop>
</elements>
<table>
<decoration style="Shadow"/>
</table>
<background maxColor="white"/>
<decoration foreColor="white" backColor="##90FFFF"/>
<popup showOn="Disabled" isAntialiased="true"/>
<paint palette="Transluent" paint="Plain" max="52"/>
</frameChart>
</cfoutput>
</cfsaveContent>
<cfsavecontent variable="chartModel">
<cfoutput>
<?xml version="1.0" encoding="UTF-8"?>
<XML type="default">
<COL>Fall</COL>
<COL>Winter</COL>
<COL>Spring</COL>
<cfset over100FallFixed = false>
<cfset over100WinterFixed = false>
<cfset over100SpringFixed = false>
<cfloop index="i" from="#ArrayLen(PerfStats)#" to="1" step="-1">
<cfset rowVal = Evaluate((1/q_PerformanceDetailsByTemp.recordCount)*100)>
<cfif isDefined("over100Alert")>
<!--- This set of if statements is to modify value to show triangle correctly --->
<!--- Without this modification, the total ia 100.1 which cuts off the top of the triangle --->
<cfif right(PerfStats[i].FallPercentage, 1) GT 0 AND NOT over100FallFixed>
<cfset PerfStats[i].FallPercentage = PerfStats[i].FallPercentage - .1>
</cfif>
<cfif right(PerfStats[i].WinterPercentage, 1) GT 0 AND NOT over100WinterFixed>
<cfset PerfStats[i].WinterPercentage = PerfStats[i].WinterPercentage - .1>
</cfif>
<cfif right(PerfStats[i].SpringPercentage, 1) GT 0 AND NOT over100SpringFixed>
<cfset PerfStats[i].SpringPercentage = PerfStats[i].SpringPercentage - .1>
</cfif>
<ROW col0="#PerfStats[i].FallPercentage#" col1="#PerfStats[i].WinterPercentage#" col2="#PerfStats[i].SpringPercentage#">% #PerfStats[i].Name#</ROW>
<cfelse>
<ROW col0="#round(PerfStats[i].FallPercentage)#" col1="#round(PerfStats[i].WinterPercentage)#" col2="#round(PerfStats[i].SpringPercentage)#">% #PerfStats[i].Name#</ROW>
</cfif>
</cfloop>
</XML>
</cfoutput>
</cfsavecontent>
<cfscript>
ImageName = "TierTrans_" & CreateUUID() & ".png";
oMyWebChart = createObject("Java","com.gp.api.jsp.MxServerComponent");
oMyApp = getPageContext().getServletContext();
oSvr = oMyWebChart.getDefaultInstance(oMyApp);
oMyChart2 = oSvr.newImageSpec();
if(NOT Session.PDFIng)
{
oMyChart2.width = 650;
} else
{
oMyChart2.width = 550;
}
oMyChart2.height= 230;
oMyChart2.type = "png";
oMyChart2.style = "#chartStyle#";
oMyChart2.model = "#chartModel#";
</cfscript>
<cfif NOT DirectoryExists(ImagesDir)>
<CFDIRECTORY ACTION="CREATE" DIRECTORY="#ImagesDir#">
</cfif>
<!--- Save image to a different location --->
<cfset oSvr.saveBytesTo(oMyChart2,"#ImagesDir##ImageName#")>
<cfoutput><img src="Images/Reports/#ImageName#" border="0"/></cfoutput>
下の画像のようなチャートを描いていました。(表示される透かしはwc50.jar
、ColdFusion 10 ディレクトリから ColdFusion 11 lib ディレクトリにコピーしたためです):