HOME STORE APPLICATIONS COLDFUSION PHP PORTFOLIO PROFILE CONTACT
Maps: TEXT|HTML|XML|RSS

Freelance Web Developer. ColdFusion, PHP, ASP.net programming worldwide

support@cf-works.com. SMS: +7-911-715-57-84

Coldfusion function to display percent of total (graph) - "Utilization Graph" (Item ID:163)

coldfusion functions, coldfusion open source, percents, ratio, simple graph, coldfusion code examples, coldfusion tutorial
Enlarge image: Coldfusion function to display percent of total (graph) - Enlarge Image
Type:SOFTWARE (downloadable)
Category: Coldfusion Open Source 
Developer:CF-Works   [more items by CF-Works]
Added by:CF-Works   [more items from CF-Works]
Price:FREE
Availability:FREE DOWNLOAD Download Coldfusion function to display percent of total (graph) -
(Please read CF-Works License Agreement)
Popularity: RateRateRateRateRate

There are powerful means to create diverse kinds of graphs built in Coldfusion, including Flash-based ones. But they of course would take more time to initialize than simple HTML-based graph if you need to show some simple graph on public side of your website where performance optimization is critical. Also it is possible to get fully custom visual graph, for instance I made bars using color gradient in Photoshop. For this goal I built pretty simple Coldfusion component-based function named "Utilization Graph". It accepts the following parameters:
  • Current value;
  • Total value;
  • Graph width;
  • Format (dollars / percents / plain numbers), applies to label
  • "Show 'from'" - if set to TRUE, will show total in label, like this: "25 from 90"

This component is available for free download.

Source code:

  <CFFUNCTION name="UtilizationGraph" returntype="void" output="Yes">
<CFARGUMENT name="current" type="numeric" required="Yes">
<CFARGUMENT name="total" type="numeric" required="Yes">
<CFARGUMENT name="scaleto" type="numeric" required="No" default="100">
<CFARGUMENT name="format" type="string" required="No" default="999999999.99">
<CFARGUMENT name="showfrom" type="boolean" required="No" default="yes">
<CFPARAM name="REQUEST.cfcimgpath" default="images">
<CFIF ARGUMENTS.total>
<CFSILENT><CFSET k=(ARGUMENTS.scaleto/ARGUMENTS.total)></CFSILENT>
<TABLE cellspacing="0" border="0">
<TR><TD><IMG src="#REQUEST.cfcimgpath#/appstyle/horbar2.gif" width="#int(evaluate(ARGUMENTS.current*k))#" height="12" border="0" alt="#ARGUMENTS.current#%" title="#ARGUMENTS.current#%"><IMG src="#REQUEST.cfcimgpath#/appstyle/horbar1.gif" width="#int(evaluate('(ARGUMENTS.total-ARGUMENTS.current)*k'))#" height="12" border="0"></TD>
<TD>
<CFIF ARGUMENTS.format is "$">
#dollarformat(ARGUMENTS.current)#<CFIF showfrom> from #dollarformat(ARGUMENTS.total)# </CFIF>
<CFELSEIF ARGUMENTS.format is "%">
#int(ARGUMENTS.current)#%
<CFELSE>
#trim(numberformat(ARGUMENTS.current,"#ARGUMENTS.format#"))#<CFIF showfrom> from #ARGUMENTS.total#</CFIF>
</CFIF>
</TD></TR>
</TABLE>
</CFIF>
</CFFUNCTION>

 
BRIEF DESCRIPTION: Coldfusion open source: function to display percent of total (graph) - "Utilization Graph". Free Coldfusion code examples, coldfusion tutorial


Open/Hide Highlight Group Main Features:

Open/Hide Highlight Group Purchase

 
write review Add your review to this item:
Existing customers please login (click "Your Account" top menu item).
New customers choose Quick Registration including just your name, email and password or Complete Registration


*Ask a Question about Coldfusion function to display percent of total (graph) - "Utilization Graph":
E-Mail:enter your email address if you would like to be notified when your question is answered
*Anti-spam code:
Please enter anti-spam code to prevent automated scripts' spam submissions. Thank You

  Status:  
Ready


Reviews Rate: Not Rated
Visitors Rate: RateRateRateRateRate   (3 votes)
Rate this item:
 Rate Coldfusion function to display percent of total (graph) -