[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 711
  • Last Modified:

<cfchart.. how do I set currency to pounds?

Hi,

Can anyone tell me how I set the laberlformat of a cfchart to a pound sign, rather than dollar sign.

In the .cfc that the chart is in, I am setting the locale to "English(UK)", which is setting all other local specifics to pounds [DollarFormat()..etc], but the labels in the chart are still showing a dollar sign.

I would have though that cfchart would have picked up on the Locale, but seemingly not.  Also, I can't find anywhere in the CF documentation or online that mentions how to force it.

Many thanks in advance.
<cfset setCurrentLocal = SetLocale("English (UK)")>
 
 
<cfchart chartwidth="390" chartheight="250" showlegend="false"  format="png" labelformat="currency" title="Comparative costs.">
                
                           <cfchartseries type="Bar" serieslabel="Total Costs" seriescolor="0163a7">
                                <cfchartdata item="Current estimated cost" value="#currentTotalEstimatedCost#">       
                                <cfchartdata item="Estimated cost if 90% registrations online" value="#currentProfitIncrease#">       
                                <cfchartdata item="Estimated revised cost" value="#ProfitIncrease#">   
                           </cfchartseries>
 
                        </cfchart>

Open in new window

0
Jay1607
Asked:
Jay1607
  • 3
  • 2
1 Solution
 
MauseCommented:
Try this:

<cfset locale = CreateObject("java", "java.util.Locale")>
<cfset locale = locale.init("en", "UK")>
<cfset locale.setDefault(locale)>

instead of <cfset setCurrentLocal = SetLocale("English (UK)")>
0
 
Jay1607Author Commented:
Hi Mause, thanks for your reply.

I tried your suggestion.  It did set the locale and convert currency to pounds for CFML (e.g. DollarFormat()), however in the cfgraph, I am getting a strange char instead.

Good thing is that the format is being accessed at least (not just getting the $), but not giving us the pound sign.

Please see screen dump attached.

Any ideas?

Many Thanks.

Jason
cfgraphCurrency.gif
0
 
SidFishesCommented:
maybe try using dollarformat  in your chartdata item value?

if that doesn't work try using LSEuroCurrencyFormat

0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
MauseCommented:
I added a file called mystyle.xml. Put this in the same directory as your cfm file and add style="mystyle.xml" to your cfchart tag. In this file I set the labelFormat/pattern and local.

You can (if you want) make more changes to the style than the default style attributes cfchart give you.

There is a file called "webcharts.bat" in you "\WEB-INF\cfusion\charting" directory. If you run this it will open a charting program webcharts3D that CF uses.
<cfchart style="mystyle.xml" chartwidth="390" chartheight="250" showlegend="false"  format="png" labelformat="currency" title="Comparative costs.">
    <cfchartseries type="Bar" serieslabel="Total Costs" seriescolor="0163a7">
         <cfchartdata item="Current estimated cost" value="#currentTotalEstimatedCost#">       
         <cfchartdata item="Estimated cost if 90% registrations online" value="#currentProfitIncrease#">       
         <cfchartdata item="Estimated revised cost" value="#ProfitIncrease#">   
    </cfchartseries>
 </cfchart>

Open in new window

0
 
MauseCommented:
hhmmm file is missing

This is what is in the mystyle.xml file


<?xml version="1.0" encoding="UTF-8"?>
<frameChart is3D="false" isTransposed="false" seriesTitle="" decoration="None" font="Arial-11" foreground="black" isMultiline="false">
	<yAxis type="Scale" isVisible="true" isAbsolute="true" scaleMin="0" scaleMax="450" >
		<labelFormat style="Currency" pattern="#,##0.00" timezone="">
			<locale lang="en" country="GB" variant=""/>
		</labelFormat>
	</yAxis>
</frameChart>

Open in new window

0
 
Jay1607Author Commented:
Thank you.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now