This question is locked. New answers and comments are not allowed.
Hi. there is not problem with using DateTime and setting format for it in a chart. for example the "dd-yyyy" format will convert it correctly. but i want to use CustomDateTime and assign it to value of an axis. the CustomDateTime is the following:
public string ToString(string format, IFormatProvider provider)
{
return this.dateTime.ToString(format, provider);
}
and using it:
but it doesn't work. what is wrong in the above codes?
public
struct
CustomDateTime : IFormattable
{
private
DateTime dateTime;
public
CustomDateTime(
int
year,
int
month,
int
day)
{
this
.dateTime =
new
DateTime(year, month, day);
}
public string ToString(string format, IFormatProvider provider)
{
return this.dateTime.ToString(format, provider);
}
public
string
ToString(IFormatProvider provider)
{
return
this
.dateTime.ToString(provider);
}
....
}
and using it:
RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat =
"MMMM yyyy"
;
testMapping.ItemMappings.Add(
new
ItemMapping(
"CustomDateTime
"
, DataPointMember.XValue));
but it doesn't work. what is wrong in the above codes?