Changeset 12882 for branches/BubbleChart
- Timestamp:
- 08/19/15 13:27:06 (9 years ago)
- Location:
- branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.Designer.cs
r12881 r12882 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 1= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Series series 1= new System.Windows.Forms.DataVisualization.Charting.Series();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series(); 50 50 this.yLabel = new System.Windows.Forms.Label(); 51 51 this.xLabel = new System.Windows.Forms.Label(); … … 66 66 this.yJitterTrackBar = new System.Windows.Forms.TrackBar(); 67 67 this.xJitterTrackBar = new System.Windows.Forms.TrackBar(); 68 this.noDataLabel = new System.Windows.Forms.Label(); 68 69 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 69 70 this.childrenGroupBox.SuspendLayout(); … … 102 103 | System.Windows.Forms.AnchorStyles.Left) 103 104 | System.Windows.Forms.AnchorStyles.Right))); 104 chartArea 1.Name = "ChartArea1";105 this.chart.ChartAreas.Add(chartArea 1);105 chartArea2.Name = "ChartArea1"; 106 this.chart.ChartAreas.Add(chartArea2); 106 107 this.chart.Location = new System.Drawing.Point(3, 3); 107 108 this.chart.Name = "chart"; 108 series 1.ChartArea = "ChartArea1";109 series 1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;110 series 1.IsVisibleInLegend = false;111 series 1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;112 series 1.Name = "Bubbles";113 series 1.YValuesPerPoint = 2;114 this.chart.Series.Add(series 1);109 series2.ChartArea = "ChartArea1"; 110 series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; 111 series2.IsVisibleInLegend = false; 112 series2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; 113 series2.Name = "Bubbles"; 114 series2.YValuesPerPoint = 2; 115 this.chart.Series.Add(series2); 115 116 this.chart.Size = new System.Drawing.Size(966, 668); 116 117 this.chart.TabIndex = 7; … … 178 179 // splitContainer.Panel2 179 180 // 181 this.splitContainer.Panel2.Controls.Add(this.noDataLabel); 180 182 this.splitContainer.Panel2.Controls.Add(this.chart); 181 183 this.splitContainer.Size = new System.Drawing.Size(1083, 674); … … 289 291 this.xJitterTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 290 292 this.xJitterTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged); 293 // 294 // noDataLabel 295 // 296 this.noDataLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 297 this.noDataLabel.AutoSize = true; 298 this.noDataLabel.Location = new System.Drawing.Point(469, 323); 299 this.noDataLabel.Name = "noDataLabel"; 300 this.noDataLabel.Size = new System.Drawing.Size(139, 13); 301 this.noDataLabel.TabIndex = 8; 302 this.noDataLabel.Text = "No data could be displayed."; 303 this.noDataLabel.Visible = false; 291 304 // 292 305 // BubbleChartView … … 317 330 this.splitContainer.Panel1.ResumeLayout(false); 318 331 this.splitContainer.Panel2.ResumeLayout(false); 332 this.splitContainer.Panel2.PerformLayout(); 319 333 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit(); 320 334 this.splitContainer.ResumeLayout(false); … … 348 362 private System.Windows.Forms.TrackBar yJitterTrackBar; 349 363 private System.Windows.Forms.TrackBar xJitterTrackBar; 364 private System.Windows.Forms.Label noDataLabel; 350 365 } 351 366 } -
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs
r12881 r12882 197 197 chart.ChartAreas[0].AxisY.IsMarginVisible = !(YAxisValue != null && YAxisValue.Contains(AxisDimension.Index.ToString())); 198 198 199 if (Content == null || string.IsNullOrEmpty(XAxisValue) || string.IsNullOrEmpty(YAxisValue)) return; 200 201 var xss = GetValues(XAxisValue); 202 var yss = GetValues(YAxisValue); 203 204 if (xss.Count == yss.Count) { 205 for (int i = 0; i < xss.Count; i++) 206 AddPoints(xss[i], yss[i], series); 207 } else if (xss.Count == 1 || yss.Count == 1) { 208 for (int i = 0; i < xss.Count; i++) 209 for (int j = 0; j < yss.Count; j++) 210 AddPoints(xss[i], yss[j], series); 199 if (Content != null && !string.IsNullOrEmpty(XAxisValue) && !string.IsNullOrEmpty(YAxisValue)) { 200 var xss = GetValues(XAxisValue); 201 var yss = GetValues(YAxisValue); 202 203 if (xss.Count == yss.Count) { 204 for (int i = 0; i < xss.Count; i++) 205 AddPoints(xss[i], yss[i], series); 206 } else if (xss.Count == 1 || yss.Count == 1) { 207 for (int i = 0; i < xss.Count; i++) 208 for (int j = 0; j < yss.Count; j++) 209 AddPoints(xss[i], yss[j], series); 210 } 211 } 212 213 if (chart.Series[0].Points.Count == 0) { 214 noDataLabel.Visible = true; 215 } else { 216 noDataLabel.Visible = false; 217 UpdateMarkerSizes(); 218 UpdateCursorInterval(); 211 219 } 212 220 … … 520 528 } 521 529 } 530 private void UpdateCursorInterval() { 531 double xMin = double.MaxValue; 532 double xMax = double.MinValue; 533 double yMin = double.MaxValue; 534 double yMax = double.MinValue; 535 536 foreach (var point in chart.Series[0].Points) { 537 if (point.IsEmpty) continue; 538 if (point.XValue < xMin) xMin = point.XValue; 539 if (point.XValue > xMax) xMax = point.XValue; 540 if (point.YValues[0] < yMin) yMin = point.YValues[0]; 541 if (point.YValues[0] > yMax) yMax = point.YValues[0]; 542 } 543 544 double xRange = 0.0; 545 double yRange = 0.0; 546 if (xMin != double.MaxValue && xMax != double.MinValue) xRange = xMax - xMin; 547 if (yMin != double.MaxValue && yMax != double.MinValue) yRange = yMax - yMin; 548 549 if (xRange.IsAlmost(0.0)) xRange = 1.0; 550 if (yRange.IsAlmost(0.0)) yRange = 1.0; 551 double xDigits = (int)Math.Log10(xRange) - 3; 552 double yDigits = (int)Math.Log10(yRange) - 3; 553 double xZoomInterval = Math.Pow(10, xDigits); 554 double yZoomInterval = Math.Pow(10, yDigits); 555 this.chart.ChartAreas[0].CursorX.Interval = xZoomInterval; 556 this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval; 557 558 // TODO 559 //code to handle TimeSpanValues correct 560 //int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count(); 561 //int columnIndex = xAxisComboBox.SelectedIndex - axisDimensionCount; 562 //if (columnIndex >= 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) 563 // this.chart.ChartAreas[0].CursorX.Interval = 1; 564 //columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount; 565 //if (columnIndex >= 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) 566 // this.chart.ChartAreas[0].CursorY.Interval = 1; 567 } 568 522 569 #endregion 523 570
Note: See TracChangeset
for help on using the changeset viewer.