private void Chart_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.LegendItem) { if (e.HitTestResult.Series == paretoSeries && (Content.ParetoFront == null || Content.ParetoFront.Length == 0)) { e.Text = "No optimal pareto front is available for this problem with this number of objectives"; } if (e.HitTestResult.Series == paretoSeries && (xDim >= Content.Objectives || yDim >= Content.Objectives)) { e.Text = "The optimal pareto front can only be displayed in Objective Space"; } } // Check selected chart element and set tooltip text if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; StringBuilder toolTippText = new StringBuilder(); DataPoint qp = e.HitTestResult.Series.Points[i]; toolTippText.Append("Objective " + xDim + " = " + qp.XValue + "\n"); toolTippText.Append("Objective " + yDim + " = " + qp.YValues[0]); Series s = e.HitTestResult.Series; if (s.Equals(this.chart.Series[QUALITIES])) { double[] dp = Content.Solutions[i]; toolTippText.Append("\nSolution: {"); for (int j = 0; j < dp.Length; j++) { toolTippText.Append(dp[j]); toolTippText.Append(";"); } toolTippText.Remove(toolTippText.Length - 1, 1); toolTippText.Append("}"); e.Text = toolTippText.ToString(); } } }
private void ca_Messwerte_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; DataPoint dp = e.HitTestResult.Series.Points[i]; e.Text = "X: " + (DateTime.FromOADate(dp.XValue).ToShortDateString() + " Y: " + dp.YValues[0].ToString()); } }
private void InformationTipEvent(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { DataPoint myPoint = (DataPoint)(e.HitTestResult.Object); e.Text = "X value: " + myPoint.XValue + Environment.NewLine; e.Text += "Y value: " + myPoint.YValues[0] + Environment.NewLine; } }
private void chart_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: DataPoint tmp = e.HitTestResult.Object as DataPoint; e.Text = "时间:" + tmp.AxisLabel + "\n值:" + Math.Round(tmp.YValues[0], 3); break; } }
////选择测点按钮 //private void btnSetTag_Click(object sender, EventArgs e) //{ // try // { // FrmShowHisSelectTag fshs1 = new FrmShowHisSelectTag(); // fshs1.TopMost = true; //窗体前端显示设为true // fshs1.ShowDialog(); // ArrayList sTags = new ArrayList(); // sTags = fshs1.sTags;//返回待查询的数据 // stempTags = ""; // //若点击了取消按钮 // if (sTags.Count == 0) // return; // stempSTags = new string[sTags.Count]; // for (int ii = 0; ii < sTags.Count; ii++) // { // stempTags += "F" + ((BindTag.TagObject)sTags[ii]).id + ","; // stempSTags[ii] = ((BindTag.TagObject)sTags[ii]).tagdesc + "/F" + ((BindTag.TagObject)sTags[ii]).id; // } // stempTags = stempTags.Substring(0, stempTags.Length - 1); // fshs1.Dispose(); // //DateTime DtB = this.dtpBtime.Value; // //DateTime DtE = this.dtpEtime.Value; // //if (DtB >= DtE)//若不是同一天 // //{ // // MessageBox.Show("开始时间必须小于结束时间!"); // // return; // //} // //BindChart(stempTags, stempSTags); // BindChartSeries(stempTags, stempSTags); // BindChartHistory(stempTags); // } // catch (Exception ex) // { // int i = 0; // throw; // } //} private void chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == System.Windows.Forms.DataVisualization.Charting.ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; System.Windows.Forms.DataVisualization.Charting.DataPoint dp = e.HitTestResult.Series.Points[i]; Object obj = dp.XValue; e.Text = string.Format("{0:F3}", dp.YValues[0]); } }
private void coinHistoryChart_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { // Check selected chart element and set tooltip text for it tooltip.RemoveAll(); switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: var dataPoint = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; tooltip.Show(dataPoint.YValues[0].ToString(), this.coinHistoryChart, e.X + 20, e.Y); break; } }
private void WeatherChart_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { if (_prevPoint != null) { _prevPoint.MarkerStyle = MarkerStyle.None; _prevPoint.IsValueShownAsLabel = false; _prevPoint.Label = ""; } //MessageBox.Show(e.HitTestResult.ChartElementType.ToString()); switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: var dataPoint = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; //e.Text = string.Format("X:\t{0}\nY:\t{1}", dataPoint.XValue, dataPoint.YValues[0]); var prop = e.HitTestResult.Object as DataPoint; if (prop != null) { prop.IsValueShownAsLabel = true; prop.MarkerStyle = MarkerStyle.Star4; DateTime date; switch (AnalyzeTypeListBox.SelectedIndex) { case 0: date = DateTime.FromOADate(prop.XValue); prop.Label = $"{date}\n{prop.YValues[0]}°C"; break; case 1: prop.Label = $"{prop.XValue}°C\n{prop.YValues[0]} год"; break; case 2: prop.Label = $"{prop.YValues[0]}%"; break; case 3: prop.Label = $"{prop.XValue} м/с\n{prop.YValues[0]} год"; break; case 4: date = DateTime.FromOADate(prop.XValue); prop.Label = $"{date.ToString()}\n{prop.YValues[0]} Вт/м^2"; break; case 5: prop.Label = $"{prop.XValue} Вт/м^2\n{prop.YValues[0]} год"; break; } } _prevPoint = prop; break; } }
private void chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { HitTestResult myTestResult = chart1.HitTest(e.X, e.Y, ChartElementType.DataPoint);//获取命中测试的结果 if (myTestResult.ChartElementType == ChartElementType.DataPoint) { int i = myTestResult.PointIndex; DataPoint dp = myTestResult.Series.Points[i]; string YValue = dp.YValues[0].ToString();//获取数据点的Y值 e.Text = "\r该点数值:" + YValue; } }
private void chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; DataPoint dp = e.HitTestResult.Series.Points[i]; //this.labelx.Text = dp.XValue.ToString(); //this.labely.Text = dp.YValues[0].ToString(); tooptip.Show("x:" + dp.XValue + " y:" + dp.YValues[0], this.chart1, e.X, e.Y); //if (!this.labelx.Text.Equals(e.X.ToString()) && !this.labely.Text.Equals(e.Y.ToString())) //{ // this.labelx.Text = e.X.ToString(); // this.labely.Text = e.Y.ToString(); // toolTip1.Show("x:" + e.X + " y:" + e.Y, button1); //} } }
private void chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: DataPoint myPoint = (DataPoint)e.HitTestResult.Object; //e.Text = "X value: " + myPoint.XValue + Environment.NewLine; string[] gd = myPoint.AxisLabel.ToString().Split(' '); e.Text = "date : " + gd[0] + Environment.NewLine; e.Text += "time : " + gd[1] + Environment.NewLine; e.Text += "value : " + myPoint.YValues[0].ToString("N") + Environment.NewLine; break; default: break; } }
private void GetToolTip(System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e, string label) { if (_prevPoint != null) { _prevPoint.IsValueShownAsLabel = false; _prevPoint.Label = ""; } if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { var prop = e.HitTestResult.Object as DataPoint; if (prop != null) { prop.IsValueShownAsLabel = true; prop.Label = $"{prop.YValues[0]}{label}"; } _prevPoint = prop; } }
//private void CopylistView2_ItemChecked(object sender, ItemCheckedEventArgs e) //{ // try // { // if (lvCopy.CheckedIndices.Count > 1) // { // MessageBox.Show("Cannot select more than one item"); // e.Item.Checked = false; // } // } // catch (Exception) // { // } //} private void chrtCTC_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { ////// Check selected chart element and set tooltip text for it ////switch (e.HitTestResult.ChartElementType) ////{ //// case System.Windows.Forms.DataVisualization.Charting.ChartElementType.DataPoint: //// var dataPoint = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; //// e.Text = string.Format("X:\t{0}\nY:\t{1}", dataPoint.XValue, dataPoint.YValues[0]); //// break; ////} // Check selevted chart element and set tooltip text if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; string xLabel = e.HitTestResult.Series.AxisLabel; string xLabel1 = e.HitTestResult.Object.ToString(); System.Windows.Forms.DataVisualization.Charting.DataPoint dp = e.HitTestResult.Series.Points[i]; //------------------ string edsg = ""; string eoff = ""; double graphval = dp.YValues[0]; double gridval = 0.0; for (int j = 0; j < grdEmpCTC.Rows.Count; j++) { gridval = Convert.ToDouble(grdEmpCTC.Rows[j].Cells["CTCInLakh"].Value); if (graphval == gridval) { edsg = grdEmpCTC.Rows[j].Cells["ctcDesignation"].Value.ToString(); eoff = grdEmpCTC.Rows[j].Cells["ctcOffice"].Value.ToString(); } } //------------------ ////////e.Text = string.Format("{0:F1}, {1:F1}", dp.XValue, dp.YValues[0]); e.Text = string.Format("{0:F1}, {1:F1}", edsg, eoff); } }
private void myChart_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; DataPoint dp = e.HitTestResult.Series.Points[i]; e.Text = string.Format("时间:{0};数值:{1:F1} ", DateTime.FromOADate(dp.XValue), dp.YValues[0]); } }
private void ResourceChart_GetToolTipText( object sender, ToolTipEventArgs e ) { if ( e.HitTestResult.ChartElementType == ChartElementType.DataPoint ) { var dp = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; e.Text = string.Format( "{0:MM/dd HH:mm}\n{1} {2}", DateTime.FromOADate( dp.XValue ), e.HitTestResult.Series.LegendText, dp.YValues[0] ); } }
//对数分布图图表注释显示 private void LogDegree_GetToolTipText(object sender, ToolTipEventArgs e) { switch (e.HitTestResult.ChartElementType) { case ChartElementType.Axis: e.Text = e.HitTestResult.Axis.Title; break; case ChartElementType.LegendArea: e.Text = "图例"; break; case ChartElementType.PlottingArea: e.Text = "绘图区"; break; case ChartElementType.Title: e.Text = "图题"; break; } }
private void chart1_GetToolTipText(object sender, ToolTipEventArgs e) { switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: var nowDataPoint = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; // 比較 AxisLabel 若一樣取值 int sys = 0,dia = 0, pulse = 0; for (int i = 0; i < chart1.Series[0].Points.Count; i++) { if (chart1.Series[0].Points[i].AxisLabel == nowDataPoint.AxisLabel) { sys = (int)chart1.Series[0].Points[i].YValues[0]; dia = (int)chart1.Series[1].Points[i].YValues[0]; pulse = (int)chart1.Series[2].Points[i].YValues[0]; break; } } e.Text = string.Format("Date/Time: {0}\nSys: {1}\nPulse: {2}\nDia: {3}", nowDataPoint.AxisLabel,sys,pulse,dia); break; } }
private void Chart_GetToolTipText(object sender, ToolTipEventArgs e) { if (_updating) return; if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; DataPoint dp = e.HitTestResult.Series.Points[i]; double pixelPosition = chart.ChartAreas[0].AxisX.PixelPositionToValue(e.X); DateTime dt = DateTime.FromOADate(pixelPosition); List<Tuple<string, ServiceHistory.PriceStat>> group = new List<Tuple<string, ServiceHistory.PriceStat>>(); foreach (ChartHistory chartHistory in ChartHistories) { foreach (ServiceHistory.PriceStat priceStat in chartHistory.PriceHistories) { if (priceStat.Time >= dt - TimeSpan.FromSeconds(30) && priceStat.Time <= dt + TimeSpan.FromSeconds(30)) { group.Add(new Tuple<string, ServiceHistory.PriceStat>(chartHistory.Entry, priceStat)); break; } } } group = group.OrderByDescending(o => o.Item2.CurrentPrice).ToList(); Tuple<string, ServiceHistory.PriceStat> first = group.FirstOrDefault(); if (first != null) { StringBuilder sb = new StringBuilder("Time: ").Append(first.Item2.Time.ToString("g")); foreach (Tuple<string, ServiceHistory.PriceStat> tuple in @group) { sb.Append(Environment.NewLine) .Append(dp.YValues[0] == (double)tuple.Item2.CurrentPrice || dp.YValues[0] == (double)tuple.Item2.WindowedAveragePrice ? "→ " : "") .Append(tuple.Item1) .Append(": ") .Append(tuple.Item2.CurrentPrice.ToString("N6")) .Append(" [") .Append(tuple.Item2.WindowedAveragePrice.ToString("N6")) .Append("]"); } e.Text = sb.ToString(); } } }
//度分布图图表注释显示 private void DegreeChart_GetToolTipText(object sender, ToolTipEventArgs e) { int intIndex; switch (e.HitTestResult.ChartElementType) { case ChartElementType.Axis: e.Text = e.HitTestResult.Axis.Title ; break; case ChartElementType.DataPoint: intIndex =e.HitTestResult.PointIndex+1; e.Text = "度为:" + intIndex.ToString(); break; case ChartElementType.LegendArea: e.Text = "图例"; break; case ChartElementType.PlottingArea: e.Text = "绘图区"; break; case ChartElementType.Title: e.Text = "图题"; break; } }
/// <summary> /// 关联 this.chart1.GetToolTipText /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chart1_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint && e.HitTestResult.Series == this.chart1.Series[0]) { DataPoint dp = (DataPoint)e.HitTestResult.Object; DateTime dt = DateTime.FromOADate(dp.XValue); int currentBar = _stra.NumDateTimes.Count - 1 - _stra.NumDateTimes.IndexOf(Numeric.Parse(dt.ToString("yyyyMMdd.HHmmss"))); e.Text = dt.ToString("yyyy/MM/dd[") + dt.ToString("ddd").Substring(1, 1) + "]"; e.Text += "\r\n时间 = " + dt.TimeOfDay; e.Text += "\r\n开 = " + _stra.Opens[currentBar]; e.Text += "\r\n高 = " + _stra.Highs[currentBar]; e.Text += "\r\n低 = " + _stra.Lows[currentBar]; e.Text += "\r\n收 = " + _stra.Closes[currentBar]; e.Text += "\r\n量 = " + _stra.Volumes[currentBar]; e.Text += "\r\n仓 = " + _stra.OpenInts[currentBar]; e.Text += "\r\n[" + _stra.Name + "]"; //指标提示 //e.Text += "\r\n[指标]"; foreach (var a in _stra.Indicators) { string input = null; if (a.Input == _stra.Highs) { input = "H"; } else if (a.Input == _stra.Lows) { input = "L"; } else if (a.Input == _stra.Opens) { input = "O"; } else if (a.Input == _stra.Closes) { input = "C"; } else if (a.Input == _stra.Volumes) { input = "V"; } else if (a.Input == _stra.OpenInts) { input = "I"; } if (input != null) { e.Text += "\r\n" + a.GetType().Name + "<" + input + ">("; foreach (int p in a.Periods) { e.Text += p + ","; } e.Text = e.Text.Remove(e.Text.Length - 1); e.Text += ")"; if (a.DictCustomSeries.Count == 1) { e.Text += ":" + a.DictCustomSeries.ElementAt(0).Value[currentBar].ToString("F2"); } else { foreach (var o in a.DictCustomSeries) { e.Text += "\r\n" + o.Key + " : " + o.Value[currentBar].ToString("F2"); } } } } //跨周期 if (_stra.DictPeriodValue.Count > 0) { e.Text += "\r\n------ 跨周期 ------"; } foreach (var a in _stra.DictPeriodValue) { var ldt = _stra.DictPeriodTime[a.Key].LastOrDefault(n => n <= dt); int curBar = _stra.DictPeriodTime[a.Key].Count - _stra.DictPeriodTime[a.Key].IndexOf(ldt); string i3 = ""; switch (a.Key.Item3) { case PeriodType.Tick: i3 = "笔"; break; case PeriodType.Second: i3 = "秒"; break; case PeriodType.Minute: i3 = "分"; break; case PeriodType.Hour: i3 = "时"; break; case PeriodType.Day: i3 = "天"; break; case PeriodType.Week: i3 = "周"; break; case PeriodType.Month: i3 = "月"; break; case PeriodType.Year: i3 = "年"; break; } e.Text += "\r\n↑" + a.Key.Item1 + " " + a.Key.Item2 + i3 + " : " + a.Value[curBar].ToString("F2"); //指标提示 foreach (var i in _stra.Indicators.Where(n => n.Input == a.Value)) { e.Text += "\r\n↑" + i.GetType().Name + "("; foreach (int p in i.Periods) { e.Text += p + ","; } e.Text = e.Text.Remove(e.Text.Length - 1); e.Text += ")"; if (i.DictCustomSeries.Count == 1) { e.Text += ":" + i.DictCustomSeries.ElementAt(0).Value[curBar].ToString("F2"); } else { foreach (var o in i.DictCustomSeries) { e.Text += "\r\n" + o.Key + " : " + o.Value[curBar].ToString("F2"); } } } } //交易提示 //foreach (Operation o in v.Value.Operations.Where(n => n.D == dt)) for (int i = 0; i < _stra.Operations.Count; i++) { var o = _stra.Operations[i]; if (o.Date == dt) { e.Text += $"\r\n{(o.Dir == Direction.Buy ? "买" : "卖")}{(o.Offset == Offset.Open ? "开" : "平")} {o.Lots}@{o.Price:.2}"; e.Text += $"\r\n[{o.Remark}]"; } } } }
private void ResourceChart_GetToolTipText( object sender, ToolTipEventArgs e ) { if ( e.HitTestResult.ChartElementType == ChartElementType.DataPoint ) { var dp = e.HitTestResult.Series.Points[e.HitTestResult.PointIndex]; switch ( SelectedChartType ) { case ChartType.Resource: case ChartType.Material: case ChartType.Experience: e.Text = string.Format( "{0:MM\\/dd HH\\:mm}\n{1} {2:F0}", DateTime.FromOADate( dp.XValue ), e.HitTestResult.Series.LegendText, dp.YValues[0] ); break; case ChartType.ResourceDiff: case ChartType.MaterialDiff: case ChartType.ExperienceDiff: e.Text = string.Format( "{0:MM\\/dd HH\\:mm}\n{1} {2:+0;-0;±0}{3}", DateTime.FromOADate( dp.XValue ), e.HitTestResult.Series.LegendText, dp.YValues[0], Menu_Option_DivideByDay.Checked ? " / day" : "" ); break; } } }
private void chart1_GetToolTipText(object sender, ToolTipEventArgs e) { if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { int i = e.HitTestResult.PointIndex; DataPoint dp = e.HitTestResult.Series.Points[i]; e.Text = "Name: " + e.HitTestResult.Series.Name + "\nDate: " + (DateTime.FromOADate(dp.XValue).ToShortDateString() + "\nValue: " + dp.YValues[0].ToString(CultureInfo.InvariantCulture)); } }
private void StoreChart_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { GetToolTip(e, ""); }
/// <summary> /// Tooltip Event /// </summary> private void Chart1_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { // Check selevted chart element and set tooltip text switch (e.HitTestResult.ChartElementType) { case ChartElementType.Axis: e.Text = e.HitTestResult.Axis.Name; break; case ChartElementType.ScrollBarLargeDecrement: e.Text = "A scrollbar large decrement button"; break; case ChartElementType.ScrollBarLargeIncrement: e.Text = "A scrollbar large increment button"; break; case ChartElementType.ScrollBarSmallDecrement: e.Text = "A scrollbar small decrement button"; break; case ChartElementType.ScrollBarSmallIncrement: e.Text = "A scrollbar small increment button"; break; case ChartElementType.ScrollBarThumbTracker: e.Text = "A scrollbar tracking thumb"; break; case ChartElementType.ScrollBarZoomReset: e.Text = "The ZoomReset button of a scrollbar"; break; case ChartElementType.DataPoint: e.Text = "Data Point " + e.HitTestResult.PointIndex.ToString(); break; case ChartElementType.Gridlines: e.Text = "Grid Lines"; break; case ChartElementType.LegendArea: e.Text = "Legend Area"; break; case ChartElementType.LegendItem: e.Text = "Legend Item"; break; case ChartElementType.PlottingArea: e.Text = "Plotting Area"; break; case ChartElementType.StripLines: e.Text = "Strip Lines"; break; case ChartElementType.TickMarks: e.Text = "Tick Marks"; break; case ChartElementType.Title: e.Text = "Title"; break; } }
private void chartProfile_GetToolTipText(object sender, System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs e) { if ((maxProfileResults == null) || (maxProfileResults.Count == 0)) { return; } switch (e.HitTestResult.ChartElementType) { case ChartElementType.DataPoint: if ((string)toolStripComboBoxXUnit.SelectedItem == "M") { if ((string)toolStripComboBoxYUnit.SelectedItem == "M") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "KM") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 1000 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "FEET") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 0.3048 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } } else if ((string)toolStripComboBoxXUnit.SelectedItem == "KM") { if ((string)toolStripComboBoxYUnit.SelectedItem == "M") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1000 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "KM") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1000 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 1000 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "FEET") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1000 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 0.3048 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } } else if ((string)toolStripComboBoxXUnit.SelectedItem == "NM") { if ((string)toolStripComboBoxYUnit.SelectedItem == "M") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1852 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "KM") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1852 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 1000 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } else if ((string)toolStripComboBoxYUnit.SelectedItem == "FEET") { e.Text = "Distance to original point:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceFromInit / 1852 + (string)toolStripComboBoxXUnit.SelectedItem + "\n" + "Height:" + maxProfileResults[e.HitTestResult.PointIndex].Height / 0.3048 + (string)toolStripComboBoxYUnit.SelectedItem + "\n" + "Distance offset the main line:" + maxProfileResults[e.HitTestResult.PointIndex].DistanceToMainLine + "M\n" + "Latitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.y + "\n" + "Longitude:" + maxProfileResults[e.HitTestResult.PointIndex].Point.x + "\n"; } } break; } }
/// <summary> /// Zeigt den Tooltip am Cursor an. /// </summary> /// <param name="sender">der sender</param> /// <param name="e"> die event argumente</param> private void ca_Messwerte_GetToolTipText(object sender, ToolTipEventArgs e) { //Wenn Cursor in einem Datapoint: if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint) { //Bestimmte Index des DataPoint int i = e.HitTestResult.PointIndex; //Deklariere DataPoint an dem die Werte festgemacht werden. DataPoint dp = e.HitTestResult.Series.Points[i]; //Setzte Text an Mauszeiger e.Text = "X: " + (DateTime.FromOADate(dp.XValue).ToShortDateString() + " Y: " + dp.YValues[0].ToString()); } }