Hello Raj,
You can use the built-in filtering functionality to achieve the desired effect (note that you will need to introduce one additional read-only property of type
System.DayOfWeek that will be used by the filtering mechanism):
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
var rand =
new
Random(123456);
List<ChartData> data =
new
List<ChartData>();
for
(
int
i = 0; i < 21; i++)
{
data.Add(
new
ChartData() { Date = DateTime.Today.AddDays(i), Value = rand.Next(10, 100) });
}
SeriesMapping sm =
new
SeriesMapping();
sm.SeriesDefinition =
new
BarSeriesDefinition();
sm.ItemMappings.Add(
new
ItemMapping(
"Date"
, DataPointMember.XCategory));
sm.ItemMappings.Add(
new
ItemMapping(
"Value"
, DataPointMember.YValue));
sm.FilterDescriptors.Add(
new
ChartFilterDescriptor(
"FormattedDate"
,
typeof
(DayOfWeek), FilterOperator.IsNotEqualTo, DayOfWeek.Saturday));
sm.FilterDescriptors.Add(
new
ChartFilterDescriptor(
"FormattedDate"
,
typeof
(DayOfWeek), FilterOperator.IsNotEqualTo, DayOfWeek.Sunday));
RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"ddd"
;
RadChart1.SeriesMappings.Add(sm);
RadChart1.ItemsSource = data;
}
}
public
class
ChartData
{
public
DateTime Date
{
get
;
set
;
}
public
DayOfWeek FormattedDate
{
get
{
return
this
.Date.DayOfWeek;
}
}
public
double
Value
{
get
;
set
;
}
}
Hope this helps.
All the best,
Freddie
the Telerik team
Browse the
videos here>> to help you get started with RadControls for Silverlight