/// <summary> /// Обработчик события нажатия на кнопку "Нарисовать график" /// </summary> private void createGraphToolStripMenuItem_Click(object sender, EventArgs e) { saveData(); GraphForm GF = new GraphForm(mined, lnWor, Сalc.findApproximatedStraight(lnWor, mined)); GF.Show(); }
/// <summary> /// Вычисляет шаг сетки графика /// </summary> public void stepGraph(double[] xArray, double[] yArray) { System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); chartArea1.AxisX.Interval = Math.Round(Сalc.avg(yArray), 3) / 100; chartArea1.AxisX.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount; chartArea1.AxisX2.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount; chartArea1.AxisY.Interval = Math.Round(Сalc.avg(yArray), 3) / 7; chartArea1.AxisY.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount; chartArea1.AxisY2.IntervalAutoMode = System.Windows.Forms.DataVisualization.Charting.IntervalAutoMode.VariableCount; chartArea1.Name = "ChartArea1"; chart.ChartAreas.Clear(); chart.ChartAreas.Add(chartArea1); }
/// <summary> /// Обрабатывает событие нажатия на кнопку "Рассчитать" /// </summary> private void calculateToolStripMenuItem_Click(object sender, EventArgs e) { if (dataGridView.Rows.Count - 1 >= 3) { if (inputData()) { avgActual = Сalc.avgProd(actual); lnWor = Сalc.lnWor(avgActual); mined = Сalc.mined(cumulativeProd, irr); incline = Сalc.incline(lnWor, mined); line = Сalc.line(lnWor, mined, incline); outputData(); createGraphToolStripMenuItem.Visible = true; } } else { MessageBox.Show("Длинна массива данных должна быть не меньше трёх.", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }