[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

FLEX + Line Chart + Date Display

Posted on 2009-12-28
2
Medium Priority
?
618 Views
Last Modified: 2012-05-08
I am testing creating a line graph with Flex 3 - it has 4 series and everything display properly but the date on the horizontal axis display month/year - where i want it to display as mm/dd/yyyy, the tutorial i was following uses the below code.  The date format from the xml is mm/dd/yyyy but i am guessing is a string so needs to convert it to a date, but it doesnt seem to display correctly in the graph.
// Create a DateTimeAxis horizontal axis.
		            var hAxis:DateTimeAxis = new DateTimeAxis();
		            hAxis.dataUnits = "WeekDate";
		            // Set this to false to display the leftmost label.
		            hAxis.alignLabelsToUnits = false;
		            // Take the date in its current format and create a Date
		            // object from it.
		            hAxis.parseFunction = createDate;
		            myChart.horizontalAxis = hAxis;



		        public function createDate(s:String):Date {
		            // Reformat the date input to create Date objects
		            // for the axis.
		            var a:Array = s.split("/");
		            
		            // The existing String s is in the format "MM/DD/YYYY". 
		            // To create a Date object, you pass "YYYY,MM,DD", 
		            // where MM is zero-based, to the Date() constructor.
		            var newDate:Date = new Date(a[2],a[0]-1,a[1]);
		            return newDate;
		        }

Open in new window

0
Comment
Question by:dkilby
2 Comments
 
LVL 11

Accepted Solution

by:
vindys80 earned 2000 total points
ID: 26135902
Hi,

I think you will get it correct if you specify dataUnits to days.

hAxis.dataUnits = "days";


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

Thanks,
Vindys
0
 

Author Closing Comment

by:dkilby
ID: 31670633
great thanks - i also had to add hAxis.labelUnits = "days';
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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…
In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

872 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