For my data in the following class:
public
class
MyModel
{
public
double
Value {
get
;
set
; }
public
DateTime Date {
get
;
set
; }
}
I have a chart with the following configuration:
@(Html.Kendo().Chart<MyModel>()
.Name(
"MyChart"
)
.Series(series =>
{
series.ScatterLine(MyIEnumerableData)
.Fields(
"Date"
,
"Value"
)
.Style(ChartScatterLineStyle.Smooth)
.Markers(m => m.Visible(
false
))
.Highlight(h => h.Visible(
false
))
.Labels(
false
)
.Name(
"Series1"
);
})
.XAxis(x => x
.Date()
.Title(title => title.Text(
"Date"
))
)
.YAxis(y => y
.Numeric()
.Title(title => title.Text(
"Value"
))
)
)
The axis range is correct, but the line is not displayed.
Examining the data contained in the widget on the page, the Date field is populated with (example): "/Date(1156934074549)/" instead of correctly-formed datetimes.
If I change my model to use a string instead of a datetime, and convert the datetime with .toString("yyyy-MM-dd HH:mm:ss"), the kendo widget appears to understand the data correctly, and it draws the line. This is fine as a workaround, but I should not need to convert the data like this.
Why does the kendo widget not understand datetime data? There is no override when specifying the fields to indicate the data type, and there is no method in the series definition to do this, either.