FLEX + Line Chart + Date Display

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

Who is Participating?

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

hAxis.dataUnits = "days";


dkilbyAuthor Commented:
great thanks - i also had to add hAxis.labelUnits = "days';
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.