Changeset 13853
- Timestamp:
- 05/19/16 15:31:30 (9 years ago)
- Location:
- branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/DensityTrackbar.cs
r13850 r13853 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Drawing; 24 25 using System.Globalization; 25 26 using System.Windows.Forms; … … 91 92 trackBar.Enabled = !Checked; 92 93 textBox.Text = Checked ? "Plotted" : Value.ToString(CultureInfo.InvariantCulture); 94 radioButton.BackColor = Checked ? SystemColors.ActiveCaption : SystemColors.Control; 93 95 OnCheckedChanged(); 94 96 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.Designer.cs
r13850 r13853 30 30 System.Windows.Forms.DataVisualization.Charting.StripLine stripLine2 = new System.Windows.Forms.DataVisualization.Charting.StripLine(); 31 31 System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); 32 this.calculationPendingLabel = new System.Windows.Forms.Label(); 33 this.calculationPendingTimer = new System.Windows.Forms.Timer(this.components); 32 34 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 33 this.statusLabel = new System.Windows.Forms.Label();34 35 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 35 36 this.SuspendLayout(); 37 // 38 // calculationPendingLabel 39 // 40 this.calculationPendingLabel.BackColor = System.Drawing.Color.White; 41 this.calculationPendingLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Timer; 42 this.calculationPendingLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; 43 this.calculationPendingLabel.Location = new System.Drawing.Point(3, 3); 44 this.calculationPendingLabel.Margin = new System.Windows.Forms.Padding(0); 45 this.calculationPendingLabel.Name = "calculationPendingLabel"; 46 this.calculationPendingLabel.Size = new System.Drawing.Size(17, 17); 47 this.calculationPendingLabel.TabIndex = 1; 48 this.calculationPendingLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; 49 this.calculationPendingLabel.Visible = false; 50 // 51 // calculationPendingTimer 52 // 53 this.calculationPendingTimer.Tick += new System.EventHandler(this.calculationPendingTimer_Tick); 36 54 // 37 55 // chart … … 68 86 this.chart.TabIndex = 0; 69 87 this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging); 70 this.chart.FormatNumber += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.FormatNumberEventArgs>(this.chart_FormatNumber);71 88 this.chart.DragDrop += new System.Windows.Forms.DragEventHandler(this.chart_DragDrop); 72 89 this.chart.DragEnter += new System.Windows.Forms.DragEventHandler(this.chart_DragEnter); 73 90 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 74 //75 // statusLabel76 //77 this.statusLabel.BackColor = System.Drawing.Color.White;78 this.statusLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Timer;79 this.statusLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;80 this.statusLabel.Location = new System.Drawing.Point(3, 3);81 this.statusLabel.Margin = new System.Windows.Forms.Padding(0);82 this.statusLabel.Name = "statusLabel";83 this.statusLabel.Size = new System.Drawing.Size(17, 17);84 this.statusLabel.TabIndex = 1;85 this.statusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;86 this.statusLabel.Visible = false;87 91 // 88 92 // GradientChart … … 90 94 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 91 95 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 92 this.Controls.Add(this. statusLabel);96 this.Controls.Add(this.calculationPendingLabel); 93 97 this.Controls.Add(this.chart); 94 98 this.Name = "GradientChart"; … … 102 106 103 107 private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart; 104 private System.Windows.Forms.Label statusLabel; 108 private System.Windows.Forms.Label calculationPendingLabel; 109 private System.Windows.Forms.Timer calculationPendingTimer; 105 110 } 106 111 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/GradientChart.cs
r13850 r13853 44 44 private readonly Dictionary<IRegressionSolution, Series> ciSeriesCache; 45 45 46 private readonly ToolStripMenuItem configToolStripMenuItem; 47 private readonly GradientChartConfigurationDialog configurationDialog; 48 46 49 #region Properties 47 50 public bool ShowLegend { … … 49 52 set { chart.Legends[0].Enabled = value; } 50 53 } 51 public bool ShowXAxisLabel {52 get { return chart.ChartAreas[0].AxisX.Enabled == AxisEnabled.True; }53 set { chart.ChartAreas[0].AxisX.Enabled = value ? AxisEnabled.True : AxisEnabled.False; }54 }55 public bool ShowYAxisLabel {56 get { return chart.ChartAreas[0].AxisY.Enabled == AxisEnabled.True; }57 set { chart.ChartAreas[0].AxisY.Enabled = value ? AxisEnabled.True : AxisEnabled.False; }58 }59 54 public bool ShowCursor { 60 55 get { return chart.Annotations[0].Visible; } 61 set { chart.Annotations[0].Visible = value; } 56 set { 57 chart.Annotations[0].Visible = value; 58 if (!value) chart.ChartAreas[0].AxisX.Title = string.Empty; 59 } 62 60 } 63 61 … … 191 189 chart.ChartAreas[0].CursorY.Interval = 0; 192 190 191 configToolStripMenuItem = new ToolStripMenuItem("Configuration"); 192 configToolStripMenuItem.Click += configToolStripMenuItem_Click; 193 chart.ContextMenuStrip.Items.Add(new ToolStripSeparator()); 194 chart.ContextMenuStrip.Items.Add(configToolStripMenuItem); 195 196 configurationDialog = new GradientChartConfigurationDialog(this); 197 193 198 Disposed += GradientChart_Disposed; 194 199 } 200 195 201 private void GradientChart_Disposed(object sender, EventArgs e) { 196 202 if (cancelCurrentRecalculateSource != null) … … 237 243 return; 238 244 239 statusLabel.Visible = true; 245 calculationPendingTimer.Start(); 246 240 247 Update(); // immediately show label 241 248 … … 248 255 var defaultValue = sharedFixedVariables.GetDoubleValue(freeVariable, 0); 249 256 VerticalLineAnnotation.X = defaultValue; 250 chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture); 257 if (ShowCursor) 258 chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture); 251 259 252 260 // Update series … … 264 272 UpdateOutOfTrainingRangeStripLines(); 265 273 266 statusLabel.Visible = false; 274 calculationPendingTimer.Stop(); 275 calculationPendingLabel.Visible = false; 267 276 if (updateOnFinish) 268 277 Update(); … … 437 446 var series = seriesCache[solution]; 438 447 series.Points.SuspendUpdates(); 448 series.Points.Clear(); 439 449 for (int i = 0; i < xvalues.Count; i++) 440 450 series.Points.Add(new DataPoint(xvalues[i], 0.0)); … … 444 454 if (ciSeriesCache.TryGetValue(solution, out confidenceIntervalSeries)) { 445 455 confidenceIntervalSeries.Points.SuspendUpdates(); 456 confidenceIntervalSeries.Points.Clear(); 446 457 for (int i = 0; i < xvalues.Count; i++) 447 458 confidenceIntervalSeries.Points.Add(new DataPoint(xvalues[i], new[] { -1.0, 1.0 })); … … 538 549 newLocation = axisX.Minimum; 539 550 551 if (oldCurserPosition.IsAlmost(newLocation)) 552 return; 553 540 554 e.NewLocationX = newLocation; 555 oldCurserPosition = e.NewLocationX; 541 556 542 557 var annotation = VerticalLineAnnotation; … … 544 559 sharedFixedVariables.SetVariableValue(x, FreeVariable, 0); 545 560 546 chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);547 chart.Update();548 549 if (!oldCurserPosition.IsAlmost(e.NewLocationX))550 OnVariableValueChanged(this, EventArgs.Empty); 551 oldCurserPosition = e.NewLocationX;561 if (ShowCursor) { 562 chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture); 563 chart.Update(); 564 } 565 566 OnVariableValueChanged(this, EventArgs.Empty); 552 567 } 553 568 … … 555 570 bool hitCursor = chart.HitTest(e.X, e.Y).ChartElementType == ChartElementType.Annotation; 556 571 chart.Cursor = hitCursor ? Cursors.VSplit : Cursors.Default; 557 }558 559 private void chart_FormatNumber(object sender, FormatNumberEventArgs e) {560 if (e.ElementType == ChartElementType.AxisLabels) {561 switch (e.Format) {562 case "CustomAxisXFormat":563 break;564 case "CustomAxisYFormat":565 var v = e.Value;566 e.LocalizedValue = string.Format("{0,5}", v);567 break;568 default:569 break;570 }571 }572 572 } 573 573 … … 590 590 } 591 591 } 592 593 private void calculationPendingTimer_Tick(object sender, EventArgs e) { 594 calculationPendingLabel.Visible = true; 595 Update(); 596 } 597 598 private void configToolStripMenuItem_Click(object sender, EventArgs e) { 599 configurationDialog.ShowDialog(this); 600 } 592 601 #endregion 593 602 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r13850 r13853 282 282 <Compile Include="GradientChart.Designer.cs"> 283 283 <DependentUpon>GradientChart.cs</DependentUpon> 284 </Compile> 285 <Compile Include="GradientChartConfigurationDialog.cs"> 286 <SubType>Form</SubType> 287 </Compile> 288 <Compile Include="GradientChartConfigurationDialog.Designer.cs"> 289 <DependentUpon>GradientChartConfigurationDialog.cs</DependentUpon> 284 290 </Compile> 285 291 <Compile Include="Regression\RegressionSolutionGradientView.cs"> -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.Designer.cs
r13850 r13853 81 81 this.gradientChart.Name = "gradientChart"; 82 82 this.gradientChart.ShowCursor = false; 83 this.gradientChart.ShowLegend = true; 84 this.gradientChart.ShowXAxisLabel = false; 85 this.gradientChart.ShowYAxisLabel = true; 83 this.gradientChart.ShowLegend = false; 86 84 this.gradientChart.Size = new System.Drawing.Size(715, 376); 87 85 this.gradientChart.TabIndex = 0; -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs
r13850 r13853 110 110 tableLayoutPanel.ResumeRepaint(true); 111 111 112 // Init Y-axis range 113 var problemData = Content.ProblemData; 114 double min = double.MaxValue, max = double.MinValue; 115 var trainingTarget = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices); 116 foreach (var t in trainingTarget) { 117 if (t < min) min = t; 118 if (t > max) max = t; 119 } 120 double range = max - min; 121 const double scale = 1.0 / 3.0; 122 double axisMin, axisMax, axisInterval; 123 ChartUtil.CalculateAxisInterval(min - scale * range, max + scale * range, 5, out axisMin, out axisMax, out axisInterval); 124 gradientChart.FixedYAxisMin = axisMin; 125 gradientChart.FixedYAxisMax = axisMax; 126 112 127 trackbars.First().Checked = true; 113 128 } -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.Designer.cs
r13850 r13853 50 50 this.variableListView.Location = new System.Drawing.Point(3, 16); 51 51 this.variableListView.Name = "variableListView"; 52 this.variableListView.Size = new System.Drawing.Size(163, 482);52 this.variableListView.Size = new System.Drawing.Size(163, 503); 53 53 this.variableListView.TabIndex = 0; 54 54 this.variableListView.UseCompatibleStateImageBehavior = false; … … 77 77 this.yAxisConfigGroupBox.Location = new System.Drawing.Point(0, 0); 78 78 this.yAxisConfigGroupBox.Name = "yAxisConfigGroupBox"; 79 this.yAxisConfigGroupBox.Size = new System.Drawing.Size(169, 98);79 this.yAxisConfigGroupBox.Size = new System.Drawing.Size(169, 77); 80 80 this.yAxisConfigGroupBox.TabIndex = 2; 81 81 this.yAxisConfigGroupBox.TabStop = false; … … 97 97 // 98 98 this.automaticYAxisCheckBox.AutoSize = true; 99 this.automaticYAxisCheckBox.Location = new System.Drawing.Point( 6, 72);99 this.automaticYAxisCheckBox.Location = new System.Drawing.Point(49, -1); 100 100 this.automaticYAxisCheckBox.Name = "automaticYAxisCheckBox"; 101 101 this.automaticYAxisCheckBox.Size = new System.Drawing.Size(73, 17); … … 108 108 this.densityGroupBox.Controls.Add(this.densityComboBox); 109 109 this.densityGroupBox.Dock = System.Windows.Forms.DockStyle.Top; 110 this.densityGroupBox.Location = new System.Drawing.Point(0, 98);110 this.densityGroupBox.Location = new System.Drawing.Point(0, 77); 111 111 this.densityGroupBox.Name = "densityGroupBox"; 112 112 this.densityGroupBox.Size = new System.Drawing.Size(169, 49); … … 156 156 this.variableGroupBox.Controls.Add(this.variableListView); 157 157 this.variableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 158 this.variableGroupBox.Location = new System.Drawing.Point(0, 1 47);158 this.variableGroupBox.Location = new System.Drawing.Point(0, 126); 159 159 this.variableGroupBox.Name = "variableGroupBox"; 160 this.variableGroupBox.Size = new System.Drawing.Size(169, 5 01);160 this.variableGroupBox.Size = new System.Drawing.Size(169, 522); 161 161 this.variableGroupBox.TabIndex = 1; 162 162 this.variableGroupBox.TabStop = false; -
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs
r13850 r13853 160 160 ShowLegend = false, 161 161 ShowCursor = true, 162 ShowXAxisLabel = true,163 ShowYAxisLabel = true,164 162 YAxisTicks = 5, 165 163 };
Note: See TracChangeset
for help on using the changeset viewer.