private void fillChart(string year, string type) { //fill chart chtRoom.Series["Bookings"].Points.Clear(); //get data from database DataSet ds = new DataSet(); ds = Reservations.getRoomType(ds, year, type); //add values in array to chart series int j = 0; for (int i = 1; i <= 12; i++) { if ((j == ds.Tables["ss"].Rows.Count) || (i < Convert.ToInt32(ds.Tables[0].Rows[j][0]))) { chtRoom.Series["Bookings"].Points.AddXY(getMonthName(i), 0); } else { chtRoom.Series["Bookings"].Points.AddXY(getMonthName(i), Convert.ToDecimal(ds.Tables[0].Rows[j][1])); j++; } } }