I am working with a Kendo Chart using the MVC wrappers which I need to add series to at runtime based on data in my Model
I have verified that my model does contain valid data when the chart is about to be rendered
The view's model is a chart widget object which contains a series list
This is simply a list of chart series
Budget Chart Widget
namespace STC.Widgets.Budgeting
{
using System;
using System.Collections.Generic;
using Budget;
using Extensions;
using Helpers;
public class BudgetChartWidget
{
public BudgetChartWidget()
{
SeriesList = new List<IBudgetChartSeries>();
}
public List<IBudgetChartSeries> SeriesList { get; set; }
public string ChartTitle { get; set; }
}
}
**Budget Chart Series**
namespace STC.Widgets.Data.Budgeting
{
using System.Collections.Generic;
public class BudgetChartSeries : IBudgetChartSeries
{
public BudgetChartSeries(string seriesName)
{
Values = new List<IChartValue>();
SeriesName = seriesName;
}
public string SeriesName { get; set; }
public List<IChartValue> Values { get; set; }
}
}
Each chart series then contains values
IChartValue
namespace STC.Widgets.Data.Budgeting
{
using System;
public interface IChartValue
{
string DisplayValue { get; set; }
DateTime Period { get; set; }
double? Value { get; set; }
}
}
Partial View for chart
@using STC.Widgets.Data.Budgeting
@model STC.Widgets.Budgeting.BudgetChartWidget
<div>
@(Html.Kendo().Chart(Model.SeriesList)
.Theme((string) ViewBag.ThemeName)
.Name("BudgetViewer" + 1)
.Series(series =>
{
foreach (var item in Model.SeriesList)
{
series.Column(item.Values).Field("Value").CategoryField("DisplayValue").Name(item.SeriesName);
}
})
.Legend(legend => legend.Position(ChartLegendPosition.Bottom).Visible(true))
.ValueAxis(axis => axis.Numeric()
.MajorGridLines(lines => lines.Visible(true))
.NarrowRange(true)
.Labels(labels => labels.Format("{0:N0}"))
.Line(line => line.Visible(true))
.Crosshair(crosshair => crosshair.Visible(true)
.Tooltip(t => t.Visible(true)))
)
.CategoryAxis(axis => axis
.Labels(labels => labels.Rotation(-90))
.MajorGridLines(lines => lines.Visible(false))
.Crosshair(crosshair => crosshair.Visible(true)
.Tooltip(t => t.Visible(true)))
)
.Tooltip(tooltip => tooltip.Visible(true).Format("{0:N0}").Shared(true)))
</div>
When I run this the series are shown in the bottom legend but no data shows in the graph
I have checked and there are no Javascript errors
When I use Internet Explorer to view the source of the chart I can see that the data is there
I cant see anything wrong with the way I have created each series, I have even tried varying ways of passing the parameters.
The only one that is relevant to my situation is the one I am using
Can anyone see if I have missed something really obvious please?
Paul