- Timestamp:
- 04/11/17 18:43:17 (8 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 3 edited
- 9 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.Designer.cs
r14851 r14852 1 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 partial class Factor GradientChart {2 partial class FactorPartialDependencePlot { 3 3 /// <summary> 4 4 /// Required designer variable. … … 137 137 this.chart.Resize += new System.EventHandler(this.chart_Resize); 138 138 // 139 // Factor GradientChart139 // FactorPartialDependencePlot 140 140 // 141 141 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 143 143 this.Controls.Add(this.calculationPendingLabel); 144 144 this.Controls.Add(this.chart); 145 this.Name = "Factor GradientChart";145 this.Name = "FactorPartialDependencePlot"; 146 146 this.Size = new System.Drawing.Size(453, 308); 147 147 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs
r14851 r14852 34 34 35 35 namespace HeuristicLab.Problems.DataAnalysis.Views { 36 public partial class Factor GradientChart : UserControl, IGradientChart {37 private ModifiableDataset sharedFixedVariables; // used for sync ronising variable values between charts36 public partial class FactorPartialDependencePlot : UserControl, IPartialDependencePlot { 37 private ModifiableDataset sharedFixedVariables; // used for synchronising variable values between charts 38 38 private ModifiableDataset internalDataset; // holds the x values for each point drawn 39 39 … … 134 134 public event EventHandler ChartPostPaint; 135 135 136 public Factor GradientChart() {136 public FactorPartialDependencePlot() { 137 137 InitializeComponent(); 138 138 … … 151 151 chart.ChartAreas[0].CursorY.Interval = 0; 152 152 153 Disposed += GradientChart_Disposed;154 } 155 156 private void GradientChart_Disposed(object sender, EventArgs e) {153 Disposed += Control_Disposed; 154 } 155 156 private void Control_Disposed(object sender, EventArgs e) { 157 157 if (cancelCurrentRecalculateSource != null) 158 158 cancelCurrentRecalculateSource.Cancel(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.Designer.cs
r14851 r14852 1 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 partial class GradientChart {2 partial class PartialDependencePlot { 3 3 /// <summary> 4 4 /// Required designer variable. … … 119 119 this.configurationButton.Click += new System.EventHandler(this.config_Click); 120 120 // 121 // GradientChart121 // PartialDependencePlot 122 122 // 123 123 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 126 126 this.Controls.Add(this.calculationPendingLabel); 127 127 this.Controls.Add(this.chart); 128 this.Name = " GradientChart";128 this.Name = "PartialDependencePlot"; 129 129 this.Size = new System.Drawing.Size(453, 308); 130 130 ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs
r14851 r14852 35 35 36 36 namespace HeuristicLab.Problems.DataAnalysis.Views { 37 public partial class GradientChart : UserControl, IGradientChart {37 public partial class PartialDependencePlot : UserControl, IPartialDependencePlot { 38 38 private ModifiableDataset sharedFixedVariables; // used for syncronising variable values between charts 39 39 private ModifiableDataset internalDataset; // holds the x values for each point drawn … … 46 46 47 47 private readonly ToolStripMenuItem configToolStripMenuItem; 48 private readonly GradientChartConfigurationDialog configurationDialog;48 private readonly PartialDependencePlotConfigurationDialog configurationDialog; 49 49 50 50 #region Properties … … 210 210 public event EventHandler ChartPostPaint; 211 211 212 public GradientChart() {212 public PartialDependencePlot() { 213 213 InitializeComponent(); 214 214 … … 231 231 chart.ContextMenuStrip.Items.Add(new ToolStripSeparator()); 232 232 chart.ContextMenuStrip.Items.Add(configToolStripMenuItem); 233 configurationDialog = new GradientChartConfigurationDialog(this);234 235 Disposed += GradientChart_Disposed;236 } 237 238 private void GradientChart_Disposed(object sender, EventArgs e) {233 configurationDialog = new PartialDependencePlotConfigurationDialog(this); 234 235 Disposed += Control_Disposed; 236 } 237 238 private void Control_Disposed(object sender, EventArgs e) { 239 239 if (cancelCurrentRecalculateSource != null) 240 240 cancelCurrentRecalculateSource.Cancel(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlotConfigurationDialog.Designer.cs
r14851 r14852 21 21 22 22 namespace HeuristicLab.Problems.DataAnalysis.Views { 23 partial class GradientChartConfigurationDialog {23 partial class PartialDependencePlotConfigurationDialog { 24 24 /// <summary> 25 25 /// Required designer variable. … … 272 272 this.errorProvider.ContainerControl = this; 273 273 // 274 // GradientChartConfigurationDialog274 // PartialDependencePlotConfigurationDialog 275 275 // 276 276 this.AcceptButton = this.applyButton; … … 286 286 this.MaximizeBox = false; 287 287 this.MinimizeBox = false; 288 this.Name = " GradientChartConfigurationDialog";288 this.Name = "PartialDependencePlotConfigurationDialog"; 289 289 this.ShowIcon = false; 290 290 this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 291 291 this.Text = "Configure Gradient Chart"; 292 292 this.TopMost = true; 293 this.Shown += new System.EventHandler(this. GradientChartConfigurationDialog_Shown);293 this.Shown += new System.EventHandler(this.PartialDependencePlotConfigurationDialog_Shown); 294 294 this.xAxisGroupBox.ResumeLayout(false); 295 295 this.xAxisGroupBox.PerformLayout(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlotConfigurationDialog.cs
r14851 r14852 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Views { 29 public partial class GradientChartConfigurationDialog : Form {30 private readonly GradientChart chart;29 public partial class PartialDependencePlotConfigurationDialog : Form { 30 private readonly PartialDependencePlot chart; 31 31 32 public GradientChartConfigurationDialog(GradientChart chart) {32 public PartialDependencePlotConfigurationDialog(PartialDependencePlot chart) { 33 33 this.chart = chart; 34 34 InitializeComponent(); 35 35 } 36 36 37 private void GradientChartConfigurationDialog_Shown(object sender, EventArgs e) {37 private void PartialDependencePlotConfigurationDialog_Shown(object sender, EventArgs e) { 38 38 if (chart.FixedXAxisMin.HasValue && chart.FixedXAxisMax.HasValue) { 39 39 xAutomaticCheckBox.Checked = false; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r14826 r14852 132 132 <DependentUpon>DensityTrackbar.cs</DependentUpon> 133 133 </Compile> 134 <Compile Include="Controls\FactorGradientChart.cs"> 135 <SubType>UserControl</SubType> 136 </Compile> 137 <Compile Include="Controls\FactorGradientChart.Designer.cs"> 138 <DependentUpon>FactorGradientChart.cs</DependentUpon> 134 <Compile Include="Controls\FactorPartialDependencePlot.cs"> 135 <SubType>UserControl</SubType> 136 </Compile> 137 <Compile Include="Controls\FactorPartialDependencePlot.Designer.cs"> 138 <DependentUpon>FactorPartialDependencePlot.cs</DependentUpon> 139 </Compile> 140 <Compile Include="Controls\PartialDependencePlot.cs"> 141 <SubType>UserControl</SubType> 142 </Compile> 143 <Compile Include="Controls\PartialDependencePlot.Designer.cs"> 144 <DependentUpon>PartialDependencePlot.cs</DependentUpon> 145 </Compile> 146 <Compile Include="Controls\PartialDependencePlotConfigurationDialog.cs"> 147 <SubType>Form</SubType> 148 </Compile> 149 <Compile Include="Controls\PartialDependencePlotConfigurationDialog.Designer.cs"> 150 <DependentUpon>PartialDependencePlotConfigurationDialog.cs</DependentUpon> 139 151 </Compile> 140 152 <Compile Include="FeatureCorrelation\TimeframeFeatureCorrelationCalculator.cs" /> … … 201 213 <DependentUpon>FeatureCorrelationView.cs</DependentUpon> 202 214 </Compile> 203 <Compile Include="Controls\GradientChart.cs">204 <SubType>UserControl</SubType>205 </Compile>206 <Compile Include="Controls\GradientChart.Designer.cs">207 <DependentUpon>GradientChart.cs</DependentUpon>208 </Compile>209 <Compile Include="Controls\GradientChartConfigurationDialog.cs">210 <SubType>Form</SubType>211 </Compile>212 <Compile Include="Controls\GradientChartConfigurationDialog.Designer.cs">213 <DependentUpon>GradientChartConfigurationDialog.cs</DependentUpon>214 </Compile>215 <Compile Include="Interfaces\IGradientChart.cs" />216 215 <Compile Include="Interfaces\IDataPreprocessorStarter.cs" /> 216 <Compile Include="Interfaces\IPartialDependencePlot.cs" /> 217 217 <Compile Include="MenuItems\ChangeDataOfOptimizersMenuItem.cs" /> 218 218 <Compile Include="MenuItems\ShrinkDataAnalysisRunsMenuItem.cs" /> … … 260 260 <DependentUpon>RegressionSolutionLineChartViewBase.cs</DependentUpon> 261 261 </Compile> 262 <Compile Include="Regression\RegressionSolutionPartialDependencePlotView.cs"> 263 <SubType>UserControl</SubType> 264 </Compile> 265 <Compile Include="Regression\RegressionSolutionPartialDependencePlotView.Designer.cs"> 266 <DependentUpon>RegressionSolutionPartialDependencePlotView.cs</DependentUpon> 267 </Compile> 262 268 <Compile Include="Regression\RegressionSolutionResidualsLineChartView.cs"> 263 269 <SubType>UserControl</SubType> … … 277 283 <Compile Include="Regression\RegressionSolutionGradientView.Designer.cs"> 278 284 <DependentUpon>RegressionSolutionGradientView.cs</DependentUpon> 279 </Compile>280 <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.cs">281 <SubType>UserControl</SubType>282 </Compile>283 <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.Designer.cs">284 <DependentUpon>RegressionSolutionTargetResponseGradientView.cs</DependentUpon>285 285 </Compile> 286 286 <Compile Include="Regression\RegressionTimeframeFeatureCorrelationView.cs"> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IPartialDependencePlot.cs
r14851 r14852 23 23 24 24 namespace HeuristicLab.Problems.DataAnalysis.Views { 25 public interface I GradientChart {25 public interface IPartialDependencePlot { 26 26 Task RecalculateAsync(bool updateOnFinish, bool resetYAxis); 27 27 double YMin { get; } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.Designer.cs
r14095 r14852 46 46 private void InitializeComponent() { 47 47 this.splitContainer = new System.Windows.Forms.SplitContainer(); 48 this. gradientChart = new HeuristicLab.Problems.DataAnalysis.Views.GradientChart();48 this._partialDependencePlot = new HeuristicLab.Problems.DataAnalysis.Views.PartialDependencePlot(); 49 49 this.configurationGroupBox = new System.Windows.Forms.GroupBox(); 50 50 this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); … … 65 65 // splitContainer.Panel1 66 66 // 67 this.splitContainer.Panel1.Controls.Add(this. gradientChart);67 this.splitContainer.Panel1.Controls.Add(this._partialDependencePlot); 68 68 // 69 69 // splitContainer.Panel2 … … 74 74 this.splitContainer.TabIndex = 1; 75 75 // 76 // gradientChart76 // _partialDependencePlot 77 77 // 78 this. gradientChart.Dock = System.Windows.Forms.DockStyle.Fill;79 this. gradientChart.DrawingSteps = 1000;80 this. gradientChart.Location = new System.Drawing.Point(0, 0);81 this. gradientChart.Name = "gradientChart";82 this. gradientChart.ShowCursor = false;83 this. gradientChart.ShowLegend = false;84 this. gradientChart.Size = new System.Drawing.Size(715, 376);85 this. gradientChart.TabIndex = 0;86 this. gradientChart.XAxisTicks = 10;87 this. gradientChart.YAxisTicks = 5;78 this._partialDependencePlot.Dock = System.Windows.Forms.DockStyle.Fill; 79 this._partialDependencePlot.DrawingSteps = 1000; 80 this._partialDependencePlot.Location = new System.Drawing.Point(0, 0); 81 this._partialDependencePlot.Name = "_partialDependencePlot"; 82 this._partialDependencePlot.ShowCursor = false; 83 this._partialDependencePlot.ShowLegend = false; 84 this._partialDependencePlot.Size = new System.Drawing.Size(715, 376); 85 this._partialDependencePlot.TabIndex = 0; 86 this._partialDependencePlot.XAxisTicks = 10; 87 this._partialDependencePlot.YAxisTicks = 5; 88 88 // 89 89 // configurationGroupBox … … 131 131 private System.Windows.Forms.GroupBox configurationGroupBox; 132 132 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 133 private Problems.DataAnalysis.Views. GradientChart gradientChart;133 private Problems.DataAnalysis.Views.PartialDependencePlot _partialDependencePlot; 134 134 } 135 135 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs
r14131 r14852 94 94 95 95 sharedFixedVariables = new ModifiableDataset(variableNames, newTrackbars.Select(tb => new List<double>(1) { (double)tb.Value })); 96 gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableNames.First(), DrawingSteps);97 await gradientChart.RecalculateAsync();96 _partialDependencePlot.Configure(new[] { Content }, sharedFixedVariables, variableNames.First(), DrawingSteps); 97 await _partialDependencePlot.RecalculateAsync(); 98 98 99 99 // Add to table and observable lists … … 122 122 double axisMin, axisMax, axisInterval; 123 123 ChartUtil.CalculateAxisInterval(min - scale * range, max + scale * range, 5, out axisMin, out axisMax, out axisInterval); 124 gradientChart.FixedYAxisMin = axisMin;125 gradientChart.FixedYAxisMax = axisMax;124 _partialDependencePlot.FixedYAxisMin = axisMin; 125 _partialDependencePlot.FixedYAxisMax = axisMax; 126 126 127 127 trackbars.First().Checked = true; … … 168 168 foreach (var tb in trackbars.Except(new[] { trackBar })) 169 169 tb.Checked = false; 170 gradientChart.FreeVariable = variableNames[trackbars.IndexOf(trackBar)];171 await gradientChart.RecalculateAsync();170 _partialDependencePlot.FreeVariable = variableNames[trackbars.IndexOf(trackBar)]; 171 await _partialDependencePlot.RecalculateAsync(); 172 172 } 173 173 … … 175 175 var trackBar = sender as DensityTrackbar; 176 176 if (trackBar == null || !trackBar.Checked) return; 177 gradientChart.FixedXAxisMin = trackBar.Limits.Lower;178 gradientChart.FixedXAxisMax = trackBar.Limits.Upper;179 await gradientChart.RecalculateAsync();177 _partialDependencePlot.FixedXAxisMin = trackBar.Limits.Lower; 178 _partialDependencePlot.FixedXAxisMax = trackBar.Limits.Upper; 179 await _partialDependencePlot.RecalculateAsync(); 180 180 } 181 181 … … 184 184 if (trackBar == null) return; 185 185 sharedFixedVariables.SetVariableValue((double)trackBar.Value, variableNames[trackbars.IndexOf(trackBar)], 0); 186 await gradientChart.RecalculateAsync();186 await _partialDependencePlot.RecalculateAsync(); 187 187 } 188 188 -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs
r14851 r14852 1 1 namespace HeuristicLab.Problems.DataAnalysis.Views { 2 partial class RegressionSolution TargetResponseGradientView {2 partial class RegressionSolutionPartialDependencePlotView { 3 3 /// <summary> 4 4 /// Required designer variable. … … 26 26 this.components = new System.ComponentModel.Container(); 27 27 this.variableListView = new System.Windows.Forms.ListView(); 28 this. gradientChartTableLayout = new System.Windows.Forms.TableLayoutPanel();28 this.partialDependencePlotTableLayout = new System.Windows.Forms.TableLayoutPanel(); 29 29 this.yAxisConfigGroupBox = new System.Windows.Forms.GroupBox(); 30 30 this.limitView = new HeuristicLab.Problems.DataAnalysis.Views.DoubleLimitView(); … … 63 63 this.variableListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.variableListView_ItemChecked); 64 64 // 65 // gradientChartTableLayout66 // 67 this. gradientChartTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)68 | System.Windows.Forms.AnchorStyles.Right))); 69 this. gradientChartTableLayout.AutoSize = true;70 this. gradientChartTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;71 this. gradientChartTableLayout.ColumnCount = 1;72 this. gradientChartTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));73 this. gradientChartTableLayout.Location = new System.Drawing.Point(0, 0);74 this. gradientChartTableLayout.Name = "gradientChartTableLayout";75 this. gradientChartTableLayout.RowCount = 1;76 this. gradientChartTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());77 this. gradientChartTableLayout.Size = new System.Drawing.Size(542, 0);78 this. gradientChartTableLayout.TabIndex = 2;65 // partialDependencePlotTableLayout 66 // 67 this.partialDependencePlotTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 68 | System.Windows.Forms.AnchorStyles.Right))); 69 this.partialDependencePlotTableLayout.AutoSize = true; 70 this.partialDependencePlotTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 71 this.partialDependencePlotTableLayout.ColumnCount = 1; 72 this.partialDependencePlotTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); 73 this.partialDependencePlotTableLayout.Location = new System.Drawing.Point(0, 0); 74 this.partialDependencePlotTableLayout.Name = "partialDependencePlotTableLayout"; 75 this.partialDependencePlotTableLayout.RowCount = 1; 76 this.partialDependencePlotTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle()); 77 this.partialDependencePlotTableLayout.Size = new System.Drawing.Size(542, 0); 78 this.partialDependencePlotTableLayout.TabIndex = 2; 79 79 // 80 80 // yAxisConfigGroupBox … … 196 196 // scrollPanel 197 197 // 198 this.scrollPanel.Controls.Add(this. gradientChartTableLayout);198 this.scrollPanel.Controls.Add(this.partialDependencePlotTableLayout); 199 199 this.scrollPanel.Dock = System.Windows.Forms.DockStyle.Fill; 200 200 this.scrollPanel.Location = new System.Drawing.Point(0, 0); … … 228 228 this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged); 229 229 // 230 // RegressionSolution TargetResponseGradientView230 // RegressionSolutionPartialDependencePlotView 231 231 // 232 232 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 233 233 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 234 234 this.Controls.Add(this.configSplitContainer); 235 this.Name = "RegressionSolution TargetResponseGradientView";235 this.Name = "RegressionSolutionPartialDependencePlotView"; 236 236 this.Size = new System.Drawing.Size(715, 648); 237 237 this.yAxisConfigGroupBox.ResumeLayout(false); … … 255 255 256 256 private System.Windows.Forms.ListView variableListView; 257 private System.Windows.Forms.TableLayoutPanel gradientChartTableLayout;257 private System.Windows.Forms.TableLayoutPanel partialDependencePlotTableLayout; 258 258 private System.Windows.Forms.GroupBox yAxisConfigGroupBox; 259 259 private System.Windows.Forms.CheckBox automaticYAxisCheckBox; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs
r14851 r14852 33 33 34 34 namespace HeuristicLab.Problems.DataAnalysis.Views { 35 [View(" Target Response Gradients")]35 [View("Partial Dependence Plots")] 36 36 [Content(typeof(IRegressionSolution))] 37 public partial class RegressionSolution TargetResponseGradientView : DataAnalysisSolutionEvaluationView {38 private readonly Dictionary<string, I GradientChart> gradientCharts;37 public partial class RegressionSolutionPartialDependencePlotView : DataAnalysisSolutionEvaluationView { 38 private readonly Dictionary<string, IPartialDependencePlot> partialDependencePlots; 39 39 private readonly Dictionary<string, DensityChart> densityCharts; 40 40 private readonly Dictionary<string, Panel> groupingPanels; … … 50 50 } 51 51 } 52 private IEnumerable<I GradientChart> VisibleGradientCharts {53 get { return VisibleVariables.Select(v => gradientCharts[v]); }52 private IEnumerable<IPartialDependencePlot> VisiblePartialDependencePlots { 53 get { return VisibleVariables.Select(v => partialDependencePlots[v]); } 54 54 } 55 55 private IEnumerable<DensityChart> VisibleDensityCharts { … … 60 60 } 61 61 62 public RegressionSolution TargetResponseGradientView() {62 public RegressionSolutionPartialDependencePlotView() { 63 63 InitializeComponent(); 64 gradientCharts = new Dictionary<string, IGradientChart>();64 partialDependencePlots = new Dictionary<string, IPartialDependencePlot>(); 65 65 densityCharts = new Dictionary<string, DensityChart>(); 66 66 groupingPanels = new Dictionary<string, Panel>(); … … 137 137 138 138 // create controls 139 gradientCharts.Clear();139 partialDependencePlots.Clear(); 140 140 densityCharts.Clear(); 141 141 groupingPanels.Clear(); 142 142 foreach (var variableName in doubleVariables) { 143 var gradientChart = CreateGradientChart(variableName, sharedFixedVariables);144 gradientCharts.Add(variableName, gradientChart);143 var plot = CreatePartialDependencePlot(variableName, sharedFixedVariables); 144 partialDependencePlots.Add(variableName, plot); 145 145 146 146 var densityChart = new DensityChart() { … … 149 149 Height = 12, 150 150 Visible = false, 151 Top = (int)( gradientChart.Height * 0.1),151 Top = (int)(plot.Height * 0.1), 152 152 }; 153 153 densityCharts.Add(variableName, densityChart); 154 154 155 gradientChart.ZoomChanged += (o, e) => {156 var gradient = (GradientChart)o;157 var density = densityCharts[ gradient.FreeVariable];158 density.Visible = densityComboBox.SelectedIndex != 0 && ! gradient.IsZoomed;155 plot.ZoomChanged += (o, e) => { 156 var pdp = (PartialDependencePlot)o; 157 var density = densityCharts[pdp.FreeVariable]; 158 density.Visible = densityComboBox.SelectedIndex != 0 && !pdp.IsZoomed; 159 159 if (density.Visible) 160 UpdateDensityChart(density, gradient.FreeVariable);161 }; 162 gradientChart.SizeChanged += (o, e) => {163 var gradient = (GradientChart)o;164 var density = densityCharts[ gradient.FreeVariable];165 density.Top = (int)( gradient.Height * 0.1);160 UpdateDensityChart(density, pdp.FreeVariable); 161 }; 162 plot.SizeChanged += (o, e) => { 163 var pdp = (PartialDependencePlot)o; 164 var density = densityCharts[pdp.FreeVariable]; 165 density.Top = (int)(pdp.Height * 0.1); 166 166 }; 167 167 168 168 // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...) 169 169 // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting. 170 gradientChart.ChartPostPaint += OnGradientChartPostPaint;170 plot.ChartPostPaint += OnPartialDependencePlotPostPaint; 171 171 172 172 var panel = new Panel() { … … 177 177 178 178 panel.Controls.Add(densityChart); 179 panel.Controls.Add( gradientChart);179 panel.Controls.Add(plot); 180 180 groupingPanels.Add(variableName, panel); 181 181 } 182 182 foreach (var variableName in factorVariables) { 183 var gradientChart = CreateFactorGradientChart(variableName, sharedFixedVariables);184 gradientCharts.Add(variableName, gradientChart);183 var plot = CreateFactorPartialDependencePlot(variableName, sharedFixedVariables); 184 partialDependencePlots.Add(variableName, plot); 185 185 186 186 var densityChart = new DensityChart() { … … 189 189 Height = 12, 190 190 Visible = false, 191 Top = (int)( gradientChart.Height * 0.1),191 Top = (int)(plot.Height * 0.1), 192 192 }; 193 193 densityCharts.Add(variableName, densityChart); 194 gradientChart.ZoomChanged += (o, e) => {195 var gradient = (FactorGradientChart)o;196 var density = densityCharts[ gradient.FreeVariable];197 density.Visible = densityComboBox.SelectedIndex != 0 && ! gradient.IsZoomed;194 plot.ZoomChanged += (o, e) => { 195 var pdp = (FactorPartialDependencePlot)o; 196 var density = densityCharts[pdp.FreeVariable]; 197 density.Visible = densityComboBox.SelectedIndex != 0 && !pdp.IsZoomed; 198 198 if (density.Visible) 199 UpdateDensityChart(density, gradient.FreeVariable);200 }; 201 gradientChart.SizeChanged += (o, e) => {202 var gradient = (FactorGradientChart)o;203 var density = densityCharts[ gradient.FreeVariable];204 density.Top = (int)( gradient.Height * 0.1);199 UpdateDensityChart(density, pdp.FreeVariable); 200 }; 201 plot.SizeChanged += (o, e) => { 202 var pdp = (FactorPartialDependencePlot)o; 203 var density = densityCharts[pdp.FreeVariable]; 204 density.Top = (int)(pdp.Height * 0.1); 205 205 }; 206 206 207 207 // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...) 208 208 // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting. 209 gradientChart.ChartPostPaint += OnFactorGradientChartPostPaint;209 plot.ChartPostPaint += OnFactorPartialDependencePlotPostPaint; 210 210 211 211 var panel = new Panel() { … … 216 216 217 217 panel.Controls.Add(densityChart); 218 panel.Controls.Add( gradientChart);218 panel.Controls.Add(plot); 219 219 groupingPanels.Add(variableName, panel); 220 220 } … … 237 237 double yValue = Content.Model.GetEstimatedValues(sharedFixedVariables, new[] { 0 }).Single(); 238 238 string title = Content.ProblemData.TargetVariable + ": " + yValue.ToString("G5", CultureInfo.CurrentCulture); 239 foreach (var chart in gradientCharts.Values) {239 foreach (var chart in partialDependencePlots.Values) { 240 240 if (!string.IsNullOrEmpty(chart.YAxisTitle)) { // only show title for first column in grid 241 241 chart.YAxisTitle = title; … … 245 245 246 246 247 private void On GradientChartPostPaint(object o, EventArgs e) {248 var gradient = (GradientChart)o;249 var density = densityCharts[ gradient.FreeVariable];250 251 density.Width = gradient.Width;252 253 var gcPlotPosition = gradient.InnerPlotPosition;254 density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);255 density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);256 gradient.UpdateTitlePosition();247 private void OnPartialDependencePlotPostPaint(object o, EventArgs e) { 248 var plot = (PartialDependencePlot)o; 249 var density = densityCharts[plot.FreeVariable]; 250 251 density.Width = plot.Width; 252 253 var gcPlotPosition = plot.InnerPlotPosition; 254 density.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width); 255 density.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width); 256 plot.UpdateTitlePosition(); 257 257 258 258 // removed after succesful layouting due to performance reasons 259 259 if (gcPlotPosition.Width != 0) 260 gradient.ChartPostPaint -= OnGradientChartPostPaint;261 } 262 263 private void OnFactor GradientChartPostPaint(object o, EventArgs e) {264 var gradient = (FactorGradientChart)o;265 var density = densityCharts[ gradient.FreeVariable];266 267 density.Width = gradient.Width;268 269 var gcPlotPosition = gradient.InnerPlotPosition;270 density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);271 density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);272 gradient.UpdateTitlePosition();260 plot.ChartPostPaint -= OnPartialDependencePlotPostPaint; 261 } 262 263 private void OnFactorPartialDependencePlotPostPaint(object o, EventArgs e) { 264 var plot = (FactorPartialDependencePlot)o; 265 var density = densityCharts[plot.FreeVariable]; 266 267 density.Width = plot.Width; 268 269 var gcPlotPosition = plot.InnerPlotPosition; 270 density.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width); 271 density.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width); 272 plot.UpdateTitlePosition(); 273 273 274 274 // removed after succesful layouting due to performance reasons 275 275 if (gcPlotPosition.Width != 0) 276 gradient.ChartPostPaint -= OnFactorGradientChartPostPaint;276 plot.ChartPostPaint -= OnFactorPartialDependencePlotPostPaint; 277 277 } 278 278 279 279 private async void RecalculateAndRelayoutCharts() { 280 280 foreach (var variable in VisibleVariables) { 281 var gradientChart = gradientCharts[variable];282 await gradientChart.RecalculateAsync(false, false);283 } 284 gradientChartTableLayout.SuspendLayout();281 var plot = partialDependencePlots[variable]; 282 await plot.RecalculateAsync(false, false); 283 } 284 partialDependencePlotTableLayout.SuspendLayout(); 285 285 SetupYAxis(); 286 286 ReOrderControls(); 287 287 SetStyles(); 288 gradientChartTableLayout.ResumeLayout();289 gradientChartTableLayout.Refresh();288 partialDependencePlotTableLayout.ResumeLayout(); 289 partialDependencePlotTableLayout.Refresh(); 290 290 foreach (var variable in VisibleVariables) { 291 291 DensityChart densityChart; … … 295 295 } 296 296 } 297 private GradientChart CreateGradientChart(string variableName, ModifiableDataset sharedFixedVariables) {298 var gradientChart = new GradientChart {297 private PartialDependencePlot CreatePartialDependencePlot(string variableName, ModifiableDataset sharedFixedVariables) { 298 var plot = new PartialDependencePlot { 299 299 Dock = DockStyle.Fill, 300 300 Margin = Padding.Empty, … … 304 304 YAxisTicks = 5, 305 305 }; 306 gradientChart.VariableValueChanged += async (o, e) => {307 var recalculations = Visible GradientCharts308 .Except(new[] { (I GradientChart)o })306 plot.VariableValueChanged += async (o, e) => { 307 var recalculations = VisiblePartialDependencePlots 308 .Except(new[] { (IPartialDependencePlot)o }) 309 309 .Select(async chart => { 310 310 await chart.RecalculateAsync(updateOnFinish: false, resetYAxis: false); … … 315 315 SetupYAxis(); 316 316 }; 317 gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableName, Points);318 gradientChart.SolutionAdded += gradientChart_SolutionAdded;319 gradientChart.SolutionRemoved += gradientChart_SolutionRemoved;320 return gradientChart;321 } 322 private Factor GradientChart CreateFactorGradientChart(string variableName, ModifiableDataset sharedFixedVariables) {323 var gradientChart = new FactorGradientChart {317 plot.Configure(new[] { Content }, sharedFixedVariables, variableName, Points); 318 plot.SolutionAdded += partialDependencePlot_SolutionAdded; 319 plot.SolutionRemoved += partialDependencePlot_SolutionRemoved; 320 return plot; 321 } 322 private FactorPartialDependencePlot CreateFactorPartialDependencePlot(string variableName, ModifiableDataset sharedFixedVariables) { 323 var plot = new FactorPartialDependencePlot { 324 324 Dock = DockStyle.Fill, 325 325 Margin = Padding.Empty, … … 328 328 YAxisTicks = 5, 329 329 }; 330 gradientChart.VariableValueChanged += async (o, e) => {331 var recalculations = Visible GradientCharts332 .Except(new[] { (Factor GradientChart)o })330 plot.VariableValueChanged += async (o, e) => { 331 var recalculations = VisiblePartialDependencePlots 332 .Except(new[] { (FactorPartialDependencePlot)o }) 333 333 .Select(async chart => { 334 334 await chart.RecalculateAsync(updateOnFinish: false, resetYAxis: false); … … 340 340 }; 341 341 var variableValues = Content.ProblemData.Dataset.GetStringValues(variableName).Distinct().OrderBy(n => n).ToList(); 342 gradientChart.Configure(new[] { Content }, sharedFixedVariables, variableName, variableValues);343 gradientChart.SolutionAdded += gradientChart_SolutionAdded;344 gradientChart.SolutionRemoved += gradientChart_SolutionRemoved;345 return gradientChart;342 plot.Configure(new[] { Content }, sharedFixedVariables, variableName, variableValues); 343 plot.SolutionAdded += partialDependencePlot_SolutionAdded; 344 plot.SolutionRemoved += partialDependencePlot_SolutionRemoved; 345 return plot; 346 346 } 347 347 private void SetupYAxis() { … … 349 349 if (automaticYAxisCheckBox.Checked) { 350 350 double min = double.MaxValue, max = double.MinValue; 351 foreach (var chart in Visible GradientCharts) {351 foreach (var chart in VisiblePartialDependencePlots) { 352 352 if (chart.YMin < min) min = chart.YMin; 353 353 if (chart.YMax > max) max = chart.YMax; … … 361 361 } 362 362 363 foreach (var chart in Visible GradientCharts) {363 foreach (var chart in VisiblePartialDependencePlots) { 364 364 chart.FixedYAxisMin = axisMin; 365 365 chart.FixedYAxisMax = axisMax; … … 370 370 // the table layout containing the controls should be suspended before calling this method 371 371 private void ReOrderControls() { 372 var tl = gradientChartTableLayout;372 var tl = partialDependencePlotTableLayout; 373 373 tl.Controls.Clear(); 374 374 int row = 0, column = 0; … … 380 380 tl.Controls.Add(chartsPanel, column, row); 381 381 382 var chart = gradientCharts[v];382 var chart = partialDependencePlots[v]; 383 383 chart.YAxisTitle = column == 0 ? title : string.Empty; 384 384 column++; … … 392 392 393 393 private void SetStyles() { 394 var tl = gradientChartTableLayout;394 var tl = partialDependencePlotTableLayout; 395 395 tl.RowStyles.Clear(); 396 396 tl.ColumnStyles.Clear(); … … 412 412 } 413 413 414 private async void gradientChart_SolutionAdded(object sender, EventArgs<IRegressionSolution> e) {414 private async void partialDependencePlot_SolutionAdded(object sender, EventArgs<IRegressionSolution> e) { 415 415 var solution = e.Value; 416 foreach (var chart in gradientCharts.Values) {416 foreach (var chart in partialDependencePlots.Values) { 417 417 if (sender == chart) continue; 418 418 await chart.AddSolutionAsync(solution); … … 420 420 } 421 421 422 private async void gradientChart_SolutionRemoved(object sender, EventArgs<IRegressionSolution> e) {422 private async void partialDependencePlot_SolutionRemoved(object sender, EventArgs<IRegressionSolution> e) { 423 423 var solution = e.Value; 424 foreach (var chart in gradientCharts.Values) {424 foreach (var chart in partialDependencePlots.Values) { 425 425 if (sender == chart) continue; 426 426 await chart.RemoveSolutionAsync(solution); … … 431 431 var item = e.Item; 432 432 var variable = item.Text; 433 var gradientChart = gradientCharts[variable];433 var plot = partialDependencePlots[variable]; 434 434 var chartsPanel = groupingPanels[variable]; 435 var tl = gradientChartTableLayout;435 var tl = partialDependencePlotTableLayout; 436 436 437 437 tl.SuspendLayout(); 438 438 if (item.Checked) { 439 439 tl.Controls.Add(chartsPanel); 440 await gradientChart.RecalculateAsync(false, false);440 await plot.RecalculateAsync(false, false); 441 441 } else { 442 442 tl.Controls.Remove(chartsPanel); … … 456 456 limitView.ReadOnly = automaticYAxisCheckBox.Checked; 457 457 SetupYAxis(); 458 gradientChartTableLayout.Refresh();458 partialDependencePlotTableLayout.Refresh(); 459 459 densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots 460 460 } … … 464 464 return; 465 465 SetupYAxis(); 466 gradientChartTableLayout.Refresh();466 partialDependencePlotTableLayout.Refresh(); 467 467 densityComboBox_SelectedIndexChanged(this, EventArgs.Empty); // necessary to realign the density plots 468 468 } … … 482 482 var variableName = entry.Key; 483 483 var densityChart = entry.Value; 484 if (!VisibleVariables.Contains(variableName) || gradientCharts[variableName].IsZoomed)484 if (!VisibleVariables.Contains(variableName) || partialDependencePlots[variableName].IsZoomed) 485 485 continue; 486 486 … … 504 504 if (Content.ProblemData.Dataset.VariableHasType<double>(variable)) { 505 505 var data = Content.ProblemData.Dataset.GetDoubleValues(variable, indices).ToList(); 506 var gradientChart = gradientCharts[variable] as GradientChart;507 if ( gradientChart != null) {508 var min = gradientChart.FixedXAxisMin;509 var max = gradientChart.FixedXAxisMax;510 var buckets = gradientChart.DrawingSteps;506 var plot = partialDependencePlots[variable] as PartialDependencePlot; 507 if (plot != null) { 508 var min = plot.FixedXAxisMin; 509 var max = plot.FixedXAxisMax; 510 var buckets = plot.DrawingSteps; 511 511 if (min.HasValue && max.HasValue) { 512 512 densityChart.UpdateChart(data, min.Value, max.Value, buckets); 513 densityChart.Width = gradientChart.Width;514 515 var gcPlotPosition = gradientChart.InnerPlotPosition;516 densityChart.Left = (int)(gcPlotPosition.X / 100.0 * gradientChart.Width);517 densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * gradientChart.Width);513 densityChart.Width = plot.Width; 514 515 var gcPlotPosition = plot.InnerPlotPosition; 516 densityChart.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width); 517 densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width); 518 518 519 519 densityChart.Visible = true; 520 520 } 521 gradientChart.UpdateTitlePosition();521 plot.UpdateTitlePosition(); 522 522 } 523 523 } else if (Content.ProblemData.Dataset.VariableHasType<string>(variable)) { 524 524 var data = Content.ProblemData.Dataset.GetStringValues(variable).ToList(); 525 var gradientChart = gradientCharts[variable] as FactorGradientChart;526 if ( gradientChart != null) {525 var plot = partialDependencePlots[variable] as FactorPartialDependencePlot; 526 if (plot != null) { 527 527 densityChart.UpdateChart(data); 528 densityChart.Width = gradientChart.Width;529 530 var gcPlotPosition = gradientChart.InnerPlotPosition;531 densityChart.Left = (int)(gcPlotPosition.X / 100.0 * gradientChart.Width);532 densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * gradientChart.Width);528 densityChart.Width = plot.Width; 529 530 var gcPlotPosition = plot.InnerPlotPosition; 531 densityChart.Left = (int)(gcPlotPosition.X / 100.0 * plot.Width); 532 densityChart.Width = (int)(gcPlotPosition.Width / 100.0 * plot.Width); 533 533 534 534 densityChart.Visible = true; 535 535 536 gradientChart.UpdateTitlePosition();536 plot.UpdateTitlePosition(); 537 537 } 538 538 } … … 543 543 int columns = Math.Min(VisibleVariables.Count(), MaxColumns); 544 544 if (columns > 0) { 545 var tl = gradientChartTableLayout;545 var tl = partialDependencePlotTableLayout; 546 546 MaxColumns = columns; 547 547 tl.SuspendLayout(); … … 556 556 private async void solution_ModelChanged(object sender, EventArgs e) { 557 557 foreach (var variable in VisibleVariables) { 558 var gradientChart = gradientCharts[variable];558 var pdp = partialDependencePlots[variable]; 559 559 var densityChart = densityCharts[variable]; 560 560 // recalculate and refresh 561 await gradientChart.RecalculateAsync(false, false);562 gradientChart.Refresh();561 await pdp.RecalculateAsync(false, false); 562 pdp.Refresh(); 563 563 UpdateDensityChart(densityChart, variable); 564 564 }
Note: See TracChangeset
for help on using the changeset viewer.