Im using chartkick.js (which in turn uses chartjs) and I want to create the datastructure in C# for a multiple series chart, which looks like this json object:
series = [
{name: "User1", data: {"bananas": 3, "Apples": 4}},
{name: "User2", data: {"bananas": 5, "Apples": 3}}
]
note that in chartkick, an array of arrays will work to like so:
[["bananas", 3], ["Apples", 4]]
I've got a class to store each user's data:
public class GenericChartJsSeriesModel : ReportDataModel
{
public string Name { get; set; }
public ????? Data { get; set; }
}
I've tried alot, including:
Dictionary<string, int> //[{["bananas", 1]},{["appels", 1]}]
List<KeyValuePair<string, int>> //{ key: "bananas", value: 1}
string[][] //<- wont work because the values must be numeric
So the question basicly is: how to create
{"bananas": 3, "Apples": 4}
Or
[["bananas", 3], ["Apples", 4]]
Where the fruits are dynamic properties