/// <summary> /// 更新当前测试项目和对数 /// </summary> /// <param name="itemName"></param> /// <param name="clbType"></param> private void SetCheckItem(string itemName, ClbType clbType) { CheckedListBox targetCheckedListBox = new CheckedListBox(); switch (clbType) { case ClbType.TestItem: targetCheckedListBox = chkList_TestItem; break; case ClbType.DiffPair: targetCheckedListBox = chkList_LossPair; break; case ClbType.NextPair: targetCheckedListBox = chkList_NextPair; break; case ClbType.FextPair: targetCheckedListBox = chkList_FextPair; break; } if (targetCheckedListBox.InvokeRequired) { Action <string, ClbType> d = SetCheckItem; this.Invoke(d, new object[] { itemName, clbType }); } else { int index = targetCheckedListBox.FindString(itemName); targetCheckedListBox.SelectedIndex = index; targetCheckedListBox.SetItemChecked(index, true); Extende.SelectTab(targetCheckedListBox); } }
private void chkList_TestItem_SelectedIndexChanged(object sender, EventArgs e) { if (chkList_TestItem.SelectedItem == null) { return; } Extende.SelectTab(tabControlChart, chkList_TestItem.SelectedItem.ToString()); }
public override void DrawLine(object oChart, plotData temp, string seriName, LineType lineType) { Chart chart = (Chart)oChart; if (chart.InvokeRequired) { SetDrawLineCallBack d = DrawLine; chart.Invoke(d, new object[] { chart, temp, seriName, lineType }); } else { //绑定数据 int index = chart.Series.Count; chart.Series.Add(seriName); Series currentSeries = chart.Series[index]; currentSeries.SetCustomProperty("CHECK", "☑"); //chart.Titles[index].Alignment = System.Drawing.ContentAlignment.TopRight; currentSeries.XValueType = ChartValueType.Single; //设置X轴上的值类型 //currentSeries.Label = "#VAL"; //设置显示X Y的值 //currentSeries.LabelForeColor = Color.Black; // currentSeries.ToolTip = "#VALX:#VAL"; //鼠标移动到对应点显示数值 currentSeries.ToolTip = string.Format("X - {0}/{2} , Y - {1}", "#VALX", "#VALY{F2}", 1000); //鼠标移动到对应点显示数值 currentSeries.ChartType = SeriesChartType.FastLine; //图类型(折线) //currentSeries.ChartType = SeriesChartType.Line; //图类型(折线) currentSeries.IsValueShownAsLabel = false; currentSeries.LegendText = seriName; currentSeries.IsVisibleInLegend = true; currentSeries.BorderWidth = 1; //chart.Legends[seriName].Enabled = true; //chart.Legends[seriName].MaximumAutoSize = 15; //chart.Series[0].IsValueShownAsLabel = true; // currentSeries.LabelForeColor = Color.Black; // currentSeries.CustomProperties = "DrawingStyle = Cylinder"; if (lineType == LineType.Spec) { plotData trimPlotData = TrimNaN(temp); currentSeries.Points.DataBindXY(trimPlotData.xData, trimPlotData.yData); } else { currentSeries.Points.DataBindXY(temp.xData, temp.yData); } //currentSeries.Points.AddXY(temp.xData, temp.yData); //CalloutAnnotation annotation = new CalloutAnnotation(); //annotation.Text = seriName + ":" + temp.yData[0]; //chart.Annotations.Add(annotation); //int anCount = chart.Annotations.Count; //var aa = currentSeries.Points; //chart.Annotations[anCount-1].AnchorDataPoint = currentSeries.Points[0]; switch (lineType) { case LineType.Fre: for (int i = 1; i < 10; i++) { CustomLabel label = new CustomLabel(); label.Text = (i * 5).ToString() + "Ghz"; label.ToPosition = i * 10000000000; chart.ChartAreas[0].AxisX.CustomLabels.Add(label); label.GridTicks = GridTickTypes.TickMark; } break; case LineType.Time: for (int i = 1; i < 10; i++) { CustomLabel label = new CustomLabel(); label.Text = (i * 1).ToString() + "ns"; label.ToPosition = (float)i * 2; chart.ChartAreas[0].AxisX.CustomLabels.Add(label); label.GridTicks = GridTickTypes.TickMark; } break; case LineType.Spec: currentSeries.Color = Color.Red; currentSeries.BorderWidth = 2; break; } Extende.SelectTab(chart); //chart.Visible = true; } }