Changeset 10987
- Timestamp:
- 06/11/14 14:23:19 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 4 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs ¶
r10977 r10987 61 61 new LineChartContent(chartLogic), 62 62 new HistogramContent(chartLogic), 63 new ScatterPlotContent( chartLogic),63 new ScatterPlotContent(Content), 64 64 new CorrelationMatrixContent(Content), 65 65 new DataCompletenessChartContent(dataGridLogic, searchLogic), -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj ¶
r10950 r10987 92 92 <DependentUpon>ComparisonFilterView.cs</DependentUpon> 93 93 </Compile> 94 <Compile Include="S ingleScatterPlotView.cs">95 <SubType>UserControl</SubType> 96 </Compile> 97 <Compile Include="S ingleScatterPlotView.Designer.cs">98 <DependentUpon>S ingleScatterPlotView.cs</DependentUpon>94 <Compile Include="ScatterPlotSingleView.cs"> 95 <SubType>UserControl</SubType> 96 </Compile> 97 <Compile Include="ScatterPlotSingleView.Designer.cs"> 98 <DependentUpon>ScatterPlotSingleView.cs</DependentUpon> 99 99 </Compile> 100 100 <Compile Include="DataCompletenessView.cs"> … … 129 129 <DependentUpon>FilterView.cs</DependentUpon> 130 130 </Compile> 131 <Compile Include=" MultiScatterPlotView.cs">132 <SubType>UserControl</SubType> 133 </Compile> 134 <Compile Include=" MultiScatterPlotView.Designer.cs">135 <DependentUpon> MultiScatterPlotView.cs</DependentUpon>131 <Compile Include="ScatterPlotMultiView.cs"> 132 <SubType>UserControl</SubType> 133 </Compile> 134 <Compile Include="ScatterPlotMultiView.Designer.cs"> 135 <DependentUpon>ScatterPlotMultiView.cs</DependentUpon> 136 136 </Compile> 137 137 <Compile Include="PreprocessingScatterPlotView.cs"> -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs ¶
r10972 r10987 49 49 private const string DEFAULT_CHART_TITLE = "Chart"; 50 50 private const int FIXED_CHART_SIZE = 300; 51 private const int MAX_TABLE_ ROWS = 3;51 private const int MAX_TABLE_AUTO_SIZE_ROWS = 3; 52 52 53 53 public IEnumerable<double> Classification { get; set; } … … 328 328 int columns = GetNrOfMultiChartColumns(checkedItemsCnt); 329 329 int rows = GetNrOfMultiChartRows(checkedItemsCnt, columns); 330 tableLayoutPanel.VerticalScroll.Enabled = true; 330 331 331 332 tableLayoutPanel.ColumnCount = columns; … … 335 336 for (int x = 0; x < columns; x++) { 336 337 337 if (rows <= MAX_TABLE_ ROWS)338 if (rows <= MAX_TABLE_AUTO_SIZE_ROWS) 338 339 tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 / columns)); 339 340 else … … 344 345 if (x == 0) { 345 346 // fixed chart size when there are more than 3 tables 346 if (rows > MAX_TABLE_ ROWS)347 if (rows > MAX_TABLE_AUTO_SIZE_ROWS) 347 348 tableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, FIXED_CHART_SIZE)); 348 349 else -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs ¶
r10986 r10987 1 1 namespace HeuristicLab.DataPreprocessing.Views { 2 partial class MultiScatterPlotView {2 partial class ScatterPlotMultiView { 3 3 /// <summary> 4 4 /// Required designer variable. -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs ¶
r10982 r10987 9 9 using HeuristicLab.Analysis.Views; 10 10 using HeuristicLab.Collections; 11 using HeuristicLab.Common; 11 12 using HeuristicLab.Core; 12 13 using HeuristicLab.Core.Views; … … 17 18 namespace HeuristicLab.DataPreprocessing.Views { 18 19 19 [View(" Multi Scatter PlotView")]20 [View("Scatter Plot Multi View")] 20 21 [Content(typeof(ScatterPlotContent), false)] 21 public partial class MultiScatterPlotView : ItemView {22 public partial class ScatterPlotMultiView : ItemView { 22 23 23 24 private const int HEADER_WIDTH = 50; … … 27 28 private const int FIXED_CHART_HEIGHT = 150; 28 29 29 private IChartLogic logic; 30 private List<string> variables; 31 32 public MultiScatterPlotView() { 30 public ScatterPlotMultiView() { 33 31 InitializeComponent(); 34 32 } … … 39 37 } 40 38 41 public void InitData() {42 variables = new List<string>(logic.GetVariableNames());43 }44 45 39 protected override void OnContentChanged() { 46 40 base.OnContentChanged(); 47 41 if (Content != null) { 48 logic = Content.ChartLogic;49 InitData();50 42 GenerateMultiLayout(); 51 43 } … … 54 46 //Add header elements to the table layout panel 55 47 private void addHeaderToTableLayoutPanels() { 48 49 List<string> variables = Content.GetVariableNames().ToList(); 56 50 57 51 for (int i = 1; i < variables.Count + 1; i++) { … … 74 68 private void GenerateMultiLayout() 75 69 { 70 List<string> variables = Content.GetVariableNames().ToList(); 71 76 72 tableLayoutPanel.Controls.Clear(); 77 73 //Clear out the existing row and column styles … … 106 102 107 103 private void addChartsToTableLayoutPanel() { 104 105 List<string> variables = Content.GetVariableNames().ToList(); 106 108 107 //set scatter plots and histograms 109 108 for (int x = 1; x < variables.Count + 1; x++) { … … 113 112 if (x == y) { 114 113 PreprocessingDataTable dataTable = new PreprocessingDataTable(); 115 DataRow dataRow = logic.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram);114 DataRow dataRow = Content.CreateDataRow(variables[x - 1], DataRowVisualProperties.DataRowChartType.Histogram); 116 115 dataTable.Rows.Add(dataRow); 117 116 PreprocessingDataTableView pcv = new PreprocessingDataTableView(); … … 122 121 //scatter plot 123 122 else { 124 ScatterPlot scatterPlot = logic.CreateScatterPlot(variables[x - 1], variables[y - 1]);123 ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x - 1], variables[y - 1]); 125 124 PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView(); 126 125 pspv.ChartDoubleClick += ScatterPlotDoubleClick; … … 136 135 private void ScatterPlotDoubleClick(object sender, EventArgs e) { 137 136 PreprocessingScatterPlotView pspv = (PreprocessingScatterPlotView)sender; 138 ScatterPlotContent scatterContent = new ScatterPlotContent( logic); // create new content137 ScatterPlotContent scatterContent = new ScatterPlotContent(Content, new Cloner()); // create new content 139 138 ScatterPlot scatterPlot = pspv.Content; 140 139 setVariablesInContentFromScatterPlot(scatterContent, scatterPlot); 141 140 142 MainFormManager.MainForm.ShowContent(scatterContent, typeof(S ingleScatterPlotView)); // open in new tab141 MainFormManager.MainForm.ShowContent(scatterContent, typeof(ScatterPlotSingleView)); // open in new tab 143 142 } 144 143 … … 148 147 // only one data row should be in scatter plot 149 148 if (scatterPlot.Rows.Count == 1) { 150 // TODO -> find better way to get variable names151 149 string[] variables = scatterPlot.Rows.ElementAt(0).Name.Split(new string[]{" - "},StringSplitOptions.None); // extract variable names from string 152 150 scatterContent.SelectedXVariable = variables[0]; … … 176 174 //open histogram in new tab with new content when double clicked 177 175 private void HistogramDoubleClick(object sender, EventArgs e) { 178 PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender;179 HistogramContent histoContent = new HistogramContent(logic); // create new content180 histoContent.VariableItemList = logic.CreateVariableItemList();181 PreprocessingDataTable dataTable = pcv.Content;182 setVariableItemListFromDataTable(histoContent, dataTable);176 //PreprocessingDataTableView pcv = (PreprocessingDataTableView)sender; 177 //HistogramContent histoContent = new HistogramContent(Content,); // create new content 178 //histoContent.VariableItemList = logic.CreateVariableItemList(); 179 //PreprocessingDataTable dataTable = pcv.Content; 180 //setVariableItemListFromDataTable(histoContent, dataTable); 183 181 184 MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab182 //MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab 185 183 } 186 184 -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.Designer.cs ¶
r10982 r10987 1 1 namespace HeuristicLab.DataPreprocessing.Views { 2 partial class S ingleScatterPlotView {2 partial class ScatterPlotSingleView { 3 3 /// <summary> 4 4 /// Required designer variable. -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotSingleView.cs ¶
r10982 r10987 18 18 namespace HeuristicLab.DataPreprocessing.Views { 19 19 20 [View("S ingle Scatter PlotView")]20 [View("Scatter Plot Single View")] 21 21 [Content(typeof(ScatterPlotContent), true)] 22 public partial class S ingleScatterPlotView : ItemView {22 public partial class ScatterPlotSingleView : ItemView { 23 23 24 private IChartLogic logic; 25 26 public SingleScatterPlotView() { 24 public ScatterPlotSingleView() { 27 25 InitializeComponent(); 28 26 } … … 35 33 public void InitData() { 36 34 37 IEnumerable<string> variables = logic.GetVariableNames();35 IEnumerable<string> variables = Content.GetVariableNames(); 38 36 39 37 // add variables to combo boxes … … 60 58 base.OnContentChanged(); 61 59 if (Content != null) { 62 logic = Content.ChartLogic;63 60 InitData(); 64 61 } … … 72 69 if (comboBoxXVariable.SelectedItem != null && comboBoxYVariable.SelectedItem != null) { 73 70 //get scatter plot with selected x and y variable 74 ScatterPlot scatterPlot = logic.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem);71 ScatterPlot scatterPlot = Content.CreateScatterPlot((string)comboBoxXVariable.SelectedItem, (string)comboBoxYVariable.SelectedItem); 75 72 scatterPlotView.Content = scatterPlot; 76 73 -
TabularUnified branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/ScatterPlotContent.cs ¶
r10967 r10987 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Drawing; 24 using HeuristicLab.Analysis; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 27 29 28 30 [Item("ScatterPlot", "Represents a scatter plot.")] 29 public class ScatterPlotContent : PreprocessingChartContent { 31 public class ScatterPlotContent : Item, IViewChartShortcut { 32 public static new Image StaticItemImage { 33 get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; } 34 } 30 35 31 36 public string SelectedXVariable { get; set; } 32 33 37 public string SelectedYVariable { get; set; } 34 38 35 public ScatterPlotContent(IChartLogic chartlogic) 36 : base(chartlogic) { 39 public IPreprocessingContext Context { 40 get; 41 private set; 42 } 43 public ITransactionalPreprocessingData PreprocessingData { 44 get { return Context.Data; } 45 } 46 47 public ScatterPlotContent(IPreprocessingContext context) 48 : base() { 49 this.Context = context; 37 50 } 38 51 39 52 public ScatterPlotContent(ScatterPlotContent content, Cloner cloner) 40 53 : base(content, cloner) { 41 this.SelectedXVariable = content.SelectedXVariable; 42 this.SelectedYVariable = content.SelectedYVariable; 54 this.Context = content.Context; 55 this.SelectedXVariable = content.SelectedXVariable; 56 this.SelectedYVariable = content.SelectedYVariable; 43 57 } 44 45 public static new Image StaticItemImage {46 get { return HeuristicLab.Common.Resources.VSImageLibrary.Performance; }47 }48 49 58 public override IDeepCloneable Clone(Cloner cloner) { 50 59 return new ScatterPlotContent(this, cloner); 51 60 } 52 61 62 public DataRow CreateDataRow(string variableName, DataRowVisualProperties.DataRowChartType chartType) { 63 int columnIndex = PreprocessingData.GetColumnIndex(variableName); 64 IList<double> values = PreprocessingData.GetValues<double>(columnIndex); 65 DataRow row = new DataRow(variableName, "", values); 66 row.VisualProperties.ChartType = chartType; 67 return row; 68 } 69 70 public IEnumerable<string> GetVariableNames() { 71 List<string> doubleVariableNames = new List<string>(); 72 73 //only return variable names from type double 74 foreach (string variableName in PreprocessingData.VariableNames) { 75 if (PreprocessingData.IsType<double>(PreprocessingData.GetColumnIndex(variableName))) 76 doubleVariableNames.Add(variableName); 77 } 78 79 return doubleVariableNames; 80 } 81 82 public ScatterPlot CreateScatterPlot(string variableNameX, string variableNameY) { 83 ScatterPlot scatterPlot = new ScatterPlot(); 84 85 int xColumnIndex = PreprocessingData.GetColumnIndex(variableNameX); 86 int yColumnIndex = PreprocessingData.GetColumnIndex(variableNameY); 87 88 IList<double> xValues = PreprocessingData.GetValues<double>(xColumnIndex); 89 IList<double> yValues = PreprocessingData.GetValues<double>(yColumnIndex); 90 91 List<Point2D<double>> points = new List<Point2D<double>>(); 92 93 for (int i = 0; i < xValues.Count; i++) { 94 Point2D<double> point = new Point2D<double>(xValues[i], yValues[i]); 95 points.Add(point); 96 } 97 98 ScatterPlotDataRow scdr = new ScatterPlotDataRow(variableNameX + " - " + variableNameY, "", points); 99 scatterPlot.Rows.Add(scdr); 100 return scatterPlot; 101 } 102 53 103 } 54 104 }
Note: See TracChangeset
for help on using the changeset viewer.