Skip to main content
February 25, 2008
Question

Charting Dynamically in CF

  • February 25, 2008
  • 1 reply
  • 343 views
I need to chart 12 months of the year but don't want to start from '0', I want to start from a .75 percent of the total amount. The problem comes when I trie to chart the 12 months because some of them have no value yet and if i put some value it will chart that value, the only way I could do it right now is taking the chart from 0 point and I'm chartting Millions so it's better for me not to start from 0 point.

Any ideas? thanks
This topic has been closed for replies.

1 reply

Inspiring
February 26, 2008
Can you explain that again with some code please?
March 5, 2008

<--! I Use these numbers to try the hard thing, I only want to chart values starting from the 75% of the biggest number and over 25% of the biggest number (don't want to start from zero) -->
<cfset minl = #Len(LSNumberFormat(min_total * .25, "(____)"))#>

<cfset num_int = #LSNumberFormat(min_total * .25, "(____)")#>

<cfset firstdigit = #LSNumberFormat(num_int, "(____)")# /10^(minl-1)>

<cfset roundedmin = Round(firstdigit-1) * 10^(minl-1)>


<cfchart format="png" scalefrom="#roundedmin#" scaleto="#max_totals * 1.20#" showborder="no" showygridlines="yes" chartheight="250" chartwidth="600" foregroundcolor="##999999" style="beige">

<cfchartseries type="bar" seriescolor="##0066FF">

<cfif #arr_totals[1]# GT 0>

<cfchartdata item="Ene" value="#arr_totals[1]#">

<cfelse>

<cfchartdata item="Ene" value="0">

</cfif>

<cfif #arr_totals[2]# GT 0>c

<cfchartdata item="Feb" value="#arr_totals[2]#">

<cfelse>

<cfchartdata item="Feb" value="0">

</cfif>

<cfif #arr_totals[3]# GT 0>

<cfchartdata item="Mar" value="#arr_totals[3]#">

<cfelse>

<cfchartdata item="Mar" value="0">

</cfif>


<--! And so on... 'till the 12th month-->

</cfchartseries>

</cfchart>


March 5, 2008
I forgot, in the code is showing 0 as the default value but if I use the calculated 75% value instead, It will chart something wrong.