protected void DrawSequencePie(DataTable dtTable) { DataView dv = dtTable.DefaultView; dv.Sort = "Frequency DeSC"; DataTable dtTableCopy = dv.ToTable(); int rows = dtTableCopy.Rows.Count; if (rows > 0 && rows <= 10) // { int[] dataInts = new int[rows]; string[] textStrings = new string[rows]; string[] colorStrings = new string[rows]; for (int i = 0; i < rows; i++) { dataInts[i] = int.Parse(dtTableCopy.Rows[i][2].ToString()); textStrings[i] = dtTableCopy.Rows[i][0].ToString(); colorStrings[i] = OutputResult.GetRandomColor(); } ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>drawCircle('canvas_seq', " + dataInts + "," + colorStrings + ", " + textStrings + ");</script>", true); } else { int[] dataInts = new int[11]; string[] textStrings = new string[11]; string[] colorStrings = new string[11]; int k = 0; for (int i = 0; i < 10; i++) { dataInts[i] = int.Parse(dtTableCopy.Rows[i][2].ToString()); textStrings[i] = dtTableCopy.Rows[i][0].ToString(); colorStrings[i] = OutputResult.GetRandomColor(); } for (int i = 10; i < rows; i++) { k = k + int.Parse(dtTableCopy.Rows[i][2].ToString()); } colorStrings[10] = OutputResult.GetRandomColor(); dataInts[10] = k; textStrings[10] = "Other Words"; ClientScript.RegisterStartupScript(ClientScript.GetType(), "", "<script>drawCircle('canvas_seq', " + dataInts + "," + colorStrings + ", " + textStrings + ");</script>", true); } }