Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit DateTimeAxis DisabledDays
3 replies. Latest Post by javroch on June 30, 2009.
(0)
javroch
Member
5 points
12 Posts
06-29-2009 3:06 PM |
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
2 points
4 Posts
06-29-2009 4:10 PM |
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.
06-29-2009 4:25 PM |
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.
06-30-2009 3:02 PM |
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.