public void getcartesianChart3() { DateTime NOW = DateTime.Now; if (DateTime.Compare(NOW, OperateForm.end_time) > 0) { NOW = OperateForm.end_time; } if (DateTime.Compare(NOW, OperateForm.start_time) < 0) { NOW = OperateForm.start_time; } TimeSpan timeSpan = NOW - OperateForm.start_time; int len = (int)double.Parse(timeSpan.TotalMinutes.ToString()); len = Math.Min(300, len); len = Math.Max(0, len); len /= 10; cartesianChart3.Series.Clear(); for (int i = 0; i < 4; ++i) { StackedColumnSeries stackedColumnSeries = new StackedColumnSeries(); stackedColumnSeries.StackMode = StackMode.Values; stackedColumnSeries.DataLabels = false; stackedColumnSeries.Title = OperateForm.resultName[i]; stackedColumnSeries.Values = new ChartValues <double>(); DateTime st = OperateForm.start_time; DateTime nx = new DateTime(); for (int j = 0; j < len; ++j) { nx = st.AddMinutes(10); try { if (OperateForm.result[i] != 4) { stackedColumnSeries.Values.Add(-double.Parse(DBTool.getTotSubmitByStEdAndResult(st.ToString(), nx.ToString(), OperateForm.result[i]).ToString())); } else { stackedColumnSeries.Values.Add(double.Parse(DBTool.getTotSubmitByStEdAndResult(st.ToString(), nx.ToString(), OperateForm.result[i]).ToString())); } } catch (Exception ex) { print("网络连接中断!"); Application.Exit(); } st = nx; } cartesianChart3.Series.Add(stackedColumnSeries); } string[] labels2 = new string[len]; for (int i = 0; i < len; ++i) { labels2[i] = ((i + 1) * 10).ToString(); } cartesianChart3.AxisX.Clear(); cartesianChart3.AxisX.Add(new Axis { Labels = labels2, Separator = new Separator // force the separator step to 1, so it always display all labels { Step = 1, IsEnabled = false //disable it to make it invisible. }, LabelsRotation = 0 }); cartesianChart3.AxisY.Clear(); cartesianChart3.AxisY.Add(new Axis { LabelFormatter = value => value + "" }); }
public void getPieChart() { //提交分类统计 pieChart1.Series = new SeriesCollection { new PieSeries { Title = "RTE", Values = new ChartValues <double> { DBTool.getTotResult(10) }, PushOut = 15, DataLabels = true }, new PieSeries { Title = "WA", Values = new ChartValues <double> { DBTool.getTotResult(6) }, DataLabels = true }, new PieSeries { Title = "AC", Values = new ChartValues <double> { DBTool.getTotResult(4) }, DataLabels = true }, new PieSeries { Title = "TLE", Values = new ChartValues <double> { DBTool.getTotResult(7) }, DataLabels = true } }; //提交语言分类 pieChart2.Series = new SeriesCollection { new PieSeries { Title = "C", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(0) + DBTool.getTotResultBylanguage(13) }, PushOut = 15, DataLabels = true }, new PieSeries { Title = "C++", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(1) + DBTool.getTotResultBylanguage(14) }, DataLabels = true }, new PieSeries { Title = "JAVA", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(3) }, DataLabels = true }, new PieSeries { Title = "Python", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(6) + DBTool.getTotResultBylanguage(18) }, DataLabels = true } }; }
public MainPieChart() { InitializeComponent(); pieChart1.InnerRadius = 8; pieChart1.LegendLocation = LegendLocation.Right; pieChart2.InnerRadius = 8; pieChart2.LegendLocation = LegendLocation.Right; //提交分类统计 pieChart1.Series = new SeriesCollection { new PieSeries { Title = "RTE", Values = new ChartValues <double> { DBTool.getTotResult(10) }, PushOut = 15, DataLabels = true }, new PieSeries { Title = "WA", Values = new ChartValues <double> { DBTool.getTotResult(6) }, DataLabels = true }, new PieSeries { Title = "AC", Values = new ChartValues <double> { DBTool.getTotResult(4) }, DataLabels = true }, new PieSeries { Title = "TLE", Values = new ChartValues <double> { DBTool.getTotResult(7) }, DataLabels = true } }; //提交语言分类 pieChart2.Series = new SeriesCollection { new PieSeries { Title = "C", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(0) + DBTool.getTotResultBylanguage(13) }, PushOut = 15, DataLabels = true }, new PieSeries { Title = "C++", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(1) + DBTool.getTotResultBylanguage(14) }, DataLabels = true }, new PieSeries { Title = "JAVA", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(3) }, DataLabels = true }, new PieSeries { Title = "Python", Values = new ChartValues <double> { DBTool.getTotResultBylanguage(6) + DBTool.getTotResultBylanguage(18) }, DataLabels = true } }; }
public void getCartesianChart() { //cartesianChart1 队伍过题数统计 ColumnSeries columnSeries = new ColumnSeries(); columnSeries.DataLabels = true; columnSeries.LabelPoint = point => point.Y + ""; columnSeries.Values = new ChartValues <ObservableValue>(); for (int i = 1; i <= OperateForm.problemCnt; ++i) { try { columnSeries.Values.Add(new ObservableValue(double.Parse(DBTool.getProblemTeamByCnt(i).ToString()))); } catch (Exception ex) { print("网络连接中断!"); Application.Exit(); } } cartesianChart1.Series.Clear(); columnSeries.Title = "team"; cartesianChart1.Series.Add(columnSeries); string[] labels1 = new string[OperateForm.problemCnt]; for (int i = 0; i < OperateForm.problemCnt; ++i) { labels1[i] = (i + 1).ToString(); } cartesianChart1.AxisX.Clear(); cartesianChart1.AxisX.Add(new Axis { Labels = labels1, Separator = new Separator // force the separator step to 1, so it always display all labels { Step = 1, IsEnabled = false //disable it to make it invisible. }, LabelsRotation = 0 }); cartesianChart1.AxisY.Clear(); cartesianChart1.AxisY.Add(new Axis { LabelFormatter = value => value + " teams", Separator = new Separator() }); //cartesianChart2 题目提交分类统计 cartesianChart2.Series.Clear(); for (int i = 0; i < 4; ++i) { StackedColumnSeries stackedColumnSeries = new StackedColumnSeries(); stackedColumnSeries.StackMode = StackMode.Values; stackedColumnSeries.DataLabels = false; stackedColumnSeries.Title = OperateForm.resultName[i]; stackedColumnSeries.Values = new ChartValues <double>(); for (int j = 0; j < OperateForm.problemCnt; ++j) { try { if (OperateForm.result[i] != 4) { stackedColumnSeries.Values.Add(-double.Parse((DBTool.getTotResultByResultAndNum(OperateForm.result[i], j)).ToString())); } else { stackedColumnSeries.Values.Add(double.Parse((DBTool.getTotResultByResultAndNum(OperateForm.result[i], j)).ToString())); } } catch (Exception ex) { print("网络连接中断!"); Application.Exit(); } } cartesianChart2.Series.Add(stackedColumnSeries); } string[] labels2 = new string[OperateForm.problemCnt]; for (int i = 0; i < OperateForm.problemCnt; ++i) { labels2[i] = OperateForm.charMp[i]; } cartesianChart2.AxisX.Clear(); cartesianChart2.AxisX.Add(new Axis { Labels = labels2, Separator = new Separator // force the separator step to 1, so it always display all labels { Step = 1, IsEnabled = false //disable it to make it invisible. }, LabelsRotation = 0 }); cartesianChart2.AxisY.Clear(); cartesianChart2.AxisY.Add(new Axis { LabelFormatter = value => value + "" }); }
public void getcartesianChart(int num) { ChartValues <double> AC_Values = new ChartValues <double>(); ChartValues <double> Submit_Values = new ChartValues <double>(); DateTime NOW = DateTime.Now; DateTime last_time; if (DateTime.Compare(NOW, OperateForm.end_time) > 0) { NOW = OperateForm.end_time; } if (DateTime.Compare(NOW, OperateForm.start_time) < 0) { NOW = OperateForm.start_time; } last_time = NOW; TimeSpan timeSpan = NOW - OperateForm.start_time; DateTime st = OperateForm.start_time; DateTime nx = new DateTime(); int len = (int)double.Parse(timeSpan.TotalMinutes.ToString()); len = Math.Min(300, len); len = Math.Max(0, len); AC_Values.Add(0); Submit_Values.Add(0); for (int i = 0; i < len; i += 1) { nx = st.AddMinutes(1); try { AC_Values.Add(double.Parse(DBTool.getTotSubmitByStEdAndResultAndNum(st.ToString(), nx.ToString(), 4, num).ToString())); Submit_Values.Add(double.Parse(DBTool.getTotSubmitByStEdAndNum(st.ToString(), nx.ToString(), num).ToString())); } catch (Exception ex) { print("网络连接中断!"); Application.Exit(); } st = nx; } cartesianChart1.Series.Clear(); cartesianChart1.Series.Add(new LineSeries { Values = AC_Values, StrokeThickness = 2, StrokeDashArray = new System.Windows.Media.DoubleCollection(new double[] { 2 }), Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(107, 185, 69)), Fill = System.Windows.Media.Brushes.Transparent, LineSmoothness = 0, PointGeometrySize = 1, Title = "AC", }); cartesianChart1.Series.Add(new LineSeries { Values = Submit_Values, StrokeThickness = 2, Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(28, 142, 196)), Fill = System.Windows.Media.Brushes.Transparent, LineSmoothness = 1, PointGeometrySize = 1, PointForeground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 46, 49)), Title = "Submit" }); cartesianChart1.Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 46, 49)); cartesianChart1.AxisX.Add(new Axis { IsMerged = true, Separator = new Separator { Step = 20, StrokeThickness = 1, StrokeDashArray = new System.Windows.Media.DoubleCollection(new double[] { 2 }), Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(64, 79, 86)) } }); cartesianChart1.AxisY.Add(new Axis { IsMerged = true, Separator = new Separator { StrokeThickness = 1.5, StrokeDashArray = new System.Windows.Media.DoubleCollection(new double[] { 4 }), Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(64, 79, 86)) } }); }