3
votes

I am working on ColdFusion 9 - cfchart, Here is part of my code

<cfchart  format="flash" show3d="true"  title="Assigned Amount vs Projection Amount" scaleto="#scaleToForAmount#" scaleFrom="0"  backgroundColor="white" font="Arial" seriesplacement="stacked" chartHeight="400" chartWidth="800" labelFormat="number" > 
    <cfchartseries  type="bar"  query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PAID" seriesColor="##155D7F" seriesLabel="amout" paintStyle="plain" > 
    </cfchartseries> 
    <cfchartseries  type="bar"  query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PTP" seriesColor="##2AB9FF" paintStyle="plan" seriesLabel="PTP" > 
    </cfchartseries>
    <cfchartseries  type="bar"  query="chartData" itemcolumn="#variables.columnList[1]#Name" valuecolumn="PDC" seriesColor="##0A2E40" paintStyle="domain" seriesLabel="PDC" > 
   </cfchartseries>

But i am getting problem when value of scaleTo Increase beyond integer limit it show error. Even when converting it to string, double or bigInt it is not accepting those values. And continue to show error that "Cannot convert the value 3.1616321275E9 to an integer because it cannot fit inside an integer". Can anyone help me to get out of this.

1
Not a great answer I know, but my suggestion would be to use a Javascript charting library instead of cfchart, for example ChartJS / Flot / D3 etcJohn Whish

1 Answers

2
votes

You are passing a float value to scaleTo attribute. The scaleTo attribute expects an integer value.

I will also suggest not to use flash format for chart. The flash format has been depricated in the newer version of CF. It will throw an error if your code is migrated to the newer version of CF.

Update:

ColdFusion supports integers between -2,147,483,648 and 2,147,483,647 (32-bit signed integers). You can assign a value outside this range to a variable. ColdFusion initially stores the number as a string. If you use it in an arithmetic expression or operation related to number, ColdFusion converts it into a floating-point value, preserving its value, but losing precision. The value 3161632127 is out of range. Hence CF is converting the value to the float. And since the value is float, CF is throwing an error. Check out the document.