- Timestamp:
- 07/08/15 15:32:12 (9 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
-
branches/HiveStatistics/sources/HeuristicLab.Data.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/HLScript/HeuristicLab.Data.Views merged eligible /stable/HeuristicLab.Data.Views merged eligible /trunk/sources/HeuristicLab.Data.Views merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Data.Views 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Data.Views 5516-5520 /branches/Benchmarking/sources/HeuristicLab.Data.Views 6917-7005 /branches/CloningRefactoring/HeuristicLab.Data.Views 4656-4721 /branches/CodeEditor/HeuristicLab.Data.Views 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Data.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Data.Views 5815-6180 /branches/DataAnalysis/HeuristicLab.Data.Views 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Data.Views 10085-11101 /branches/DataPreprocessingImprovements/HeuristicLab.Data.Views 12160-12675 /branches/GP.Grammar.Editor/HeuristicLab.Data.Views 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Data.Views 5060 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Data.Views 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Data.Views 6123-9799 /branches/LogResidualEvaluator/HeuristicLab.Data.Views 10202-10483 /branches/NET40/sources/HeuristicLab.Data.Views 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Data.Views 12033-12122 /branches/ParallelEngine/HeuristicLab.Data.Views 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Data.Views 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Data.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Data.Views 6828 /branches/RuntimeOptimizer/HeuristicLab.Data.Views 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Data.Views 7787-8333 /branches/SlaveShutdown/HeuristicLab.Data.Views 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Data.Views 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Data.Views 5370-5682 /branches/Trunk/HeuristicLab.Data.Views 6829-6865 /branches/UnloadJobs/HeuristicLab.Data.Views 9168-9215 /branches/VNS/HeuristicLab.Data.Views 5594-5752 /branches/histogram/HeuristicLab.Data.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/HiveStatistics/sources/HeuristicLab.Data.Views/3.3
- Property svn:mergeinfo changed
/branches/DataPreprocessingImprovements/HeuristicLab.Data.Views/3.3 (added) merged: 12161,12164-12165,12168,12500,12633 /trunk/sources/HeuristicLab.Data.Views/3.3 merged: 12602,12676,12682
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Data.Views/3.3/HeuristicLab.Data.Views-3.3.csproj
r12037 r12689 189 189 <DependentUpon>BoolValueView.cs</DependentUpon> 190 190 </Compile> 191 <Compile Include="BoolMatrixView.cs"> 192 <SubType>UserControl</SubType> 193 </Compile> 194 <Compile Include="BoolMatrixView.Designer.cs"> 195 <DependentUpon>BoolMatrixView.cs</DependentUpon> 196 </Compile> 191 197 <Compile Include="StringConvertibleMatrixVisibilityDialog.cs"> 192 198 <SubType>Form</SubType> -
branches/HiveStatistics/sources/HeuristicLab.Data.Views/3.3/StringConvertibleMatrixView.cs
r12151 r12689 109 109 dataGridView.Columns.Clear(); 110 110 virtualRowIndices = new int[0]; 111 } else 111 } else if (!dataGridView.IsCurrentCellInEditMode) { 112 112 UpdateData(); 113 } 113 114 } 114 115 … … 295 296 } 296 297 297 pr ivatevoid dataGridView_KeyDown(object sender, KeyEventArgs e) {298 protected virtual void dataGridView_KeyDown(object sender, KeyEventArgs e) { 298 299 if (!ReadOnly && e.Control && e.KeyCode == Keys.V) 299 300 PasteValuesToDataGridView(); … … 398 399 } 399 400 400 pr ivatevoid dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {401 protected virtual void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { 401 402 if (Content != null) { 402 403 if (e.Button == MouseButtons.Left && Content.SortableView) { 403 bool addToSortedIndices = (Control.ModifierKeys & Keys.Control) == Keys.Control; 404 SortOrder newSortOrder = SortOrder.Ascending; 405 if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) { 406 SortOrder oldSortOrder = sortedColumnIndices.Where(x => x.Key == e.ColumnIndex).First().Value; 407 int enumLength = Enum.GetValues(typeof(SortOrder)).Length; 408 newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString()); 409 } 410 411 if (!addToSortedIndices) 412 sortedColumnIndices.Clear(); 413 414 if (sortedColumnIndices.Any(x => x.Key == e.ColumnIndex)) { 415 int sortedIndex = sortedColumnIndices.FindIndex(x => x.Key == e.ColumnIndex); 416 if (newSortOrder != SortOrder.None) 417 sortedColumnIndices[sortedIndex] = new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder); 418 else 419 sortedColumnIndices.RemoveAt(sortedIndex); 420 } else 421 if (newSortOrder != SortOrder.None) 422 sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(e.ColumnIndex, newSortOrder)); 423 Sort(); 404 SortColumn(e.ColumnIndex); 424 405 } 425 406 } … … 438 419 dataGridView.Invalidate(); 439 420 } 421 422 protected virtual void SortColumn(int columnIndex) { 423 bool addToSortedIndices = (Control.ModifierKeys & Keys.Control) == Keys.Control; 424 SortOrder newSortOrder = SortOrder.Ascending; 425 if (sortedColumnIndices.Any(x => x.Key == columnIndex)) { 426 SortOrder oldSortOrder = sortedColumnIndices.Where(x => x.Key == columnIndex).First().Value; 427 int enumLength = Enum.GetValues(typeof(SortOrder)).Length; 428 newSortOrder = oldSortOrder = (SortOrder)Enum.Parse(typeof(SortOrder), ((((int)oldSortOrder) + 1) % enumLength).ToString()); 429 } 430 431 if (!addToSortedIndices) 432 sortedColumnIndices.Clear(); 433 434 if (sortedColumnIndices.Any(x => x.Key == columnIndex)) { 435 int sortedIndex = sortedColumnIndices.FindIndex(x => x.Key == columnIndex); 436 if (newSortOrder != SortOrder.None) 437 sortedColumnIndices[sortedIndex] = new KeyValuePair<int, SortOrder>(columnIndex, newSortOrder); 438 else 439 sortedColumnIndices.RemoveAt(sortedIndex); 440 } else 441 if (newSortOrder != SortOrder.None) 442 sortedColumnIndices.Add(new KeyValuePair<int, SortOrder>(columnIndex, newSortOrder)); 443 Sort(); 444 } 445 440 446 protected virtual int[] Sort(IEnumerable<KeyValuePair<int, SortOrder>> sortedColumns) { 441 447 int[] newSortedIndex = Enumerable.Range(0, Content.Rows).ToArray(); … … 510 516 } 511 517 512 pr ivatevoid dataGridView_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) {518 protected virtual void dataGridView_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { 513 519 if (Content == null) return; 514 520 if (e.Button == MouseButtons.Right && Content.ColumnNames.Count() != 0) … … 543 549 544 550 protected virtual void dataGridView_SelectionChanged(object sender, EventArgs e) { 545 string stringFormat = "{0,20:0.0000}";546 551 statisticsTextBox.Text = string.Empty; 547 552 if (dataGridView.SelectedCells.Count > 1) { … … 553 558 } 554 559 if (selectedValues.Count > 1) { 555 StringBuilder labelText = new StringBuilder(); 556 labelText.Append("Count: " + string.Format(stringFormat, selectedValues.Count) + " "); 557 labelText.Append("Sum: " + string.Format(stringFormat, selectedValues.Sum()) + " "); 558 labelText.Append("Min: " + string.Format(stringFormat, selectedValues.Min()) + " "); 559 labelText.Append("Max: " + string.Format(stringFormat, selectedValues.Max()) + " "); 560 labelText.Append("Average: " + string.Format(stringFormat, selectedValues.Average()) + " "); 561 labelText.Append("Standard Deviation: " + string.Format(stringFormat, selectedValues.StandardDeviation()) + " "); 562 563 statisticsTextBox.Text = labelText.ToString(); 564 } 565 } 560 statisticsTextBox.Text = CreateStatisticsText(selectedValues); 561 } 562 } 563 } 564 565 protected virtual string CreateStatisticsText(ICollection<double> values) { 566 string stringFormat = "{0,20:0.0000}"; 567 int overallCount = values.Count; 568 values = values.Where(x => !double.IsNaN(x)).ToList(); 569 if (!values.Any()) { 570 return ""; 571 } 572 StringBuilder statisticsText = new StringBuilder(); 573 statisticsText.Append("Count: " + values.Count + " "); 574 statisticsText.Append("Sum: " + string.Format(stringFormat, values.Sum()) + " "); 575 statisticsText.Append("Min: " + string.Format(stringFormat, values.Min()) + " "); 576 statisticsText.Append("Max: " + string.Format(stringFormat, values.Max()) + " "); 577 statisticsText.Append("Average: " + string.Format(stringFormat, values.Average()) + " "); 578 statisticsText.Append("Standard Deviation: " + string.Format(stringFormat, values.StandardDeviation()) + " "); 579 if (overallCount > 0) 580 statisticsText.Append("Missing Values: " + string.Format(stringFormat, ((overallCount - values.Count) / (double)overallCount) * 100) + "% "); 581 return statisticsText.ToString(); 566 582 } 567 583 }
Note: See TracChangeset
for help on using the changeset viewer.