Problem getting arrays to render pie chart correctly

Aug 31, 2015 at 5:39 PM
I am working in MVC 4 and have a query that pulls back data. I want to display it in a pie chart. However, when I run the application, the chart renders as a series of curved lines instead of a pie chart. The values are all set to 0 even though when I debug, the values are as expected. What am I missing? Here is my controller:
        var piedata = cardlist.Select(t => new { t.Title, t.MainTypeID }).ToList();
        var piearray = cardlist.Select(t => t.MainType.Title).ToList();
        var pievalues = piearray.GroupBy(c => c, (a, b) => string.Format("{0} {1}", b.Count(), a)).ToArray();

        string first = " ";
        string second = " ";
        string xvalues = " ";
        string yvalues = " ";
        List<String> xx = new List<string>();
        List<String> yy = new List<string>();
        foreach (var item in pievalues)
        {
            first = item.ToString().Substring(0, item.IndexOf(" "));
            second = item.ToString().Substring(item.IndexOf(" ") + 1);
            xx.Add(first);
            yy.Add(second);
        }
        for (int i = 0; i < xx.Count; i++)
        {

            if (i == xx.Count - 1)
            {
                xvalues = xvalues + xx[i];
            }
            else
            {
                xvalues = xvalues + xx[i] + " , ";
            }

        }

        var YValue = xvalues.Split(',').ToArray();

        for (int i = 0; i < yy.Count; i++)
        {

            if (i == yy.Count - 1)
            {
                yvalues = yvalues + yy[i];
            }
            else
            {
                yvalues = yvalues + yy[i] + " , ";
            }

        }
        var XValue = yvalues.Split(',').ToArray();


        var pieChart = new DotNet.Highcharts.Highcharts("pie")
        .InitChart(new DotNet.Highcharts.Options.Chart { DefaultSeriesType = ChartTypes.Pie })
        .SetTitle(new Title { Text = "Card Type Distribution" })
        .SetXAxis(new XAxis { Categories = XValue })
        .SetYAxis(new YAxis { Title = new YAxisTitle { Text = " Y Title" } })
         .SetSeries(new[]
                {
                    new Series {Name = "Type", Data = new Data(YValue)},

                });