private void statisticsClick(object sender, RoutedEventArgs e) { if (chartType.Text == "柱状图") { ButColumn1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButColumn1)); } if (chartType.Text == "饼状图") { ButPie1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButPie1)); } if (chartType.Text == "折线图") { ButSpline1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButSpline1)); } }
private void statisticsClick(object sender, RoutedEventArgs e) { if (childBox.Text == "") { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "未选择对应子项!"); } )); } else { startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (startMonth > endMonth) { MessageBoxX.Show("提示", "时间设置不正常"); return; } if (endYear != startYear) { MessageBoxX.Show("提示", "不支持跨年查询!"); } else if (endYear == startYear) { mouth.Clear(); //刷新 strListx1.Clear(); //清空 strListy1.Clear(); //清空 LsTime1.Clear(); //清除 startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (startYear == endYear) { if (title == "圈层报警") { dic = count.CountCircleProtectAreaAlarm(startYear, startMonth, endMonth, type); tip = 1; } else if (title == "多边形报警") { dic = count.CountPolygonAlarm(startYear, startMonth, endMonth, type); tip = 2; } else if (title == "管道报警") { dic = count.CountPipelineAlarm(startYear, startMonth, endMonth, type); tip = 3; } else if (title == "平台中心报警") { list = count.CountPlantformAlarm(startYear, startMonth, endMonth, type); tip = 4; } else if (title == "所有区域报警") { list = count.CountAllAlarm(startYear, startMonth, endMonth, type); tip = 5; } } if (tip == 1) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 2) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 3) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 4) { for (int i = 0; i < list.Count; i++) { mouth.Add(list[i].ToString()); } ; } else if (tip == 5) { for (int i = 0; i < list.Count; i++) { mouth.Add(list[i].ToString()); } ; } //数据层 for (int a = startMonth; a <= endMonth; a++) { strListx1.Add(mouthStr[a]); strListy1.Add(mouth[a - startMonth]); LsTime1.Add(new DateTime(startYear, a, 1)); } if (chartType.Text == "柱状图") { ButColumn1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButColumn1)); } if (chartType.Text == "饼状图") { ButPie1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButPie1)); } if (chartType.Text == "折线图") { ButSpline1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButSpline1)); } } } }