Skip to main content

Microsoft Silverlight

Answered Question DateTimeAxis DisabledDaysRSS Feed

(0)

javroch
javroch

Member

Member

5 points

12 Posts

DateTimeAxis DisabledDays

I was wondering if the DateTimeAxis class has a way to set specific dates or ranges of dates for skipping / exclusion? For example, I might not want a stock chart to show weekends / holidays.

dcherman
dcherman

Member

Member

2 points

4 Posts

Re: DateTimeAxis DisabledDays

 I didnt' see one, but what about just not charting those days?

 

Doing something like:

 

DateTime dateToChart;

 

string[] weekends = {Saturday, Sunday};

 

DateTime[] holidays = { new DateTime(7/4/2009),

new DateTime(12/25/2009)

}

 

if (weekends.Contains(dateToChart.Day.ToString()) || holidays.contains(dateToChart))

\\Skip this date

else

\\Do something


 You could pull the listing of holidays from a WCF service or something based on whatever holidays your company observes (or you don't want charted). 

 

Code was written w/o testing so I'm sure theres typos.

javroch
javroch

Member

Member

5 points

12 Posts

Re: DateTimeAxis DisabledDays

The issue is that, if you do what you're saying, it still leaves a blank day on the x-axis and simply connects the dot of the point before this day to the dot of the point after this day, with a wider gap between the two points than had their not been a day between those two days at all. For example, on a stock chart, it would connect Friday's stock price via a line to Monday's stock price, however Saturday and Sunday's prices are not somewhere on the line connecting Friday's data point to Monday's, the stock was simply not traded on those days. I have submit an issue via code plex - http://silverlight.codeplex.com/WorkItem/View.aspx?WorkItemId=3374. Maybe the description provided there is more sufficient. In essence, I'm providing an alternate solution to the issue raised at http://silverlight.codeplex.com/WorkItem/View.aspx?WorkItemId=3223. However, I don't think this should require inheriting from DateTimeAxis and creating a custom axis type. I don't see why this isn't standard functionality for the DateTimeAxis object to begin with.

javroch
javroch

Member

Member

5 points

12 Posts

Answered Question

Re: Re: DateTimeAxis DisabledDays

Just FYI, I have submit a patch which would add DisabledDays and DisabledDates properties to the DateTimeAxis, for specifying days of the week that you would like the axis to skip or specific dates that you would like the axis to skip. I'm waiting to see if this change gets accepted / denied.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities