I'm looking at DotNet.HighCharts and just starting to try to understand it. I was thinking of doing something more "simple" just to get the hang of it like the pie chart.
I looked at the following link DotNet HighCharts , Populates a pie with the result of a query and wanted to try to populate the data from code behind. I wanted to dumb-it-down a lot just so i can learn and understand it. Learn how to crawl first before i learn to run with it and populate from the database.
I'm thinking that I'm not understanding how to set up the series data correctly. This is how I'm populating a series object:
var browers = new List<object[]>();
browers.Add(new object[] { "Firefox", 35.0 });
browers.Add(new object[] { "IE", 25 });
browers.Add(new object[] { "Safari", 20 });
browers.Add(new object[] { "Opera", 15 });
browers.Add(new object[] { "Others", 5 });
List<Series> browserSeries = new List<Series>();
//I think this is causing the problem
browserSeries.Add(new Series
{
Name = "Browsers",
Data = new Data(browers.ToArray())
});
And then it is done here just like the link:
.SetSeries(new Series
{
Type = ChartTypes.Pie,
Name = "Browser share",
Data = new Data(browserSeries.Select(b => new { Name = b.Name, Y = b.Data }).ToArray())
});
Currently the chart does not display any data. It's just blank. Can someone point me in the right direction of what i've done wrong?
Thanks a lot for the help.
I broke it down and tried to understand what I was doing wrong. For a pie chart I didn't need a series. So basically when the list of objects was created I just needed to set the data to that list like:
And the pie chart appeared perfectly. Yes, I made a spelling mistake with "browers" ... but at least the pie chart is showing up now :)