In my chart I'm want to render lines and columns bars and want to dynamically set the values of these however no data is rendered even though its been received. I'm using Razor, MVC and my view looks like:
As you can see in bold I'm trying to set the Column, Line and Category series with the property values from my model TotalHours, GuestChecks and HourBand respectively. The read call works and Json data is returned in the form below however the chart is empty:
The model looks like:
Please help. Driving me crazy!
01.
@(Html.Kendo().Chart<
HourBandChartModel
>()
02.
.Name("chartWeeklyHours")
03.
.Title("Weekly Hours vs GCs")
04.
.DataSource(d =>
05.
d.Read(r => r.Action("WeeklyHoursVsGuestCheck","ForecastSummaryGraph", new { hutnumber = @ViewBag.HutNumber, week = @ViewBag.Week })))
06.
.Legend(
07.
legend => legend.Position(ChartLegendPosition.Top)
08.
)
09.
.ChartArea(
10.
chart => chart.Width(900).Height(500))
11.
.Series(series =>
12.
{
13.
series
14.
.Column(c => c.TotalHours)
15.
.Stack(true)
16.
.Color("#FFAE00")
17.
.Name("FCST Hours");
18.
series
19.
.Line(c => c.GuestChecks)
20.
.Name("GCs")
21.
.Color("#000000")
22.
.Axis("GCs");
23.
})
24.
.CategoryAxis(axis => axis.Categories(c => c.HourBand)
32.
.AxisCrossingValue(0, 24)
33.
.Labels(builder => builder .Rotation(90))
34.
)
35.
.ValueAxis(axis => axis
36.
.Numeric()
37.
.Title("hours")
38.
.Min(0).Max(60)
39.
)
40.
.ValueAxis(axis => axis
41.
.Numeric("GCs")
42.
.Title("GCs")
43.
.Color("#000000")
44.
.Min(0).Max(120)
45.
))
As you can see in bold I'm trying to set the Column, Line and Category series with the property values from my model TotalHours, GuestChecks and HourBand respectively. The read call works and Json data is returned in the form below however the chart is empty:
1.
{"HourBand":["08:30 TO 08:44","08:45 TO 08:59","09:00 TO 09:14","09:15 TO 09:29","09:30 TO 09:44","09:45 TO 09:59","10:00 TO 10:14","10:15 TO 10:29","10:30 TO 10:44","10:45 TO 10:59","11:00 TO 11:14","11:15 TO 11:29","11:30 TO 11:44","11:45 TO 11:59","12:00 TO 12:14","12:15 TO 12:29","12:30 TO 12:44","12:45 TO 12:59","13:00 TO 13:14","13:15 TO 13:29","13:30 TO 13:44","13:45 TO 13:59","14:00 TO 14:14","14:15 TO 14:29","14:30 TO 14:44","14:45 TO 14:59","15:00 TO 15:14","15:15 TO 15:29","15:30 TO 15:44","15:45 TO 15:59","16:00 TO 16:14","16:15 TO 16:29","16:30 TO 16:44","16:45 TO 16:59","17:00 TO 17:14","17:15 TO 17:29","17:30 TO 17:44","17:45 TO 17:59","18:00 TO 18:14","18:15 TO 18:29","18:30 TO 18:44","18:45 TO 18:59","19:00 TO 19:14","19:15 TO 19:29","19:30 TO 19:44","19:45 TO 19:59","20:00 TO 20:14","20:15 TO 20:29","20:30 TO 20:44","20:45 TO 20:59","21:00 TO 21:14","21:15 TO 21:29","21:30 TO 21:44","21:45 TO 21:59","22:00 TO 22:14","22:15 TO 22:29","22:30 TO 22:44","22:45 TO 22:59","23:00 TO 23:14","23:15 TO 23:29","23:30 TO 23:44","23:45 TO 23:59","08:00 TO 08:14","08:15 TO 08:29","00:00 TO 00:14","00:15 TO 00:29","00:30 TO 00:44","00:45 TO 00:59","01:00 TO 01:14","01:15 TO 01:29","01:30 TO 01:44","01:45 TO 01:59","02:00 TO 02:14","02:15 TO 02:29","02:30 TO 02:44","02:45 TO 02:59","03:00 TO 03:14","03:15 TO 03:29","03:30 TO 03:44","03:45 TO 03:59"],"GuestChecks":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.6870950136819702037093341442,5.4323052923971649283961570087,6.2562318952223273304930234815,8.302215778605969758695686634,11.986234206953644671253542133,15.133949330695317203420495954,10.933766737622301835390467521,15.922897377012719269275953013,14.327781343367204133067517661,9.645984320466688510349290632,12.429324848980508265476515872,9.845401284984459973332645456,10.641676202376483817987287683,8.925776082018158342296234009,11.024874872660178686169961838,10.369633291640308255593647797,9.796089572670810793898682470,12.065731902127977027517901032,15.306830620455298549977650831,12.680103474911442768763927566,11.890744376448765792980064392,15.541874733822365043792078810,22.635034805972250926443991782,20.078212524026518428252445470,25.769456639790301763168163418,26.568228435189089645620353290,31.422432578176282726455964472,34.961916031422341072867055287,35.351623416190162610425511464,42.618806500469603977793045234,45.754127724007935398948886367,50.766125123078935124979965920,47.395183195739208008443456131,51.093378012588750673569195519,45.943773042578171380959348957,44.394986572567142869467708363,40.967684125553898103876121554,34.644890908164853051332970573,34.032537220376213973745049750,30.012515326554615658578259615,25.151990821775101801652908783,19.165127263440938757842228920,14.144022089319294761630903445,16.878605044235780505127701259,17.304076264218793737861259611,9.120920924679328592035034514,8.303104190382729195458045860,3.5046744557889760486326145604,2.3986441983253042488035707965,1.3403272558838929688653786770,0.6810727503815188253247944721,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"TotalHours":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.6870950136819702037093341442,5.4323052923971649283961570087,6.2562318952223273304930234815,8.302215778605969758695686634,11.986234206953644671253542133,15.133949330695317203420495954,10.933766737622301835390467521,15.922897377012719269275953013,14.327781343367204133067517661,9.645984320466688510349290632,12.429324848980508265476515872,9.845401284984459973332645456,10.641676202376483817987287683,8.925776082018158342296234009,11.024874872660178686169961838,10.369633291640308255593647797,9.796089572670810793898682470,12.065731902127977027517901032,15.306830620455298549977650831,12.680103474911442768763927566,11.890744376448765792980064392,15.541874733822365043792078810,22.635034805972250926443991782,20.078212524026518428252445470,25.769456639790301763168163418,26.568228435189089645620353290,31.422432578176282726455964472,34.961916031422341072867055287,35.351623416190162610425511464,42.618806500469603977793045234,45.754127724007935398948886367,50.766125123078935124979965920,47.395183195739208008443456131,51.093378012588750673569195519,45.943773042578171380959348957,44.394986572567142869467708363,40.967684125553898103876121554,34.644890908164853051332970573,34.032537220376213973745049750,30.012515326554615658578259615,25.151990821775101801652908783,19.165127263440938757842228920,14.144022089319294761630903445,16.878605044235780505127701259,17.304076264218793737861259611,9.120920924679328592035034514,8.303104190382729195458045860,3.5046744557889760486326145604,2.3986441983253042488035707965,1.3403272558838929688653786770,0.6810727503815188253247944721,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],"FixedHours":[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]}
The model looks like:
01.
public
class
HourBandChartModel
02.
{
03.
public
IEnumerable<
string
> HourBand
04.
{
05.
get
;
set
;
06.
}
07.
08.
public
IEnumerable<
decimal
> GuestChecks
09.
{
10.
get
;
11.
set
;
12.
}
13.
14.
public
IEnumerable<
decimal
> TotalHours
15.
{
16.
get
;
17.
set
;
18.
}
19.
20.
public
IEnumerable<
decimal
> FixedHours
21.
{
22.
get
;
23.
set
;
24.
}
25.
}