Changeset 4049
- Timestamp:
- 07/19/10 17:31:28 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.Designer.cs
r3742 r4049 199 199 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 200 200 this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown); 201 this.chart.AxisViewChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ViewEventArgs>(chart_AxisViewChanged); 201 202 // 202 203 // zoomButton … … 293 294 this.ResumeLayout(false); 294 295 this.PerformLayout(); 295 296 296 } 297 298 297 #endregion 299 298 -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r3764 r4049 137 137 } else 138 138 AddDataPoint(run); 139 139 UpdateCursorInterval(); 140 140 141 141 … … 275 275 DoubleValue doubleValue = value as DoubleValue; 276 276 IntValue intValue = value as IntValue; 277 TimeSpanValue timeSpanValue = value as TimeSpanValue; 277 278 double? ret = null; 278 279 if (doubleValue != null) { … … 281 282 } else if (intValue != null) 282 283 ret = intValue.Value; 283 else 284 else if (timeSpanValue != null) { 285 ret = timeSpanValue.Value.TotalSeconds; 286 } else 284 287 ret = GetCategoricalValue(columnIndex, value.ToString()); 285 288 … … 339 342 double xRange = xValues.Max() - xValues.Min(); 340 343 double yRange = yValues.Max() - yValues.Min(); 341 if (xRange.IsAlmost(0.0)) xRange = 1.0;342 if (yRange.IsAlmost(0.0)) yRange = 1.0;344 if (xRange.IsAlmost(0.0)) xRange = 1.0; 345 if (yRange.IsAlmost(0.0)) yRange = 1.0; 343 346 double xDigits = (int)Math.Log10(xRange) - 3; 344 347 double yDigits = (int)Math.Log10(yRange) - 3; … … 347 350 this.chart.ChartAreas[0].CursorX.Interval = xZoomInterval; 348 351 this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval; 352 353 //code to handle TimeSpanValues correct 354 int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count(); 355 int columnIndex = xAxisComboBox.SelectedIndex - axisDimensionCount; 356 if (columnIndex >= 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) 357 this.chart.ChartAreas[0].CursorX.Interval = 1; 358 columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount; 359 if (columnIndex >= 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) 360 this.chart.ChartAreas[0].CursorY.Interval = 1; 349 361 } 350 362 … … 447 459 string sizeString = sizeValue == null ? string.Empty : sizeValue.Value.ToString(); 448 460 461 //code to handle TimeSpanValues correct 462 int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count(); 463 int columnIndex = xAxisComboBox.SelectedIndex - axisDimensionCount; 464 if (xValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) { 465 TimeSpan time = TimeSpan.FromSeconds(xValue.Value); 466 xString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.TotalSeconds); 467 } 468 columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount; 469 if (yValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) { 470 TimeSpan time = TimeSpan.FromSeconds(yValue.Value); 471 yString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.TotalSeconds); 472 } 473 449 474 tooltip += xAxisComboBox.SelectedItem + " : " + xString + Environment.NewLine; 450 475 tooltip += yAxisComboBox.SelectedItem + " : " + yString + Environment.NewLine; … … 483 508 SetCustomAxisLabels(yAxis, yAxisComboBox.SelectedIndex - axisDimensionCount); 484 509 } 510 511 private void chart_AxisViewChanged(object sender, System.Windows.Forms.DataVisualization.Charting.ViewEventArgs e) { 512 this.UpdateAxisLabels(); 513 } 514 485 515 private void SetCustomAxisLabels(Axis axis, int dimension) { 486 516 axis.CustomLabels.Clear(); … … 498 528 axis.LabelStyle.Angle = 0; 499 529 axis.LabelStyle.TruncatedLabels = true; 530 } else if (dimension > 0 && Content.GetValue(0, dimension) is TimeSpanValue) { 531 this.chart.ChartAreas[0].RecalculateAxesScale(); 532 for (double i = axis.Minimum; i <= axis.Maximum; i += axis.LabelStyle.Interval) { 533 TimeSpan time = TimeSpan.FromSeconds(i); 534 string x = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.TotalSeconds); 535 axis.CustomLabels.Add(i - 0.5, i + 0.5, x); 536 } 500 537 } 501 538 }
Note: See TracChangeset
for help on using the changeset viewer.