private void comboBoxEdit2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxEdit1.SelectedIndex >= 0 && comboBoxEdit2.SelectedIndex >= 0) { HHDeviceProperty prop = comboBoxEdit1.SelectedItem as HHDeviceProperty; HHDevice dev = comboBoxEdit2.SelectedItem as HHDevice; HHDeviceProperty devProp = dev.GetProperty(prop); List <DevCurve> curves = devProp.Curves; List <DateTime> listTime = DataStorage.DatabaseModule.GetInstance().QueryCurveTimeList(curves[0].Group.Type, curves[0].Index); comboBoxEdit3.Properties.Items.Clear(); comboBoxEdit3.Text = ""; for (int i = 0; i < listTime.Count; i++) { comboBoxEdit3.Properties.Items.Add(listTime[i]); } if (comboBoxEdit3.Properties.Items.Count > 0) { comboBoxEdit3.SelectedIndex = 0; } else { DrawCurve(); } } }
private void comboBoxEdit2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxEdit1.SelectedIndex >= 0 && comboBoxEdit2.SelectedIndex >= 0) { selectDev = comboBoxEdit2.SelectedItem as HHDevice; DrawCurve(); } }
private void wizardPage1_PageCommit(object sender, EventArgs e) { wizardPage2.AllowBack = false; wizardPage2.AllowNext = false; selectDevice = comboBoxEdit2.SelectedItem as HHDevice; if (selectDevice != null) { Thread threadExport = new Thread(new ThreadStart(ExportProc)); threadExport.IsBackground = true; threadExport.Start(); timer1.Start(); } }
private void DrawCurve() { HHDevice device = comboBoxEdit2.SelectedItem as HHDevice; HHDeviceProperty devProp = comboBoxEdit1.SelectedItem as HHDeviceProperty; DateTime timeSel = DateTime.Now; if (comboBoxEdit3.SelectedIndex >= 0) { timeSel = (DateTime)comboBoxEdit3.SelectedItem; } HHDeviceProperty devBindProp = device.GetProperty(devProp); List <DevCurve> curves = devBindProp.Curves; UltraChart.CurveGroup grp = chart.GroupList[0]; grp.ClearChartObject(); LineArea area = new LineArea(chart, "道岔曲线", true); area.IsShowFoldFlag = false; area.IsFold = false; area.YAxes.Mode = YAxesMode.Manual; area.YAxes.YAxesMin = curves[0].ADMin; area.YAxes.YAxesMax = curves[0].ADMax; area.YAxes.Precision = 3; area.YAxes.UnitString = ""; grp.AddChartObject(area); grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeSel), 0); chart.AutoSetXScale(); List <StationCurve> listCurve = DataStorage.DatabaseModule.GetInstance().QueryCurveHistory(curves[0].Group.Type, curves[0].Index, timeSel); string[][] curveNames = new string[][] { new string[] { "曲线" }, new string[] { "曲线1", "曲线2" }, new string[] { "A相", "B相", "C相" }, }; for (int i = 0; i < curves.Count; i++) { LineCurve line = new LineCurve(chart, curveNames[curves.Count - 1][i], 0); line.LineColor = ColorList[i % ColorList.Length]; area.AddLine(line); if (listCurve != null && listCurve.Count > 0 && listCurve[i] != null) { for (int j = 0; j < listCurve[i].Points.Length; j++) { DateTime time = timeSel.AddMilliseconds(curves[i].TimeInterval * j); //40毫秒 LinePoint point = new LinePoint(); point.Value = listCurve[i].Points[j]; point.Time = ChartGraph.DateTime2ChartTime(time); line.AddPoint(point); } } } chart.AutoSetXScale(); chart.Draw(); }