Changeset 15027


Ignore:
Timestamp:
06/06/17 14:35:43 (2 months ago)
Author:
pfleck
Message:

#2709 Fixed an issue with empty charts.

Location:
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs

    r15021 r15027  
    8080
    8181    private void orderComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     82      if (Content == null) return;
     83
    8284      Content.Order = (PreprocessingChartContent.LegendOrder)orderComboBox.SelectedItem;
    8385
  • branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs

    r14996 r15027  
    141141      int rows = (int)Math.Ceiling((float)nrCharts / columns);
    142142
    143       tableLayoutPanel.ColumnCount = columns;
    144       tableLayoutPanel.RowCount = rows;
    145 
    146       var width = (splitContainer.Panel2.Width - SystemInformation.VerticalScrollBarWidth) / columns;
    147       var height = width * 0.75f;
    148 
    149       using (var enumerator = GetVisibleDataTables().GetEnumerator()) {
    150         for (int row = 0; row < rows; row++) {
    151           tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, height));
    152           for (int col = 0; col < columns; col++) {
    153             if (row == 0) { // Add a column-style only when creating the first row
    154               tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, width));
     143      tableLayoutPanel.ColumnCount = Math.Max(columns, 0);
     144      tableLayoutPanel.RowCount = Math.Max(rows, 0);
     145
     146      if (columns > 0 && rows > 0) {
     147        var width = (splitContainer.Panel2.Width - SystemInformation.VerticalScrollBarWidth) / columns;
     148        var height = width * 0.75f;
     149
     150        using (var enumerator = GetVisibleDataTables().GetEnumerator()) {
     151          for (int row = 0; row < rows; row++) {
     152            tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, height));
     153            for (int col = 0; col < columns; col++) {
     154              if (row == 0) {
     155                // Add a column-style only when creating the first row
     156                tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, width));
     157              }
     158
     159              if (enumerator.MoveNext())
     160                AddDataTableToTableLayout(enumerator.Current, row, col);
     161
    155162            }
    156 
    157             if (enumerator.MoveNext())
    158               AddDataTableToTableLayout(enumerator.Current, row, col);
    159 
    160163          }
    161164        }
    162       }
    163       tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 0));
     165        tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 0));
     166      }
    164167
    165168      scrollPanel.ResumeRepaint(true);
Note: See TracChangeset for help on using the changeset viewer.