private void button10_Click(object sender, EventArgs e) { int order = (int)numericUpDown3.Value; if (radioButton1.Checked) { var invert = _waveletWorker.LowPassFilterDaubechies(signal .Select(p => p.Y) .ToArray(), order); var invertData = invert.Select((d, i) => new Tuple <double, double>(signal[i].X, d)); ChartForm invertChart = new ChartForm(invertData, "", "", "Daubechies's transform (invert)", "order: " + order.ToString()); invertChart.Show(); SaveWav(@"D:\stud_repo\astu\DS\FourierTransform\FourierTransform\wav\" + "daub_lp_order_" + order.ToString() + ".wav" , invert.Select(d => (int)d).ToArray()); return; } if (radioButton2.Checked) { var invert = _waveletWorker.HighPassFilterDaubechies(signal .Select(p => p.Y) .ToArray(), order); var invertData = invert.Select((d, i) => new Tuple <double, double>(signal[i].X, d)); ChartForm invertChart = new ChartForm(invertData, "", "", "Daubechies's transform (invert)", "order: " + order.ToString()); invertChart.Show(); SaveWav(@"D:\stud_repo\astu\DS\FourierTransform\FourierTransform\wav\" + "daub_hp_order_" + order.ToString() + ".wav" , invert.Select(d => (int)d).ToArray()); return; } }
private void averageRewScoreDiffToolStripMenuItem_Click(object sender, EventArgs e) { var paths = lstSelectedLogs.Items.Cast <PathListItem>().ToArray(); if (paths.Length <= 0) { return; } double[][] avgRewards = new double[paths.Length][]; double[][] scoreDiffs = new double[paths.Length][]; string[] names = new string[paths.Length]; for (int i = 0; i < paths.Length; i++) { var pathItem = paths[i]; string path = pathItem.PathString; double[] curAvgRews, curScoreDiffs; ReadColumnsAvgRewAndScoreDiff(path, out curAvgRews, out curScoreDiffs); names[i] = Path.GetFileNameWithoutExtension(path); avgRewards[i] = curAvgRews; scoreDiffs[i] = curScoreDiffs; } string xTitle = "Cycles"; if (m_plotEvery > 1) { xTitle += " * " + m_plotEvery.ToString(); } ChartForm.ShowChartForm(names, avgRewards, "Average Rewards", xTitle, "Average Rewards", "Average Rewards"); ChartForm.ShowChartForm(names, scoreDiffs, "Score Difference", xTitle, "Score Difference", "Score Difference"); }
private void NoteDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { // if the click occurred on a data grid view row (not on the header) and on the delete chart note column if (e.RowIndex >= 0 && e.ColumnIndex == ChartNoteDeleteColumn.Index) { DataGridViewRow clickedRow = NoteDataGridView.Rows[e.RowIndex]; // assemble arguments to pass to remove note method Note n = clickedRow.DataBoundItem as Note; double xCoordinate = Convert.ToDouble(clickedRow.Cells[ChartNoteXColumn.Name].Value); double yCoordinate = Convert.ToDouble(clickedRow.Cells[ChartNoteYColumn.Name].Value); // remove vertical line from metadata and remove grid view row Metadata.RemoveChartNote(xCoordinate, n.XCoordinate.AxisTitle, yCoordinate, n.YCoordinate.AxisTitle, n.MarkColor, n.NoteText); NoteDataGridView.Rows.Remove(clickedRow); ChartForm.ChartMetadataSaveRequired(Metadata); // set the current cell to the cell in the first column of the first visible row int firstVisibleRowIndex = NoteDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Visible); if (firstVisibleRowIndex != -1) { NoteDataGridView.CurrentCell = NoteDataGridView[0, firstVisibleRowIndex]; } } }
private void HorizontalLinesDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { // if the click occurred on a data grid view row (not on the header) and on the delete horizontal marker column if (e.RowIndex >= 0 && e.ColumnIndex == ChartHorizontalLinesDeleteColumn.Index) { DataGridViewRow clickedRow = HorizontalLinesDataGridView.Rows[e.RowIndex]; // assemble arguments to pass to remove horizontal line method Line l = clickedRow.DataBoundItem as Line; double yCoordinate = Convert.ToDouble(clickedRow.Cells[ChartHorizontalLinesYColumn.Name].Value); // remove horizontal line from metadata and remove grid view row Metadata.RemoveHorizontalLine(yCoordinate, l.Coordinate.AxisTitle); HorizontalLinesDataGridView.Rows.Remove(clickedRow); ChartForm.ChartMetadataSaveRequired(Metadata); // set the current cell to the cell in the first column of the first visible row int firstVisibleRowIndex = HorizontalLinesDataGridView.Rows.GetFirstRow(DataGridViewElementStates.Visible); if (firstVisibleRowIndex != -1) { HorizontalLinesDataGridView.CurrentCell = HorizontalLinesDataGridView[0, firstVisibleRowIndex]; } } }
static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); string configurationJsonFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Pathfinder.json"); ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddJsonFile(configurationJsonFilePath, false, false); var configuration = configurationBuilder.Build(); var networks = configuration.GetSection("Networks").Get <TrainingNetworkSettings[]>(); var data = configuration.GetSection("Data").Get <TrainingDataSettings[]>(); var trainings = configuration.GetSection("Trainings").Get <TrainingSettings[]>(); var sets = configuration.GetSection("Sets").Get <int[][]>(); var trainingSets = sets.Select(set => new TrainingSet(string.Join("", set), trainings[set[2]], data[set[1]], networks[set[0]])); var trainingResults = Training.Train(trainingSets); ChartForm chartForm = new ChartForm(); chartForm.Add(trainingResults); chartForm.ShowDialog(); var best = trainingResults.OrderBy(r => r.Result.Errors.Last()).First(); Form1 form = new Form1(); form.Network = best.Result.Network; form.Graphs = best.Result.TrainingGraphs; Application.Run(form); }
private void button10_Click(object sender, EventArgs e) { int order = (int)numericUpDown3.Value; if (radioButton1.Checked) { var invert = _waveletWorker.LowPassFilterDaubechies(_transformedSource .Take(1 << FindMaxPower(_transformedSource.Count)) .Select(p => p.Y) .ToArray(), order); var invertData = invert.Select((d, i) => new Tuple <double, double>(_transformedSource[i].X, d)); ChartForm invertChart = new ChartForm(invertData, "", "", "Daubechies's transform (invert)", "order: " + order.ToString()); invertChart.Show(); return; } if (radioButton2.Checked) { var invert = _waveletWorker.HighPassFilterDaubechies(_transformedSource .Take(1 << FindMaxPower(_transformedSource.Count)) .Select(p => p.Y) .ToArray(), order); var invertData = invert.Select((d, i) => new Tuple <double, double>(_transformedSource[i].X, d)); ChartForm invertChart = new ChartForm(invertData, "", "", "Daubechies's transform (invert)", "order: " + order.ToString()); invertChart.Show(); return; } }
/// <summary> /// добавить на график отрезок или звездочку, согласно размышлениям робота /// </summary> private void AddOrRemoveRobotHintOnChart(RobotMark hint, ChartForm chart) { // добавить комментарий на график? if (hint is RobotHint) { AddRobotHintOnChart((RobotHint)hint, chart); return; } // убрать комментарий с графика? var markClear = (RobotMarkClear)hint; if (hint.RobotHintType == RobotMark.HintType.Линия) { var linesToRemove = chart.chart.seriesTrendLine.data.Where(l => l.Name == markClear.HintCode).ToList(); foreach (var line in linesToRemove) { chart.chart.seriesTrendLine.RemoveObjectFromList(line); } } else { var asteriskToRemove = chart.chart.seriesAsteriks.data.Where(l => l.Name == markClear.HintCode).ToList(); foreach (var asteriks in asteriskToRemove) { chart.chart.seriesAsteriks.RemoveObjectFromList(asteriks); } } }
internal void DockPanel_ActiveDocumentChanged(object sender, EventArgs e) { if (this.mainForm.MainFormClosingSkipChartFormsRemoval) { string msg = "onAppClose getting invoked for each [mosaically] visible document, right? nope just once per Close()"; return; } //DONT_FORGET_TO_RENAME_CHART2_TO_CHART_WHEN_REPLACING_SQ1.WIDGETS.CHARTING_<_SQ1.CHARTING ChartForm chartFormClicked = this.mainForm.DockPanel.ActiveDocument as ChartForm; if (chartFormClicked == null) { this.mainForm.GuiDataSnapshot.ChartSernoHasFocus = -1; string msg = "focus might have moved away from a document to Docked Panel" + "; I'm here after having focused on ExceptionsForm docked into Documents pane"; return; } //if (chartFormClicked.IsActivated == false) return; //NOUP ActiveDocumentChanged is invoked twice: 1) for a form loosing control, 2) for a form gaining control try { chartFormClicked.ChartFormManager.EventManager.MainForm_ActivatedDocumentPane_WithChart(sender, e); this.mainForm.GuiDataSnapshot.ChartSernoHasFocus = chartFormClicked.ChartFormManager.DataSnapshot.ChartSerno; this.mainForm.GuiDataSnapshotSerializer.Serialize(); } catch (Exception ex) { this.mainForm.PopupException(ex); } }
internal void ChartForm_FormClosed(object sender, FormClosedEventArgs e) { if (this.mainForm.MainFormClosingSkipChartFormsRemoval) { return; } try { ChartForm chartFormClosed = sender as ChartForm; ChartFormManager chartFormManager = chartFormClosed.ChartFormManager; // chartFormsManager lifecycle ends here this.mainForm.GuiDataSnapshot.ChartFormManagers.Remove(chartFormManager.DataSnapshot.ChartSerno); if (chartFormManager.EditorFormIsNotDisposed == false) { chartFormManager.ScriptEditorFormConditionalInstance.Close(); } //foreach (Reporter reporter in chartFormsManager.Reporters.Values) { // Control reporterAsControl = reporter as Control; // Control reporterParent = reporterAsControl.Parent; // DockContent reporterParentForm = reporterParent as DockContent; // if (chartFormsManager.FormIsNullOrDisposed(reporterParentForm)) reporterParentForm.Close(); //} if (StrategiesForm.Instance.IsActivated == false) { StrategiesForm.Instance.Activate(); } } catch (Exception ex) { string msg = "ChartFormsManagers.Remove() didn't go trought? duplicates"; } }
private void Lb_DoubleClick(object sender, EventArgs e) { Field field = (Field)((sender as Label).Tag); ChartForm cf = new ChartForm(); field.ChartPanel.Parent = cf; cf.ShowDialog(); }
private void BtnColumnChartWindowClick(object sender, EventArgs e) { var vals1 = new[] { 1, 3, 5, 2, 7 }; var vals2 = new[] { 7, 5, 3, 2, 1 }; var labels = new [] { "year 1", "year 2", "year 3", "year 4", "year 5" }; ChartForm.ShowColumnChartForm(new[] { "Company 1", "Company 2" }, labels, new[] { vals1, vals2 }, "Performance of Companies", "year", "income in billion dollars", "Column Chart Window Demo"); }
private void button3_Click(object sender, EventArgs e) { var cheb2_5 = CalculateCheb2Directly(5, 0.1); var cheb2_8 = CalculateCheb2Directly(8, 0.1); var cheb2_83 = CalculateCheb2Directly(8, 0.3); ChartForm chart = new ChartForm(cheb2_5, "w", "", "Chebyshev-2 (direct calculation)", "N=5, E=0.1"); chart.AddSeriresData(cheb2_8, "N=8, E=0.1"); chart.AddSeriresData(cheb2_83, "N=8, E=0.3"); chart.Show(); }
private void button1_Click(object sender, EventArgs e) { var batt5 = CalculateBatterworthAFCDirectly(5); var batt8 = CalculateBatterworthAFCDirectly(8); var batt11 = CalculateBatterworthAFCDirectly(11); ChartForm battChart = new ChartForm(batt5, "w", "", "Batterworth (direct calculation)", "N=5"); battChart.AddSeriresData(batt8, "N=8"); battChart.AddSeriresData(batt11, "N=11"); battChart.Show(); }
private void AddRobotHintOnChart(RobotHint hint, ChartForm chart) { // добавить отрезочек с комментарием if (hint.RobotHintType == RobotMark.HintType.Линия) { AddRobotHintLineOnChart(hint, chart); return; } // добавить звездочку var toolTip = new AsteriskTooltip(hint.Title, hint.Text) { Owner = chart.chart.seriesAsteriks, Price = hint.Price.Value, CandleIndex = chart.chart.chart.StockSeries.GetIndexByCandleOpen( hint.Time.Value), DateStart = hint.Time.Value, Sign = hint.Sign, Radius = 5, Shape = hint.RobotHintType == RobotMark.HintType.Стоп ? AsteriskTooltip.ShapeType.Квадрат : hint.RobotHintType == RobotMark.HintType.Тейк ? AsteriskTooltip.ShapeType.Квадрат : hint.RobotHintType == RobotMark.HintType.Покупка ? AsteriskTooltip.ShapeType.СтрелкаВверх : hint.RobotHintType == RobotMark.HintType.Продажа ? AsteriskTooltip.ShapeType.СтрелкаВниз : hint.RobotHintType == RobotMark.HintType.Поджатие ? AsteriskTooltip.ShapeType.Звезда : AsteriskTooltip.ShapeType.Круг }; if (!string.IsNullOrEmpty(hint.HintCode)) { toolTip.Name = hint.HintCode; } if (hint.ColorFill.HasValue) { toolTip.ColorFill = hint.ColorFill.Value; } if (hint.ColorLine.HasValue) { toolTip.ColorLine = hint.ColorLine.Value; } if (hint.ColorText.HasValue) { toolTip.ColorText = hint.ColorText.Value; } chart.chart.seriesAsteriks.data.Add(toolTip); }
public void StrategiesTree_OnStrategySelected(object sender, StrategyEventArgs e) { ChartForm active = this.mainForm.ChartFormActive; if (active == null) { e.NoActiveChartFoundToAccomodateStrategy = true; //USELESS Assembler.PopupException("NO_ACTIVE_CHART_FORMS_IN_DOCUMENT_PANE_TO_LOAD_STRATEGY_INTO this.mainForm.ChartFormActive=null //StrategiesTree_OnStrategySelected(" + e.Strategy + ")"); return; } active.ChartFormManager.InitializeWithStrategy(this.mainForm, e.Strategy); }
// Pop out a Chart Form that graphs a Linear Function private void btnGraph_Click(object sender, EventArgs e) { ChartForm form = new ChartForm(); if (cboFunctions.Items.Count > 0) { form.SetLegendText(cboFunctions.Text); form.SetGraphType("line"); form.SetDataPoints(cboFunctions.Text); form.Show(); } }
private void initrulform() { rulform = new ChartForm(); rulform.chart1.BackColor = SystemColors.ControlDarkDark; rulform.chart1.ForeColor = SystemColors.ControlLightLight; rulform.chart1.Titles.Add("RUL"); rulform.chart1.ChartAreas[0].AxisX.Name = "时间"; rulform.chart1.ChartAreas[0].AxisY.Name = "剩余寿命"; rulform.chart1.Series.Add("剩余寿命"); rulform.chart1.Series["剩余寿命"].ChartType = SeriesChartType.FastLine; rulform.chart1.Series["剩余寿命"].Color = Color.Blue; }
private void button2_Click(object sender, EventArgs e) { var cheb1_5 = CalculateCheb1Directly(5, 0.5); var cheb1_8 = CalculateCheb1Directly(8, 0.5); var cheb1_52 = CalculateCheb1Directly(5, 0.2); var cheb1_82 = CalculateCheb1Directly(8, 0.2); ChartForm chart = new ChartForm(cheb1_5, "w", "", "Chebyshev-1 (direct calculation)", "N=5, E=0.5"); chart.AddSeriresData(cheb1_8, "N=8, E=0.5"); chart.AddSeriresData(cheb1_52, "N=5, E=0.2"); chart.AddSeriresData(cheb1_82, "N=8, E=0.2"); chart.Show(); }
public static void Main(string[] args) { Search searchProgram = new Search(); Histogram <string> histogram = searchProgram.StartSearch(); if (histogram.Count > 0) { ChartForm form = new ChartForm(); form.Draw(histogram); form.Focus(); form.BringToFront(); form.ShowDialog(); } }
public void showChartForXor(XorTrResult xorTrResult, TrainingSetings trainSettings) { list0 = new List <PointInfo>(); list1 = new List <PointInfo>(); activatonFunctions.maxError = trainSettings.maxError; preparePointListForXor(xorTrResult, trainSettings.activiationFunction); float[,] table0 = changeListToArray(list0); float[,] table1 = changeListToArray(list1); ChartForm chartForm = new ChartForm(table0, table1); chartForm.Show(); }
private void BtnLineChartWindowClick(object sender, EventArgs e) { const int graphLength = 630; var sine = new double[graphLength]; var cosine = new double[graphLength]; for (int i = 0; i < graphLength; i++) { sine[i] = Math.Sin(i * 0.01); cosine[i] = Math.Cos(i * 0.01); } ChartForm.ShowLineChartForm(new[] { "Sine", "Cosine" }, new[] { sine, cosine }, "Sine vs Cosine", "x", "value", "Line Chart Window Demo"); }
private void buttonShowDistribution_Click(object sender, EventArgs e) { ChartForm form = new ChartForm("Distribution of results"); form.Show(); Dictionary <double, double> distributedResults = MathHelper.CalculateValueDistribution(_results[listBoxResults.SelectedIndex], 256); double[] distributedValues = GeneralHelper.EnumerableToArray(distributedResults.Values); double[] distributedValuesMA = MathHelper.CalculateQuickMA(distributedValues, 12); form.Chart.MasterPane.Add(new LinesChartSeries("Value distribution", LinesChartSeries.ChartTypeEnum.Histogram, GeneralHelper.DoublesToFloats(distributedValues)), true, false); form.Chart.MasterPane.Add(new LinesChartSeries("Value distribution MA 12", LinesChartSeries.ChartTypeEnum.Line, GeneralHelper.DoublesToFloats(distributedValuesMA)), true, false); }
private void initrmsform() { rmsform = new ChartForm(); rmsform.chart1.BackColor = SystemColors.ControlDarkDark; rmsform.chart1.ForeColor = SystemColors.ControlLightLight; rmsform.chart1.Titles.Add("RMS"); rmsform.chart1.ChartAreas[0].AxisX.Name = "时间"; rmsform.chart1.ChartAreas[0].AxisY.Name = "幅值"; rmsform.chart1.Series.Add("z轴RMS"); rmsform.chart1.Series["z轴RMS"].ChartType = SeriesChartType.FastLine; rmsform.chart1.Series["z轴RMS"].Color = Color.Red; rmsform.chart1.Series.Add("x轴RMS"); rmsform.chart1.Series["x轴RMS"].ChartType = SeriesChartType.FastLine; rmsform.chart1.Series["x轴RMS"].Color = Color.Yellow; }
private void initfftform() { fftform = new ChartForm(); fftform.chart1.BackColor = SystemColors.ControlDarkDark; fftform.chart1.ForeColor = SystemColors.ControlLightLight; fftform.chart1.Titles.Add("频谱图"); fftform.chart1.ChartAreas[0].AxisX.Name = "频率"; fftform.chart1.ChartAreas[0].AxisY.Name = "幅值"; fftform.chart1.Series.Add("z轴频谱"); fftform.chart1.Series["z轴频谱"].ChartType = SeriesChartType.FastLine; fftform.chart1.Series["z轴频谱"].Color = Color.Red; fftform.chart1.Series.Add("x轴频谱"); fftform.chart1.Series["x轴频谱"].ChartType = SeriesChartType.FastLine; fftform.chart1.Series["x轴频谱"].Color = Color.Yellow; }
/// <summary> /// Получение шаблона из toolset.xml и применение его к графику /// </summary> /// <param name="templateName">имя щаблона, который нужно применить</param> /// <param name="child">форма, на которой распологается график</param> private static void ApplyTemplate(string templateName, ChartForm child) { var childTemplate = ChartTemplate.GetChartTemplate(templateName); if (childTemplate == null) { return; } if (childTemplate.Attributes[ChartTemplate.AttributeChartSize] != null) { child.Size = ChartTemplate.StringToSize(childTemplate.Attributes[ChartTemplate.AttributeChartSize].Value).Value; } child.chart.LoadIndicatorSettings(childTemplate); child.chart.UpdateIndicatorPanesAndSeries(); }
private void button8_Click(object sender, EventArgs e) { int scale = (int)numericUpDown2.Value; var direct = _waveletWorker.ForwardDaubechies(_transformedSource .Take(1 << FindMaxPower(_transformedSource.Count)) .Select(p => p.Y).ToArray(), scale); var directData = direct.Select((d, i) => new Tuple <double, double>(_transformedSource[i].X, d)); ChartForm directChart = new ChartForm(directData, "", "", "Daubechies's transform (forward)", "scale: " + scale.ToString()); directChart.Show(); var invert = _waveletWorker.InverseDaubechies(direct, scale); var invertData = invert.Select((d, i) => new Tuple <double, double>(_transformedSource[i].X, d)); ChartForm invertChart = new ChartForm(invertData, "", "", "Daubechies's transform (invert)", "scale: " + scale.ToString()); invertChart.Show(); }
private void buttonCalculate_Click(object sender, EventArgs e) { double beginningIntegrationInterval; double endingIntegrationInterval; int dividingPoint; try { beginningIntegrationInterval = Double.Parse(beginningIntegrationIntervalTextbox.Text, CultureInfo.InvariantCulture); } catch (System.SystemException) { MessageBox.Show("Nie poprawna wartość xp"); return; } try { endingIntegrationInterval = Double.Parse(endingIntegrationIntervalTextbox.Text, CultureInfo.InvariantCulture); } catch (System.SystemException) { MessageBox.Show("Nie poprawna wartość xk"); return; } dividingPoint = Convert.ToInt32(dividingPointTextbox.Text); Equation calculating = new Equation(beginningIntegrationInterval, endingIntegrationInterval, dividingPoint); calculating.convertingToArrayDouble(polynomialX2.Text, polynomialX1.Text, polynomialX0.Text); calculating.convertingToArrayChar(arithmeticSymbol1.Text, arithmeticSymbol2.Text); calculating.Final(); FinalValues fV = new FinalValues(calculating.givePolynomialValues(), calculating.giveArithmeticSymbol(), calculating.giveNumberDividingPoints(), calculating.giveBeginningIntegrationInterval(), calculating.giveEndingIntegrationInterval(), calculating.finalValueFunctionIntegral); ChartForm cF = new ChartForm(calculating.givePolynomialValues(), calculating.giveArithmeticSymbol(), calculating.giveNumberDividingPoints(), calculating.giveBeginningIntegrationInterval(), calculating.giveEndingIntegrationInterval()); fV.Show(); cF.Show(); this.Close(); }
private void 日の変化量ToolStripMenuItem_Click(object sender, EventArgs e) { try { var selected = dataGridView1.SelectedRows.Cast <DataGridViewRow>().Select(r => r.DataBoundItem as Company); foreach (var company in selected) { var creator = new DailyChangeHistgramCreator(company); var form = new ChartForm(creator); form.Show(); } } catch (Exception ex) { _logger.Error(ex.ToString()); } }
private void button5_Click(object sender, EventArgs e) { var cheb_ch5 = CalculateCheb1(5, 0.5); var cheb_ch8 = CalculateCheb1(8, 0.5); var cheb_ch82 = CalculateCheb1(8, 0.2); ChartForm afcf = new ChartForm(cheb_ch5.afc, "w", "", "chebyshev h(s) based afc", "N=5 E=0.5"); afcf.AddSeriresData(cheb_ch8.afc, "N=8 E=0.5"); afcf.AddSeriresData(cheb_ch82.afc, "N=8 E=0.2"); afcf.Show(); ChartForm ffcf = new ChartForm(cheb_ch5.ffc, "w", "", "chebyshev h(s) based ffc", "N=5 E=0.5"); ffcf.AddSeriresData(cheb_ch8.ffc, "N=8 E=0.5"); ffcf.AddSeriresData(cheb_ch82.ffc, "N=8 E=0.2"); ffcf.Show(); }
private void button4_Click(object sender, EventArgs e) { var batt_ch5 = CalculateBatterworth(5); var batt_ch8 = CalculateBatterworth(8); var batt_ch11 = CalculateBatterworth(11); ChartForm afcf = new ChartForm(batt_ch5.afc, "w", "", "batterwort h(s) based afc", "N=5"); afcf.AddSeriresData(batt_ch8.afc, "N=8"); afcf.AddSeriresData(batt_ch11.afc, "N=11"); afcf.Show(); ChartForm ffcf = new ChartForm(batt_ch5.ffc, "w", "", "batterwort h(s) based ffc", "N=5"); ffcf.AddSeriresData(batt_ch8.ffc, "N=8"); ffcf.AddSeriresData(batt_ch11.ffc, "N=11"); ffcf.Show(); }
private void okButton_Click(object sender, EventArgs e) { ChartViewData[] data = new ChartViewData[this.getNumberToDisplay()]; GraphSetupTabPage page = null; for (int i = 0; i < data.Length; i++) { page = (GraphSetupTabPage)((TabPage)this.graphPanel.Controls[i]).Controls[0]; data[i] = page.getGraphingData(); } ChartForm form = new ChartForm(); form.loadGraphData(data[0]); form.Show(); //for (int i = 0; i < this.tabCount; i++) { // page = (GraphSetupTabPage)((TabPage)this.graphPanel.Controls[i]).Controls[0]; // data = page.getGraphingData(); // if (page.isDisplayed() && data2 != null) // graphData.Add(data2); // else // continue; //} //if (graphData.Count == 0) // return; //TO DO: do the actual graphing }
// Acttion, ������������ ������� �� ���������� ������� private void ShowChartAction_Execute(object sender, EventArgs e) { Plant CurrentPlant; ReportPart CurrentPart; DataRow ChartRow; BookColumn ChartColumn; GetCurrentCellInfo(out CurrentPlant, out CurrentPart, out ChartRow, out ChartColumn); if (ChartColumn == null) { MessageBox.Show("���������� ������� ������� � ������� ��� ��������� ��������", "�������� ��������", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ChartRow == null || CurrentPart == null) { MessageBox.Show("���������� ������� ������ � ��������� ��� ��������� ��������", "�������� ��������", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string ModuleNorm = FM[CurrentPart.NormRow, ChartColumn.column1]; string ModuleName = ""; string CurrentFieldIndex = CurrentPart.FieldName(ChartColumn.column1).Split('*')[1]; object CurrentLowerNorm = ChartRow["LowerLimit*" + CurrentFieldIndex]; object CurrentUpperNorm = ChartRow["UpperLimit*" + CurrentFieldIndex]; List<Plant> PlantsList = new List<Plant>(); foreach (ReportPart part in Parts) if (part.Data != null && part.Data.Rows.Count > 0) { Plant p = plants.FindPlant(Convert.ToInt32(part.Data[0, "plantid"])); if (!PlantsList.Contains(p)) PlantsList.Add(p); } QueryResult[] ChartDatas = new QueryResult[PlantsList.Count]; DataRow ModuleRow; int i = 0; foreach (ReportPart part in Parts) { if (part.Data != null && part.Data.Rows.Count > 0) { string FieldName = part.FieldName(ChartColumn.column1); if (FieldName != "") { string[] values = FieldName.Split('*'); int ColumnIndex = Functions.ConvertToInt32(values[1]); ModuleRow = part.Columns.Rows[ColumnIndex]; ModuleName = ModuleRow["TextModule"].ToString(); if (ModuleRow["TestGroup"].ToString().Trim() != "") ModuleName = ModuleRow["TestGroup"].ToString() + ", " + ModuleName; string DateField = "qaodecisiontime"; string CertField = "batchno"; string DataField = "Result*" + ColumnIndex.ToString(); string MinField = "LowerLimit*" + ColumnIndex.ToString(); string MaxField = "UpperLimit*" + ColumnIndex.ToString(); // ���� ����� ���������, �� /*if (ModuleNorm.ToLower() != ModuleRow["ModuleNorm"].ToString().ToLower()) continue;*/ if (CurrentLowerNorm.ToString().ToLower() != part.Data[0, MinField].ToString().ToLower() || CurrentUpperNorm.ToString().ToLower() != part.Data[0, MaxField].ToString().ToLower()) continue; // ��������� ����� �������� ������� QueryResult dt = new QueryResult(part.Data.DefaultView.ToTable(false, DateField, CertField, DataField, MinField, MaxField)); // �������������� �������� dt.Columns[DateField].ColumnName = "Date"; dt.Columns[CertField].ColumnName = "Passport"; dt.Columns[DataField].ColumnName = "Value"; dt.Columns[MinField].ColumnName = "Min"; dt.Columns[MaxField].ColumnName = "Max"; // ���������� ����� �������� dt.AddColumn("PlantName", typeof(string), plants.FindPlant(Convert.ToInt32(part.Data[0, "plantid"])).ShortPlantName); dt.AddColumn("Module", typeof(string), ModuleName); dt.AddColumn("Norm", typeof(string), ModuleRow["ModuleNorm"]); if (Functions.IsNumber(FM[part.RowAvg, ChartColumn.column1])) dt.AddColumn("Average", typeof(double), FM[part.RowAvg, ChartColumn.column1]); i = PlantsList.IndexOf(plants.FindPlant(Convert.ToInt32(part.Data[0, "plantid"]))); if (ChartDatas[i] == null) ChartDatas[i] = new QueryResult(dt); else { // ���� � ������ ������ ���� �������� � ����������� �������, �� �� ����� ���������� ChartDatas[i].Merge(dt); // �������� ����������������� �������� ����� ����������� ������ if (ChartDatas[i].Columns.Contains("Average")) { object newavg = ChartDatas[i].Compute("avg(Average)", ""); foreach (DataRow row in ChartDatas[i].Rows) row["Average"] = newavg; } } } } if (ChartDatas[i] != null) // ��������� ������ ����� ������������ (����� ����������, ���� ���� ����������� ������ ���������) { DataView dv = ChartDatas[i].DefaultView; dv.Sort = "Date, Passport"; ChartDatas[i] = new QueryResult(dv.ToTable()); } } //Array.Resize<QueryResult>(ref ChartDatas, 5); ChartForm form = new ChartForm(); form.Text = string.Format("{0}. {1}, {2}", (ProductCombo.SelectedItem as DataRowView)["Description"], ModuleName, ModuleNorm); form.TitleLabel.Text = form.Text; form.Initialize(ChartDatas); form.WindowState = FormWindowState.Maximized; form.Show(); }