Changeset 12884
- Timestamp:
- 08/19/15 13:59:32 (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
r12882 r12884 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea 2= new System.Windows.Forms.DataVisualization.Charting.ChartArea();49 System.Windows.Forms.DataVisualization.Charting.Series series 2= new System.Windows.Forms.DataVisualization.Charting.Series();48 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 49 System.Windows.Forms.DataVisualization.Charting.Series series1 = 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(); … … 56 56 this.childrenGroupBox = new System.Windows.Forms.GroupBox(); 57 57 this.splitContainer = new System.Windows.Forms.SplitContainer(); 58 this.noDataLabel = new System.Windows.Forms.Label(); 58 59 this.sizeComboBox = new System.Windows.Forms.ComboBox(); 59 60 this.sizeLabel = new System.Windows.Forms.Label(); … … 66 67 this.yJitterTrackBar = new System.Windows.Forms.TrackBar(); 67 68 this.xJitterTrackBar = new System.Windows.Forms.TrackBar(); 68 this. noDataLabel = new System.Windows.Forms.Label();69 this.tooltip = new System.Windows.Forms.ToolTip(this.components); 69 70 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); 70 71 this.childrenGroupBox.SuspendLayout(); … … 103 104 | System.Windows.Forms.AnchorStyles.Left) 104 105 | System.Windows.Forms.AnchorStyles.Right))); 105 chartArea 2.Name = "ChartArea1";106 this.chart.ChartAreas.Add(chartArea 2);106 chartArea1.Name = "ChartArea1"; 107 this.chart.ChartAreas.Add(chartArea1); 107 108 this.chart.Location = new System.Drawing.Point(3, 3); 108 109 this.chart.Name = "chart"; 109 series 2.ChartArea = "ChartArea1";110 series 2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;111 series 2.IsVisibleInLegend = false;112 series 2.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;113 series 2.Name = "Bubbles";114 series 2.YValuesPerPoint = 2;115 this.chart.Series.Add(series 2);110 series1.ChartArea = "ChartArea1"; 111 series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point; 112 series1.IsVisibleInLegend = false; 113 series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle; 114 series1.Name = "Bubbles"; 115 series1.YValuesPerPoint = 2; 116 this.chart.Series.Add(series1); 116 117 this.chart.Size = new System.Drawing.Size(966, 668); 117 118 this.chart.TabIndex = 7; 118 119 this.chart.AxisViewChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ViewEventArgs>(this.chart_AxisViewChanged); 120 this.chart.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDoubleClick); 121 this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove); 119 122 // 120 123 // yAxisComboBox … … 184 187 this.splitContainer.SplitterDistance = 107; 185 188 this.splitContainer.TabIndex = 12; 189 // 190 // noDataLabel 191 // 192 this.noDataLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 193 this.noDataLabel.AutoSize = true; 194 this.noDataLabel.Location = new System.Drawing.Point(469, 323); 195 this.noDataLabel.Name = "noDataLabel"; 196 this.noDataLabel.Size = new System.Drawing.Size(139, 13); 197 this.noDataLabel.TabIndex = 8; 198 this.noDataLabel.Text = "No data could be displayed."; 199 this.noDataLabel.Visible = false; 186 200 // 187 201 // sizeComboBox … … 291 305 this.xJitterTrackBar.TickStyle = System.Windows.Forms.TickStyle.None; 292 306 this.xJitterTrackBar.ValueChanged += new System.EventHandler(this.jitterTrackBar_ValueChanged); 293 //294 // noDataLabel295 //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;304 307 // 305 308 // BubbleChartView … … 363 366 private System.Windows.Forms.TrackBar xJitterTrackBar; 364 367 private System.Windows.Forms.Label noDataLabel; 368 private System.Windows.Forms.ToolTip tooltip; 365 369 } 366 370 } -
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.