public List <SumYearlyCourse> GetpieChart() { List <@SumYearlyCourse> chartData = new List <@SumYearlyCourse>(); try { wcf.parti.Service1 _parti = new wcf.parti.Service1(); partiDB.RootObject rootObject = new partiDB.RootObject(); string json_str = _parti.SumYearlyCourse(); rootObject = JsonConvert.DeserializeObject <partiDB.RootObject>(json_str); foreach (var vl in rootObject.SumYearlyCourse) { chartData.Add(new SumYearlyCourse(vl.course, vl.total, vl.course + ", " + vl.total.ToString("N"))); } } catch (Exception ex) { MessageBox.swalModal(this.Page, "error", "en:internal error[" + ex.Message.Replace("'", "") + "]", ""); } return(chartData); }