I'm using CF Pie chart for one of my application. But it is working weird. The following code is the chart code and it is giving an error. It doesn't even display the chart. I know that, it is due to the presence of double quotes in the value of query column, col1
.
<cfoutput>
<script type="text/javascript">
function Navigate(test){
alert(test);
}
</script>
<cfset testquery = queryNew("col1,Col2", "varchar,varchar") >
<cfset queryAddRow(testquery, 1)>
<cfset querySetCell(testquery, "col1", 'This is the "first" row') >
<cfset querySetCell(testquery, "Col2", 5000) >
<cfset queryAddRow(testquery, 1)>
<cfset querySetCell(testquery, "col1", 'This is the second row') >
<cfset querySetCell(testquery, "Col2", 2500) >
<cfset queryAddRow(testquery, 1)>
<cfset querySetCell(testquery, "col1", 'This is the third row') >
<cfset querySetCell(testquery, "Col2", 8500) >
<CFCHART Format="Html" CHARTWIDTH="600" CHARTHEIGHT="650" TITLE="Pie Chart in CF11" URL="javascript:Navigate('$SERIESLABEL$')">
<CFCHARTSERIES TYPE="pie" COLORLIST="##CA5940,##6FCF42,##4286CF" >
<CFLOOP FROM="1" TO="#testquery.RecordCount#" INDEx="i">
<CFCHARTDATA ITEM="#testquery.col1[i]#" VALUE="#testquery.Col2[i]#">
</CFLOOP>
</CFCHARTSERIES>
</CFCHART>
</cfoutput>
I've checked the chart's JSON in the viewsource, it is fine. But code giving the above error. So not sure why it is giving error. Without double quotes the code is working as expected, but I need the double quotes, it'll impact the application, if I remove the same.
I also tried by replacing the double quotes to single quotes, in that case, the chart is displaying, but if we click on the first row area, it is giving the same error in console.
So using quotes is the major problem here. But I need the above code to display the chart and while clicking on the area, it should show the corresponding label as it is.
I'm not sure I've missed something, or else anything wrong in the code.