private void LoadDataIncome() { List <WealthyInfo> WealthyList1 = new List <WealthyInfo>(); List <WealthyInfo> WealthyList2 = new List <WealthyInfo>(); DataTable dtAllCol = commonWorkShopRecordBLL.GetAllGroupByTime(); DateTime dt; double numTemp = 0; if (dtAllCol != null && dtAllCol.Rows.Count > 0) { for (int k = 0; k < dtAllCol.Rows.Count; k++)//获取所有的日期集合 { DataTable dtDetail = new DataTable(); dtDetail = commonWorkShopRecordBLL.GetNumByTime("a", dtAllCol.Rows[k]["time"].ToString()); DateTime.TryParse(dtAllCol.Rows[k]["time"].ToString(), out dt); if (dtDetail != null && dtDetail.Rows.Count > 0) { double.TryParse(dtDetail.Rows[0]["shengchanshu"].ToString(), out numTemp); WealthyList1.Add(new WealthyInfo() { AmountExpensesMoney = numTemp, AmountIncomeMoney = numTemp, DeposiTime = dt, ProductName = dt.ToString("yyyy-MM-dd") }); } dtDetail = commonWorkShopRecordBLL.GetNumByTime("b", dtAllCol.Rows[k]["time"].ToString()); if (dtDetail != null && dtDetail.Rows.Count > 0) { double.TryParse(dtDetail.Rows[0]["shengchanshu"].ToString(), out numTemp); WealthyList2.Add(new WealthyInfo() { AmountExpensesMoney = numTemp, AmountIncomeMoney = numTemp, DeposiTime = dt, ProductName = dt.ToString("yyyy-MM-dd") }); } } } // WealthyList = new WealthyBLL().GetWealthyIncomeInfoModels(); ChartControl chart1 = new ChartControl(); chart1.BindChart(WealthyList1, "a"); elementHost1.Child = chart1; ChartControl chart2 = new ChartControl(); chart2.BindChartExpense(WealthyList2, "b"); elementHost2.Child = chart2; }