- Timestamp:
- 07/14/17 10:29:51 (7 years ago)
- Location:
- stable
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 15110,15119,15210
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views
- Property svn:mergeinfo changed
-
stable/HeuristicLab.DataPreprocessing.Views/3.4/HistogramView.cs
r14186 r15242 21 21 22 22 using System; 23 using System.Drawing; 23 24 using HeuristicLab.Analysis; 24 25 using HeuristicLab.MainForm; 25 26 26 27 namespace HeuristicLab.DataPreprocessing.Views { 27 28 28 [View("Histogram View")] 29 29 [Content(typeof(HistogramContent), true)] 30 30 public partial class HistogramView : PreprocessingChartView { 31 private const string HISTOGRAM_CHART_TITLE = "Histogram";32 33 public HistogramView() {34 InitializeComponent();35 chartType = DataRowVisualProperties.DataRowChartType.Histogram;36 chartTitle = HISTOGRAM_CHART_TITLE;37 }38 39 protected override void OnContentChanged() {40 base.OnContentChanged();41 if (Content != null) {42 classifierComboBox.Items.Clear();43 classifierComboBox.Items.Add("None");44 45 foreach (string var in Content.GetVariableNamesForHistogramClassification()) {46 classifierComboBox.Items.Add(var);47 }48 49 if (classifierComboBox.SelectedItem == null && Content.ClassifierVariableIndex < classifierComboBox.Items.Count) {50 classifierComboBox.SelectedIndex = Content.ClassifierVariableIndex;51 }52 }53 }54 55 31 public new HistogramContent Content { 56 32 get { return (HistogramContent)base.Content; } … … 58 34 } 59 35 60 private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) { 61 if (classifierComboBox.SelectedItem == null) 62 return; 36 public HistogramView() { 37 InitializeComponent(); 38 aggregationComboBox.DataSource = Enum.GetValues(typeof(DataTableVisualProperties.DataTableHistogramAggregation)); 39 aggregationComboBox.SelectedItem = DataTableVisualProperties.DataTableHistogramAggregation.Overlapping; 40 orderComboBox.DataSource = Enum.GetValues(typeof(PreprocessingChartContent.LegendOrder)); 41 orderComboBox.SelectedItem = PreprocessingChartContent.LegendOrder.Alphabetically; 42 } 63 43 64 if (classifierComboBox.SelectedIndex != 0) { 65 int columndIndex = Content.PreprocessingData.GetColumnIndex(classifierComboBox.SelectedItem.ToString()); 66 Classification = Content.PreprocessingData.GetValues<double>(columndIndex); 67 } else { 68 Classification = null; 69 } 44 protected override void OnContentChanged() { 45 base.OnContentChanged(); 46 groupingComboBox.Items.Clear(); 47 groupingComboBox.Items.Add(string.Empty); 70 48 71 Content.ClassifierVariableIndex = classifierComboBox.SelectedIndex; 72 if (Content.IsDetailedChartViewEnabled != IsDetailedChartViewEnabled) { 73 displayDetailsCheckBox.Checked = Content.IsDetailedChartViewEnabled; 74 } else { 75 GenerateChart(); 49 if (Content != null) { 50 foreach (string var in PreprocessingChartContent.GetVariableNamesForGrouping(Content.PreprocessingData)) { 51 groupingComboBox.Items.Add(var); 52 } 53 54 groupingComboBox.SelectedItem = Content.GroupingVariableName ?? string.Empty; 76 55 } 77 56 } 78 private void displayDetailsCheckBox_CheckedChanged(object sender, EventArgs e) { 79 bool isChecked = displayDetailsCheckBox.Checked; 80 if (IsDetailedChartViewEnabled != isChecked) { 81 IsDetailedChartViewEnabled = isChecked; 82 Content.IsDetailedChartViewEnabled = isChecked; 83 GenerateChart(); 57 58 protected override DataTable CreateDataTable(string variableName) { 59 var aggregation = (DataTableVisualProperties.DataTableHistogramAggregation)aggregationComboBox.SelectedItem; 60 var hist = HistogramContent.CreateHistogram(Content.PreprocessingData, variableName, Content.GroupingVariableName, aggregation, Content.Order); 61 hist.VisualProperties.TitleFont = new Font(DefaultFont.FontFamily, 10, FontStyle.Bold); 62 return hist; 63 } 64 65 private void classifierComboBox_SelectedIndexChanged(object sender, EventArgs e) { 66 Content.GroupingVariableName = groupingComboBox.SelectedItem.ToString(); 67 68 // rebuild datatables 69 InitData(); 70 GenerateLayout(); 71 } 72 73 private void aggregationComboBox_SelectedIndexChanged(object sender, EventArgs e) { 74 foreach (var dt in dataTables.Values) { 75 dt.VisualProperties.HistogramAggregation = (DataTableVisualProperties.DataTableHistogramAggregation)aggregationComboBox.SelectedItem; 84 76 } 77 } 78 79 private void orderComboBox_SelectedIndexChanged(object sender, EventArgs e) { 80 if (Content == null) return; 81 82 Content.Order = (PreprocessingChartContent.LegendOrder)orderComboBox.SelectedItem; 83 84 // rebuild datatables 85 InitData(); 86 GenerateLayout(); 85 87 } 86 88 }
Note: See TracChangeset
for help on using the changeset viewer.