0π
I resolved the problem thusly, because the HighChart data expects its own formatted ColumnSeriesData β for whatever strange reason the devs decided to do this, you canβt pass in a generic list:
IDictionary<string, ColumnSeries> columnSeries = new Dictionary<string, ColumnSeries>();
foreach (var seriesId in seriesIds)
{
var seriesName = _seriesRepository.GetSeriesName(seriesId);
var seriesTotalsByLast6Months = _seriesRepository.GetSeriesTotalsByLast6Months(seriesId);
List<ColumnSeriesData> columnSeriesData = new List<ColumnSeriesData>();
seriesTotalsByLast6Months.ForEach(p => columnSeriesData.Add(new ColumnSeriesData { Y = p.Amount }));
columnSeries[seriesId.ToString()] = new ColumnSeries
{
Name = seriesName.First(),
Data = columnSeriesData
};
}
And for the loop to add the column series data to the chart (where chartOptions is the name of your HighChart):
foreach (var x in columnSeries.Values)
{
//add column series to the chart
chartOptions.Series.Add(x);
}
Source:stackexchange.com