[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

formating column chart

Posted on 2011-09-26
6
Medium Priority
?
382 Views
Last Modified: 2012-05-12
Hello,

I have a question I have a column chart but I'm from Brazil and formatting of our currency is: 1568.22 and the United States is: 1.568,22 I wonder if I have to format the values ¿¿that comes from mysql to chart as the currency of my country?

Example: 1568.22 to ---->  1,568.22
0
Comment
Question by:eduardo12fox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 36712677
You can format on the fly in ActionScript using labelFunction

http://livedocs.adobe.com/flex/3/html/help.html?content=charts_displayingdata_07.html
0
 

Author Comment

by:eduardo12fox
ID: 36716012
my question is not about the label and the value of the currency formatted for the currency of my country. See U.S. currency is so 1500.00 in my country is like this: 1500.00 has commas and periods, this is what the graph need formatters

sage This answer was not helpful.
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36718916
If you want to format your number the best way to use CurrenFormatter

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/CurrencyFormatter.html
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:eduardo12fox
ID: 36720135
ok I understand but how I apply it to the chart?



<?xml version="1.0"?>
<!-- charts/BasicColumn.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection;
     [Bindable]
     public var expenses:ArrayCollection = new ArrayCollection([
        {Month:"Jan", Profit:1.540, Expenses:1500.00},
        {Month:"Feb", Profit:15.00, Expenses:200.00},
        {Month:"Mar", Profit:16.55, Expenses:5000.54}
     ]);
     
  ]]></mx:Script>
  
  
<mx:CurrencyFormatter id="MoedaFormatter" precision="2" currencySymbol="R$" decimalSeparatorTo="," decimalSeparatorFrom=","  
thousandsSeparatorFrom="." thousandsSeparatorTo="."/>


  <mx:Panel title="Column Chart">
     <mx:ColumnChart id="myChart" dataProvider="{expenses}" showDataTips="true">
        <mx:horizontalAxis>
        
           <mx:CategoryAxis dataProvider="{expenses}" categoryField="Month" />
           
        </mx:horizontalAxis>
        <mx:series>
        
           <mx:ColumnSeries xField="Month" yField="Profit" displayName="Profit" />
           <mx:ColumnSeries xField="Month" yField="Expenses" displayName="Expenses" />
           
        </mx:series>
     </mx:ColumnChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
</mx:Application>

Open in new window

0
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 total points
ID: 36720662
Here is two implementation of formation for Axis and tooltip

<?xml version="1.0"?>
<!-- charts/BasicColumn.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
	<mx:Script><![CDATA[
		import mx.charts.HitData;
		import mx.charts.series.items.ColumnSeriesItem;
		import mx.collections.ArrayCollection;
		import mx.utils.StringUtil;
		[Bindable]
		public var expenses:ArrayCollection = new ArrayCollection([
			{Month:"Jan", Profit:1.540, Expenses:1500.00},
			{Month:"Feb", Profit:15.00, Expenses:200.00},
			{Month:"Mar", Profit:16.55, Expenses:5000.54}
		]);
		
		private function columnChartDataTipFunction(item:HitData):String {
			var csi:ColumnSeriesItem = item.chartItem as ColumnSeriesItem;
			var xcol:String = ColumnSeries(item.element).xField;
			var ycol:String = ColumnSeries(item.element).yField;
			return StringUtil.substitute("<b>{0}</b><br>{1}<br>{2}", ycol, csi.item[xcol], currencyFormatter.format(csi.item[ycol]));
		}

	]]></mx:Script>
	
	
	<mx:CurrencyFormatter id="currencyFormatter" precision="2" currencySymbol="R$" decimalSeparatorTo="," decimalSeparatorFrom=","  
						  thousandsSeparatorFrom="." thousandsSeparatorTo="."/>
	
	
	<mx:Panel title="Column Chart">
		<mx:ColumnChart id="myChart" dataProvider="{expenses}" showDataTips="true"
						dataTipFunction="columnChartDataTipFunction">
			<mx:verticalAxisRenderers>
				<mx:AxisRenderer 
					axis="{vla}" 
					canDropLabels="false" 
					>
					<mx:labelRenderer>
						<mx:Component>
							<mx:Label>
								<mx:Script><![CDATA[
									override public function set data(value:Object):void{
										if(value == null)
											return;
										text = outerDocument.currencyFormatter.format(value.text);
									}
								]]></mx:Script>
							</mx:Label>
						</mx:Component>
					</mx:labelRenderer>
				</mx:AxisRenderer>                
			</mx:verticalAxisRenderers>

			<mx:verticalAxis>
				<mx:LinearAxis id="vla"/>
			</mx:verticalAxis>

			<mx:horizontalAxis>
				<mx:CategoryAxis dataProvider="{expenses}" categoryField="Month"/>
			</mx:horizontalAxis>
			<mx:series>
				
				<mx:ColumnSeries xField="Month" yField="Profit" displayName="Profit" />
				<mx:ColumnSeries xField="Month" yField="Expenses" displayName="Expenses" />
				
			</mx:series>
		</mx:ColumnChart>
		<mx:Legend dataProvider="{myChart}"/>
	</mx:Panel>
</mx:Application>

Open in new window

0
 

Author Closing Comment

by:eduardo12fox
ID: 36813943
Very good it was what I needed! Thank you was very very good!

The cool thing about this site that is an example to every problem because often the person has already tried google already seen the documentation but can not implement this site and we got a practical use

I usually do when I get link, do not usually look for the most part I've gone through the link and did not understand, but here the staff almost always put a step by step how to do

Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Working from home is a dream for many people who aren’t happy about getting up early, going to the office, and spending long hours at work. There are lots of benefits of remote work for employees.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question