Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/17/17 13:22:51 (7 years ago)
Author:
pfleck
Message:

#2709

  • Added Legend order when grouping for histogram and (single and multi)scatterplot.
  • Removed the limitation of distinct values for the singlescatterplot (for the color gradient).
  • Added a legend-visible checkbox for the multi-scatterplot.
File:
1 edited

Legend:

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

    r14983 r14993  
    5454      aggregationComboBox.SelectedItem = AggregationType.Overlapping;
    5555
     56      legendOrderComboBox.DataSource = Enum.GetValues(typeof(PreprocessingChartContent.LegendOrder));
     57      legendOrderComboBox.SelectedItem = PreprocessingChartContent.LegendOrder.Appearance;
     58
    5659      #region Initialize Scrollbars
    5760      columnHeaderScrollPanel.HorizontalScroll.Enabled = true;
     
    412415            rowVariable,
    413416            (string)groupingComboBox.SelectedItem,
    414             (AggregationType)aggregationComboBox.SelectedItem);
     417            (AggregationType)aggregationComboBox.SelectedItem,
     418            (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem);
    415419          dataTable.VisualProperties.Title = string.Empty;
    416           foreach (var dataRow in dataTable.Rows)
    417             dataRow.VisualProperties.IsVisibleInLegend = groupingComboBox.SelectedIndex > 0;
     420          foreach (var dataRow in dataTable.Rows) {
     421            dataRow.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
     422          }
    418423          var pcv = new DataTableView {
    419424            Name = key.ToString(),
     
    430435            colVariable,
    431436            rowVariable,
    432             (string)groupingComboBox.SelectedItem);
     437            (string)groupingComboBox.SelectedItem,
     438            (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem);
    433439          var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue;
    434440          int order = (int)polynomialRegressionOrderNumericUpDown.Value;
     
    439445            row.VisualProperties.Color = Color.FromArgb((int)(pointOpacityNumericUpDown.Value * 255),
    440446              row.VisualProperties.Color.IsEmpty ? colors[i++ % colors.Length] : row.VisualProperties.Color);
    441             //row.VisualProperties.IsVisibleInLegend = true;
     447            row.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
    442448            row.VisualProperties.IsRegressionVisibleInLegend = false;
    443449            row.VisualProperties.RegressionType = regressionType;
     
    467473    #region Generate Charts
    468474    private void GenerateCharts(bool clearCache) {
    469       if (suppressCheckedChangedUpdate) return;
     475      if (Content == null || suppressCheckedChangedUpdate) return;
    470476
    471477      // Clear old layouts and cache
     
    477483
    478484      if (clearCache) {
    479         foreach (var control in bodyCache.Values
    480           .Concat(columnHeaderCache.Values)
    481           .Concat(rowHeaderCache.Values)) {
     485        foreach (var control in bodyCache.Values.Concat(columnHeaderCache.Values).Concat(rowHeaderCache.Values)) {
    482486          control.Dispose();
    483487        }
     
    549553      }
    550554
    551       MainFormManager.MainForm.ShowContent(scatterContent, typeof(ScatterPlotSingleView));  // open in new tab
     555      MainFormManager.MainForm.ShowContent(scatterContent, typeof(ScatterPlotSingleView)); // open in new tab
    552556    }
    553557
     
    568572        }
    569573      }
    570       MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView));  // open in new tab
     574      MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab
    571575    }
    572576    #endregion
     
    716720    #region Grouping
    717721    private void groupingComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     722      aggregationLabel.Enabled = groupingComboBox.SelectedIndex > 0;
    718723      aggregationComboBox.Enabled = groupingComboBox.SelectedIndex > 0;
     724      legendGroupBox.Enabled = groupingComboBox.SelectedIndex > 0;
    719725      GenerateCharts(true); // new series within charts -> clear cache
    720726    }
     
    736742      }
    737743    }
     744
     745    private void legendCheckbox_CheckedChanged(object sender, EventArgs e) {
     746      foreach (var control in bodyCache.ToList()) {
     747        var histogramControl = control.Value as DataTableView;
     748        if (histogramControl != null) {
     749          foreach (var row in histogramControl.Content.Rows) {
     750            row.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
     751          }
     752        }
     753        var scatterplotControl = control.Value as ScatterPlotView;
     754        if (scatterplotControl != null) {
     755          foreach (var row in scatterplotControl.Content.Rows) {
     756            row.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0;
     757          }
     758        }
     759      }
     760    }
     761
     762    private void legendOrderComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     763      GenerateCharts(true);
     764    }
    738765    #endregion
    739766  }
Note: See TracChangeset for help on using the changeset viewer.