Hi Akhil,
Using the FormatExpressions for the Series Definition's ItemLabelFormat won't be helpful to you as you can't have such complex format in it. In fact you'll have to prepare the format for the value at the time you bind the chart. The following sample demonstrates what I mean:
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
List<TradeData> data =
new
List<TradeData>();
Random r =
new
Random();
for
(
int
i = 0; i < 10; i++)
{
data.Add(
new
TradeData() { Value = i, Minutes = r.Next(0, 2000) });
}
radChart.ItemsSource = data;
SeriesMapping mappingStartUpTime =
new
SeriesMapping();
ItemMapping timeMappingTime =
new
ItemMapping(
"SecondsFormatted"
, DataPointMember.Label);
ItemMapping timeMapping =
new
ItemMapping(
"Minutes"
, DataPointMember.YValue);
timeMappingTime.FieldType =
typeof
(
double
);
timeMapping.FieldType =
typeof
(
double
);
mappingStartUpTime.ItemMappings.Add(timeMappingTime);
mappingStartUpTime.ItemMappings.Add(timeMapping); ;
radChart.SeriesMappings.Add(mappingStartUpTime);
}
public
class
TradeData
{
public
double
Value
{
get
;
set
;
}
public
double
Minutes
{
get
;
set
;
}
public
string
SecondsFormatted
{
get
{
TimeSpan formattedValue = TimeSpan.FromMinutes(Minutes);
return
(
string
.Format(
"{0:00}:{1:00}:{2:00}"
, formattedValue.Days, formattedValue.Hours, formattedValue.Minutes)
);
}
}
}
}
I used another string property (SecondsFormatted) which returns the formatted minutes of a TimeSpan. Then bound it to the Label DataPointMember of RadChart's ItemMapping (marked in yellow) and voilà.
Regards,
Evgenia
the Telerik team