You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Manohar Joshi (JIRA)" <ji...@apache.org> on 2013/10/11 22:18:42 UTC

[jira] [Created] (FLEX-33816) DateTimeAxis skips labels for consecutive dates in disabledRanges & disabledDays

Manohar Joshi created FLEX-33816:
------------------------------------

             Summary: DateTimeAxis skips labels for consecutive dates in disabledRanges & disabledDays
                 Key: FLEX-33816
                 URL: https://issues.apache.org/jira/browse/FLEX-33816
             Project: Apache Flex
          Issue Type: Bug
          Components: Charts
            Reporter: Manohar Joshi
            Priority: Minor


Steps to reproduce:
-Create a chart with DateTimeAxis with below sample data below.
-Apply dataUnits="weeks"
-Apply disabledDays of [0,6]
-Apply disabledRanges containing say Aug 26, which is Monday.
-So, we have 3 consecutive disabled dates.

Expected result:
Chart to show labels at equal intervals.

Actual result:
Chart will skip a label 8/27, creating a gap.

Workaround (if any):
Modify DateTimeAxis to replace all occurrences of:
i = tmp.time;
by
i = dateSkipOffDays(tmp.time);

Add following functions:
				public function dateSkipOffDays(time:Number):Number
				{
					var pDate:Date = new Date(time);
					var holidays:Array = disabledRanges;
					if( ! ( isWeekend(pDate) || isHoliday(pDate) )   )
						return pDate.time;
					else {
						pDate.setDate(pDate.getDate() + 1);
						return dateSkipOffDays(pDate.time);
					}
				}
				
				public function isHoliday(pDate:Date):Boolean
				{
					var holidays:Array = disabledRanges;
					if(holidays) {
						for(var i:int=0; i<holidays.length; i++){
							var date:Date = holidays[i];
							var diff:int = dateDiff(date,pDate);
							if(diff==0)
								return true;
						}
					}
					return false;
				}
				
				public static function dateDiff(pStartDate:Date, pEndDate:Date):int
				{
					var _differenceDays:int=Math.ceil((pEndDate.getTime() - pStartDate.getTime()) / MILLISECONDS_IN_DAY);
					return _differenceDays;
				}
				
				public function isWeekend(pDate:Date):Boolean
				{
					if (pDate.day == 0)
					{
						return true;
					}
					else if (pDate.day == 6)
					{
						return true;
					}
					return false;
				}				


Sample data:
8/12/2013	197.75
8/13/2013	198.48
8/14/2013	198.45
8/15/2013	198.34
8/16/2013	197.58
8/19/2013	197
8/20/2013	197.46
8/21/2013	197.11
8/22/2013	197.47
8/23/2013	197.67
8/27/2013	197
8/28/2013	196.86
8/29/2013	196.66
8/30/2013	196.71
9/3/2013	196.79
9/4/2013	196.57
9/5/2013	196.99
9/6/2013	196.41
9/9/2013	197.09




--
This message was sent by Atlassian JIRA
(v6.1#6144)