public static List <GraphData> GraphSDisp(string selectedText1, string selectedText2, string selectedText3, string frmdt, string todt) { DispatchDataOperation ddo = new DispatchDataOperation(); DataTable dt = new DataTable(); dt = ddo.GraphSupplierDispatch(selectedText1, selectedText2, selectedText3, frmdt, todt); List <GraphData> chartData = new List <GraphData>(); foreach (DataRow dr in dt.Rows) { chartData.Add(new GraphData { w = Convert.ToString(dr["SupplierName"]).Remove(12), x = (Convert.ToInt32(dr["No_of_dispatch"])) }); } return(chartData); }