private void fillChart(string year) { //fill chart chtYear.Series["Revenue"].Points.Clear(); //get data from database DataSet ds = new DataSet(); ds = Reservations.getMonthlyData(ds, year); //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]))) { chtYear.Series["Revenue"].Points.AddXY(getMonthName(i), 0); } else { chtYear.Series["Revenue"].Points.AddXY(getMonthName(i), Convert.ToDecimal(ds.Tables[0].Rows[j][1])); j++; } } }