private void MarkVariationComboBox_SelectedIndexChanged(object sender, EventArgs e) { MarkInfoTuple tuple = ((ComboBox)sender).SelectedItem as MarkInfoTuple; ucQuickAnalysis analysisPanel = _mainForm.PanelAnalysis.Controls.OfType <ucMarkAnalysis>().First().Controls.OfType <ucQuickAnalysis>().First(); analysisPanel.SetAnalysisStrings(getAnalysisStrings(_analysisIndex, tuple)); analysisPanel.SetTextBoxes(GetMarkValues(tuple), false); }
private AnalysisStrings getAnalysisStrings(int analysisIndex, MarkInfoTuple tuple) { var parameters = DBHelper.GetAnalysisParameters(analysisIndex + 1); string[] labels = new string[6]; labels[0] = tuple.RowMark.Name; if (tuple.RowMark.Qualitative) { if (tuple.RowMark.Items.Distinct().Count() == 2) { labels[1] = tuple.RowMark.Items.Select(e => e.ToString()).First(e => !e.Equals(tuple.RowValue)); } else { labels[1] = "Другие варианты"; } labels[2] = tuple.RowValue; } else { labels[1] = ">=" + tuple.RowMark.Border; labels[2] = "<" + tuple.RowMark.Border; } labels[3] = tuple.ColumnMark.Name; if (tuple.ColumnMark.Qualitative) { labels[4] = tuple.ColumnValue; if (tuple.ColumnMark.Items.Distinct().Count() == 2) { labels[5] = tuple.ColumnMark.Items.Select(e => e.ToString()).First(e => !e.Equals(tuple.ColumnValue)); } else { labels[5] = "Другие варианты"; } } else { labels[4] = "<" + tuple.ColumnMark.Border; labels[5] = ">=" + tuple.ColumnMark.Border; } return(new AnalysisStrings() { Labels = labels, Parameters = parameters[analysisIndex] }); }
public int[,] GetMarkValues(MarkInfoTuple tuple) { int[,] values = new int[2, 2]; List <object> tupleList_1 = tuple.RowMark.ItemsWithNull; List <object> tupleList_2 = tuple.ColumnMark.ItemsWithNull; int maxLength = tupleList_1.Count < tupleList_2.Count ? tupleList_1.Count : tupleList_2.Count; int row = -1, column = -1; for (int i = 0; i < maxLength; i++) { if (tupleList_1[i] == null || tupleList_2[i] == null) // пропуск, если отсутствует значение хотя бы в одном столбце { continue; } if (tuple.RowMark.Qualitative) { if (tupleList_1[i].Equals(tuple.RowValue)) { row = 0; } else { row = 1; } } else { if (int.Parse(tupleList_1[i].ToString()) < int.Parse(tuple.RowValue.ToString())) { row = 0; } else { row = 1; } } if (tuple.ColumnMark.Qualitative) { if (tupleList_2[i].Equals(tuple.ColumnValue)) { column = 0; } else { column = 1; } } else { if (int.Parse(tupleList_2[i].ToString()) < int.Parse(tuple.ColumnValue)) { column = 0; } else { column = 1; } } values[row, column]++; } return(values); }