Changeset 12884 for branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs
- Timestamp:
- 08/19/15 13:59:32 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/BubbleChart/HeuristicLab.Optimization.BubbleChart/3.3/BubbleChartView.cs
r12882 r12884 567 567 } 568 568 569 private void chart_MouseMove(object sender, MouseEventArgs e) { 570 if (Control.MouseButtons != MouseButtons.None) return; 571 HitTestResult h = this.chart.HitTest(e.X, e.Y); 572 string newTooltipText = string.Empty; 573 string oldTooltipText; 574 if (h.ChartElementType == ChartElementType.DataPoint) { 575 var tag = (Tuple<double, double, RecursiveDataItem, RecursiveDataItem>)((DataPoint)h.Object).Tag; 576 newTooltipText = BuildTooltip(tag); 577 } else if (h.ChartElementType == ChartElementType.AxisLabels) { 578 newTooltipText = ((CustomLabel)h.Object).ToolTip; 579 } 580 581 oldTooltipText = this.tooltip.GetToolTip(chart); 582 if (newTooltipText != oldTooltipText) 583 this.tooltip.SetToolTip(chart, newTooltipText); 584 } 585 586 private string BuildTooltip(Tuple<double, double, RecursiveDataItem, RecursiveDataItem> tag) { 587 string tooltip; 588 if (tag.Item3 != tag.Item4) 589 tooltip = "X: " + tag.Item3.Name + Environment.NewLine + "Y: " + tag.Item4.Name + Environment.NewLine; 590 else 591 tooltip = tag.Item3.Name + Environment.NewLine; 592 593 double? xValue = tag.Item1; 594 double? yValue = tag.Item2; 595 //double? sizeValue = this.GetValue(run, (string)sizeComboBox.SelectedItem); 596 597 string xString = xValue == null ? string.Empty : xValue.Value.ToString(); 598 string yString = yValue == null ? string.Empty : yValue.Value.ToString(); 599 //string sizeString = sizeValue == null ? string.Empty : sizeValue.Value.ToString(); 600 601 // TODO 602 ////code to handle TimeSpanValues correct 603 //int axisDimensionCount = Enum.GetNames(typeof(AxisDimension)).Count(); 604 //int columnIndex = xAxisComboBox.SelectedIndex - axisDimensionCount; 605 //if (xValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) { 606 // TimeSpan time = TimeSpan.FromSeconds(xValue.Value); 607 // xString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds); 608 //} 609 //columnIndex = yAxisComboBox.SelectedIndex - axisDimensionCount; 610 //if (yValue.HasValue && columnIndex > 0 && Content.GetValue(0, columnIndex) is TimeSpanValue) { 611 // TimeSpan time = TimeSpan.FromSeconds(yValue.Value); 612 // yString = string.Format("{0:00}:{1:00}:{2:00.00}", (int)time.TotalHours, time.Minutes, time.Seconds); 613 //} 614 615 tooltip += xAxisComboBox.SelectedItem + " : " + xString + Environment.NewLine; 616 tooltip += yAxisComboBox.SelectedItem + " : " + yString + Environment.NewLine; 617 //tooltip += sizeComboBox.SelectedItem + " : " + sizeString + Environment.NewLine; 618 619 return tooltip; 620 } 621 622 private void chart_MouseDoubleClick(object sender, MouseEventArgs e) { 623 HitTestResult h = this.chart.HitTest(e.X, e.Y, ChartElementType.DataPoint); 624 if (h.ChartElementType == ChartElementType.DataPoint) { 625 var tuple = (Tuple<double, double, RecursiveDataItem, RecursiveDataItem>)((DataPoint)h.Object).Tag; 626 IContentView view = MainFormManager.MainForm.ShowContent(tuple.Item3, typeof(RecursiveDataItemView)); 627 if (view != null) { 628 view.ReadOnly = this.ReadOnly; 629 view.Locked = this.Locked; 630 } 631 if (tuple.Item3 != tuple.Item4) { 632 view = MainFormManager.MainForm.ShowContent(tuple.Item4, typeof(RecursiveDataItemView)); 633 if (view != null) { 634 view.ReadOnly = this.ReadOnly; 635 view.Locked = this.Locked; 636 } 637 } 638 639 this.chart.ChartAreas[0].CursorX.SelectionStart = this.chart.ChartAreas[0].CursorX.SelectionEnd; 640 this.chart.ChartAreas[0].CursorY.SelectionStart = this.chart.ChartAreas[0].CursorY.SelectionEnd; 641 } 642 UpdateAxisLabels(); 643 } 569 644 #endregion 570 645
Note: See TracChangeset
for help on using the changeset viewer.