private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1) { for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1[1, i].Value == null || dataGridView1[1, i].Value.ToString() == ".") { dataGridView1[1, i].Value = 0; } } } if (e.ColumnIndex == 2) { for (int i = 0; i < dataGridView1.RowCount; i++) { if (dataGridView1[2, i].Value == null || dataGridView1[2, i].Value.ToString() == ".") { dataGridView1[2, i].Value = 0; } } } // plotDefenceDiagram.Dispose(); plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainer2.Panel2.Controls.Add(plotDefenceDiagram); MakeGraphic(); }
public CycleUC() { InitializeComponent(); plotCycle = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.panel1.Controls.Add(plotCycle); plotCycle.Model.PlotType = PlotType.XY; //Axis plotCycle.Model.Axes.Add(xAxis); plotCycle.Model.Axes.Add(yAxis); // for (int i = 0; i < checkedListBoxGraphic.Items.Count; i++) { checkedListBoxGraphic.SetItemChecked(i, true); } _mineConfig = IoC.Resolve <MineConfig>(); _wasOstanov = 0; plotCycle.Model.Series.Add(s1); plotCycle.Model.Series.Add(s2); plotCycle.Model.Series.Add(s3); plotCycle.Model.Series.Add(s4); new Thread(RefreshThreadHandler) { IsBackground = true, Priority = ThreadPriority.Lowest }.Start(); }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { for (int i = 0; i < dataGridViewVariableParameters.RowCount; i++) { variableParametersName[i] = dataGridViewVariableParameters[1, i].Value.ToString(); variableParametersValue[i] = Convert.ToDouble(dataGridViewVariableParameters[2, i].Value, CultureInfo.GetCultureInfo("en-US")).ToString(CultureInfo.GetCultureInfo("en-US")); } int index = tabControl1.SelectedIndex; switch (index) { case 0: break; case 1: UpdateDiagramData(); break; case 2: _plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainerDefenceDiagram.Panel2.Controls.Add(_plotDefenceDiagram); MakeSolvedDiagramGraphic(); break; case 3: MakeGraphic(); break; } }
private void CodtDomainComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (plotDefenceDiagram != null) { plotDefenceDiagram.Dispose(); } plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainerCodtDomain.Panel2.Controls.Add(plotDefenceDiagram); MakeGraphic(); }
private void DefenceDiagramComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (_plotDefenceDiagram != null) { _plotDefenceDiagram.Dispose(); } _plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainerDefenceDiagram.Panel2.Controls.Clear(); this.splitContainerDefenceDiagram.Panel2.Controls.Add(_plotDefenceDiagram); MakeSolvedDiagramGraphic(); }
public FormCodtDomainSettings(int index, List <ParametersSettingsData> parametersSettings) { InitializeComponent(); _parametersSettings = parametersSettings; this.Text = "0x" + Convert.ToString(index, 16) + " " + parametersSettings[index - startIndex].Name; _index = index; LoadDataFromList(parametersSettings[index - startIndex].CodtDomainArray); plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainer2.Panel2.Controls.Add(plotDefenceDiagram); MakeGraphic(); _solvedHz = new List <List <string> >(); _solvedV = new List <List <string> >(); _diagramName = new List <string>(); InitSlovedHzAndVLists(); }
private void toolStripButtonLoadSolvedDefDiagram_Click(object sender, EventArgs e) { ReadSolvedDiagramFromFile(SolvedDefDiagramPointsFilePath); var formChooseDefenceDiagram = new FormChooseDefenceDiagramSettings(_diagramName) { StartPosition = FormStartPosition.CenterParent }; formChooseDefenceDiagram.ShowDialog(); if (formChooseDefenceDiagram.SelectedIndex >= 0) { WriteSolvedDiagramToTable(formChooseDefenceDiagram.SelectedIndex); plotDefenceDiagram.Dispose(); plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.splitContainer2.Panel2.Controls.Add(plotDefenceDiagram); MakeGraphic(); } formChooseDefenceDiagram.Dispose(); }
private void MakeGraphic() { var defenceDiagramSettingsVm = new DefenceDiagramSettingsVm(variableParametersValue); if (defenceDiagramSettingsVm.HzCrossHkDown == 1 || defenceDiagramSettingsVm.HzCrossHkUp == 1) { MessageBox.Show("Защитная диаграмма пересекается с критической!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } else { var plotDefenceDiagram = new OxyPlot.WindowsForms.Plot { Model = new PlotModel(), Dock = DockStyle.Fill }; this.tabControl1.TabPages[3].Controls.Clear(); this.tabControl1.TabPages[3].Controls.Add(plotDefenceDiagram); //Legend plotDefenceDiagram.Model.PlotType = PlotType.XY; //plotDefenceDiagram.Model.LegendTitle = "Legend"; plotDefenceDiagram.Model.LegendOrientation = LegendOrientation.Horizontal; plotDefenceDiagram.Model.LegendPlacement = LegendPlacement.Outside; plotDefenceDiagram.Model.LegendPosition = LegendPosition.TopRight; plotDefenceDiagram.Model.LegendBackground = OxyColor.FromAColor(200, OxyColors.White); plotDefenceDiagram.Model.LegendBorder = OxyColors.Gray; //Axis var xAxis = new LinearAxis(AxisPosition.Bottom, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Путь (м)", Minimum = -_mineConfig.MainViewConfig.Border.Value, Maximum = -_mineConfig.MainViewConfig.BorderZero.Value }; plotDefenceDiagram.Model.Axes.Add(xAxis); var yAxis = new LinearAxis(AxisPosition.Left, 0) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Title = "Скорость (м/с)", Minimum = 0, Maximum = 1.2 * Convert.ToDouble(variableParametersValue[0], CultureInfo.GetCultureInfo("en-US")) }; plotDefenceDiagram.Model.Axes.Add(yAxis); // Create Line series var s1 = new LineSeries { Title = "Груз", StrokeThickness = 1, Color = OxyColors.Blue }; var s2 = new LineSeries { Title = "Люди", StrokeThickness = 1, Color = OxyColors.Green }; var s3 = new LineSeries { Title = "Оборудование", StrokeThickness = 1, Color = OxyColors.Red }; var s4 = new LineSeries { Title = "Ревизия", StrokeThickness = 1, Color = OxyColors.Orange }; for (int i = 0; i < defenceDiagramSettingsVm.DiagramVeight.Count(); i++) { s1.Points.Add(new DataPoint(-defenceDiagramSettingsVm.DiagramVeight[i].X, defenceDiagramSettingsVm.DiagramVeight[i].Y)); s2.Points.Add(new DataPoint(-defenceDiagramSettingsVm.DiagramPeople[i].X, defenceDiagramSettingsVm.DiagramPeople[i].Y)); s3.Points.Add(new DataPoint(-defenceDiagramSettingsVm.DiagramEquipment[i].X, defenceDiagramSettingsVm.DiagramEquipment[i].Y)); } for (int i = 0; i < defenceDiagramSettingsVm.DiagramRevision.Count(); i++) { s4.Points.Add(new DataPoint(-defenceDiagramSettingsVm.DiagramRevision[i].X, defenceDiagramSettingsVm.DiagramRevision[i].Y)); } // add Series and Axis to plot model plotDefenceDiagram.Model.Series.Add(s1); plotDefenceDiagram.Model.Series.Add(s2); plotDefenceDiagram.Model.Series.Add(s3); plotDefenceDiagram.Model.Series.Add(s4); } }