| | |
| | | using DevExpress.Utils; |
| | | using DevExpress.Mvvm.POCO; |
| | | using DevExpress.Utils; |
| | | using DevExpress.XtraCharts; |
| | | using DevExpress.XtraGrid.Columns; |
| | | using DevExpress.XtraGrid.Views.Grid; |
| | |
| | | |
| | | private AxisX _axis_x_flow; |
| | | private AxisY _axis_y_head; |
| | | //private SecondaryAxisY _axis_y_eff; |
| | | private SecondaryAxisY _axis_y_eff; |
| | | |
| | | |
| | | #endregion |
| | |
| | | _diagram.EnableAxisYZooming = true; |
| | | _default_pane = _diagram.DefaultPane; |
| | | |
| | | _diagram.AxisX.TimeSpanScaleOptions.MeasureUnit = TimeSpanMeasureUnit.Minute; |
| | | _diagram.AxisX.TimeSpanScaleOptions.ScaleMode = ScaleMode.Continuous; |
| | | _diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Second; |
| | | _diagram.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Continuous; |
| | | |
| | | _axis_x_flow = _diagram.AxisX; |
| | | _axis_y_head = _diagram.AxisY; |
| | | //_axis_y_eff = _diagram.SecondaryAxesY.GetAxisByName("AxisYEff"); |
| | | //_axis_y_eff.Alignment = AxisAlignment.Far; |
| | | _axis_y_eff = _diagram.SecondaryAxesY.GetAxisByName("AxisYEff"); |
| | | _axis_y_eff.Alignment = AxisAlignment.Far; |
| | | |
| | | |
| | | _axis_x_flow.GridLines.Visible = false; |
| | | _axis_y_head.GridLines.Visible = false; |
| | | //_axis_y_eff.GridLines.Visible = false; |
| | | _axis_y_eff.GridLines.Visible = false; |
| | | |
| | | this.chartControl1.CrosshairEnabled = DefaultBoolean.True; |
| | | |
| | |
| | | |
| | | foreach (var vm in vm_list) |
| | | { |
| | | //if (!vm.Name.Contains("压力")) |
| | | //{ |
| | | axis_x = _axis_x_flow; |
| | | axis_y = _axis_y_head; |
| | | pane = _default_pane; |
| | | //} |
| | | //else |
| | | //{ |
| | | // axis_x = _axis_x_flow; |
| | | // axis_y = _axis_y_eff; |
| | | // pane = _default_pane; |
| | | if (!vm.Name.Contains("压力")) |
| | | { |
| | | axis_x = _axis_x_flow; |
| | | axis_y = _axis_y_head; |
| | | pane = _default_pane; |
| | | } |
| | | else |
| | | { |
| | | axis_x = _axis_x_flow; |
| | | axis_y = _axis_y_eff; |
| | | pane = _default_pane; |
| | | |
| | | //} |
| | | |
| | | } |
| | | var col = new GridColumn(); |
| | | col.FieldName = vm.Name; |
| | | col.Caption = vm.Name; |
| | |
| | | AddLineSeries(vm.Name, axis_x, axis_y, pane, vm.Datas); |
| | | } |
| | | |
| | | var min_x = vm_list.SelectMany(x => x.Datas).Min(x => TimeSpan.Parse(x.Time)); |
| | | var max_x = vm_list.SelectMany(x => x.Datas).Max(x => TimeSpan.Parse(x.Time)); |
| | | var tempdatas = vm_list[0]; |
| | | foreach (var item in tempdatas.Datas) |
| | | { |
| | | item.Y = Press; |
| | | } |
| | | |
| | | AddLineSeries("原泵后压力", axis_x, _axis_y_eff, _default_pane, tempdatas.Datas); |
| | | |
| | | var min_x = vm_list.SelectMany(x => x.Datas).Min(x => DateTime.Parse(x.Time)); |
| | | var max_x = vm_list.SelectMany(x => x.Datas).Max(x => DateTime.Parse(x.Time)); |
| | | |
| | | |
| | | _axis_x_flow.NumericScaleOptions.AutoGrid = false; |
| | |
| | | _axis_x_flow.WholeRange.SetMinMaxValues(min_x, max_x); |
| | | _axis_x_flow.VisualRange.SetMinMaxValues(min_x, max_x); |
| | | |
| | | var diff_days = max_x - min_x; |
| | | textEdit1.Text = diff_days.TotalDays.ToString(); |
| | | gridControl1.DataSource = dataTable; |
| | | |
| | | this.chartControl1.EndInit(); |
| | | |
| | | } |
| | |
| | | view.Pane = pane; |
| | | |
| | | |
| | | var series_pt_list = pt_list.Select(x => new SeriesPoint(TimeSpan.Parse(x.Time), x.Y)).ToArray(); |
| | | var series_pt_list = pt_list.Select(x => new SeriesPoint(DateTime.Parse(x.Time), x.Y)).ToArray(); |
| | | var series = new DevExpress.XtraCharts.Series(); |
| | | series.Tag = id; |
| | | //series.ShowInLegend = false; |
| | | series.Name = id; |
| | | series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.TimeSpan; |
| | | series.TimeSpanSummaryOptions.MeasureUnit = TimeSpanMeasureUnit.Minute; |
| | | series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.DateTime; |
| | | series.DateTimeSummaryOptions.MeasureUnit = DateTimeMeasureUnit.Second; |
| | | |
| | | series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.False; |
| | | series.CrosshairEnabled = DefaultBoolean.True; |
| | | series.CrosshairLabelPattern = id + ":{V:N2}"; |
| | | series.CrosshairLabelPattern = id + ":{V:N2} {A:yyyy-MM-dd HH:mm:ss}"; |
| | | series.ToolTipEnabled = DefaultBoolean.False; |
| | | series.SeriesPointsSorting = SortingMode.None; |
| | | series.Visible = true; |
| | |
| | | { |
| | | datalist = new List<FlowPressChartViewModel>(); |
| | | dataTable = new DataTable(); |
| | | |
| | | if (!File.Exists(fileName)) |
| | | return "文件不存在"; |
| | | int line = 0; |
| | |
| | | { |
| | | |
| | | row_temp = sheet1.GetRow(line); |
| | | if (row_temp == null || row_temp.Cells.Count < 3) |
| | | if (row_temp == null) |
| | | break; |
| | | var rowData = new object[totalcell]; |
| | | for (int i = 0; i < totalcell; i++) |
| | | { |
| | | try |
| | | { |
| | | var cell_temp = row_temp.GetCell(i); |
| | | |
| | | if (i > 0) |
| | | { |
| | | if (cell_temp != null && cell_temp.CellType != NPOI.SS.UserModel.CellType.Blank) |
| | | var cell_temp = row_temp.GetCell(i); |
| | | double yvalue = cell_temp.NumericCellValue; |
| | | var timevalue = row_temp.GetCell(0).StringCellValue; |
| | | datalist[i - 1].Datas.Add(new TimeChartViewModel() |
| | | { |
| | | double yvalue = cell_temp.NumericCellValue; |
| | | var timevalue = row_temp.GetCell(0).NumericCellValue; |
| | | //double.TryParse(cell_temp.StringCellValue,out yvalue); |
| | | datalist[i - 1].Datas.Add(new TimeChartViewModel() |
| | | { |
| | | Time = DateTime.FromOADate(timevalue).ToString("HH:mm:ss"), |
| | | Y = yvalue, |
| | | }); |
| | | rowData[i] = yvalue; |
| | | } |
| | | Time = timevalue, //DateTime.FromOADate(timevalue).ToString("YYYY-MM-dd HH:mm:ss"), |
| | | Y = yvalue, |
| | | }); |
| | | rowData[i] = yvalue; |
| | | } |
| | | else |
| | | { |
| | | var timevalue = row_temp.GetCell(0).NumericCellValue; |
| | | rowData[i] = DateTime.FromOADate(timevalue).ToString("HH:mm:ss"); |
| | | var timevalue = row_temp.GetCell(0).StringCellValue; |
| | | rowData[i] = timevalue;//DateTime.FromOADate(timevalue).ToString("YYYY-MM-dd HH:mm:ss"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var a = ex.Message; |
| | | //var a = ex.Message; |
| | | } |
| | | } |
| | | |
| | | dataTable.Rows.Add(rowData); |
| | | } |
| | | |
| | | //Yw.Pump.CalculationHelper.CalcuP(); |
| | | |
| | | return ""; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | double Press = 0.6; |
| | | private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) |
| | | { |
| | | var dlg = new SetPressForm(); |
| | | if (dlg.ShowDialog() == DialogResult.OK) |
| | | { |
| | | var press= dlg.Press; |
| | | Press = dlg.Press; |
| | | } |
| | | } |
| | | } |