public void LoadTXTData(string dataFilePath, bool sort = true) { FileInfo fl = new FileInfo(dataFilePath); data = new TableOfData(dataFilePath, fl.Name, sort); crrPoints = new PointF[data.Length]; for (int i = 0; i < crrPoints.Length; i++) { crrPoints[i].X = (float)data.Points[i].X; crrPoints[i].Y = (float)data.Points[i].F; } everCreatedCurvesCounter++; string legend = "График" + everCreatedCurvesCounter; Curves curve = new Curves(crrPoints, BaseColors[colorCounter], CurveThickness: 2, Legend: legend); if (++colorCounter == BaseColors.Length) { colorCounter = 0; } gr.AddCurve(curve); gr.Config.PriceForPointOX = gr.Config.PriceForPointOY; gr.DrawDiagram(); }
/// <summary> /// Вызывается при переходе к другой странице или номер изменения строк на странице. /// принимает фильтры и сортировки учетом. /// </summary> public void RePageViewOfData() { if (ViewOfData == null) { return; } string filter = ViewOfData.RowFilter; string sort = ViewOfData.Sort; DataTable tmp = ViewOfData.ToTable(); TableOfData.Merge(tmp); var old = this.TableOfData.AsEnumerable(); var changed = this.ViewOfData.Table.AsEnumerable(); var newitems = changed.Except(old); foreach (var addrow in newitems) { TableOfData.Rows.Add(addrow); } IEnumerable <DataRow> toshow = TableOfData.Select(ViewOfData.RowFilter, ViewOfData.Sort) .Skip(CurrentPage * RowsPerPage) .Take(RowsPerPage); ViewOfData = new DataView(toshow.Count() > 0 ? toshow.CopyToDataTable() : TableOfData.Clone()); ViewOfData.RowFilter = filter; ViewOfData.Sort = sort; }
int everCreatedCurvesCounter; //Содержит кол-во когда-либо, созданных кривых public string ShowCurvePoints(string curveLegend) { string table = ""; foreach (Curves c in gr.GraphCurves) { if (c.Legend == curveLegend) { TableOfData d = new TableOfData(c.PointsToDraw, c.Legend, false); return(d.Table_of_Function()); } } return(table); }