protected override DataFrameBuilder AddColumns(DataFrameBuilder dataFrameBuilder)
 {
     dataFrameBuilder = AddColumnForAxis(dataFrameBuilder, dataFrameBuilder.BaseAxis);
     var points = dataFrameBuilder.Points;
     var apexes = new double?[points.Count];
     var starts = new double?[points.Count];
     var fwhms = new double?[points.Count];
     for (int i = 0; i < points.Count; i++)
     {
         var point = points[i];
         if (point.IsMissing)
         {
             continue;
         }
         starts[i] = point.Z;
         var middleErrorTag = point.Tag as MiddleErrorTag;
         if (middleErrorTag != null)
         {
             apexes[i] = middleErrorTag.Middle;
             fwhms[i] = middleErrorTag.Error;
         }
     }
     var dataFrame = new DataFrame(dataFrameBuilder.ValueAxis.Title.Text, dataFrameBuilder.Points.Count);
     dataFrame = dataFrame.AddColumn(new DataColumn<double?>("Apex", apexes));  // Not L10N
     dataFrame = dataFrame.AddColumn(new DataColumn<double?>("Start", starts)); // Not L10N
     dataFrame = dataFrame.AddColumn(GetColumnForAxis(dataFrameBuilder, dataFrameBuilder.ValueAxis).SetTitle("End")); // Not L10N
     dataFrame = dataFrame.AddColumn(new DataColumn<double?>("FWHM", fwhms)); // Not L10N
     dataFrameBuilder = dataFrameBuilder.AddColumn(dataFrame);
     return dataFrameBuilder;
 }
Пример #2
0
        protected override DataFrameBuilder AddColumns(DataFrameBuilder dataFrameBuilder)
        {
            dataFrameBuilder = AddColumnForAxis(dataFrameBuilder, dataFrameBuilder.BaseAxis);
            // Group the "High" and "Low" columns together, and put the title from the Axis on top of them
            var dataFrame = new DataFrame(dataFrameBuilder.ValueAxis.Title.Text, dataFrameBuilder.Points.Count);
            dataFrame = dataFrame.AddColumn(GetColumnForAxis(dataFrameBuilder, dataFrameBuilder.ValueAxis).SetTitle("High")); // Not L10N
            dataFrame = dataFrame.AddColumn(GetZAxisColumn(dataFrameBuilder.Points).SetTitle("Low")); // Not L10N

            dataFrameBuilder = dataFrameBuilder.SetDataFrame(dataFrameBuilder.DataFrame.AddColumn(dataFrame));
            return dataFrameBuilder;
        }
Пример #3
0
 public static GraphPaneData GetGraphPaneData(GraphPane graphPane)
 {
     var dataFrames = new List<DataFrame>();
     var rowHeaderToListIndex = new Dictionary<IColumnGroup, int>();
     foreach (var curveItem in graphPane.CurveList)
     {
         var curveHandler = CurveDataHandlers.FindCurveHandler(curveItem);
         if (curveHandler == null)
         {
             continue;
         }
         var curveData = new DataFrameBuilder(graphPane, curveItem);
         curveData = curveHandler.FilterToZoomedRange(curveData);
         curveData = curveHandler.CreateDataFrame(curveData);
         var dataFrame = curveData.DataFrame;
         if (dataFrame == null)
         {
             continue;
         }
         var rowHeader = dataFrame.RowHeader;
         int existingIndex;
         if (rowHeader != null && rowHeaderToListIndex.TryGetValue(rowHeader, out existingIndex))
         {
             DataFrame previousFrame = dataFrames[existingIndex];
             DataFrame mergedFrame;
             if (null == previousFrame.Title)
             {
                 mergedFrame = previousFrame.AddColumn(dataFrame.RemoveRowHeader());
             }
             else
             {
                 mergedFrame = new DataFrame(null, rowHeader)
                     .AddColumn(previousFrame.RemoveRowHeader())
                     .AddColumn(dataFrame.RemoveRowHeader());
             }
             dataFrames[existingIndex] = mergedFrame;
         }
         else
         {
             if (rowHeader != null)
             {
                 rowHeaderToListIndex.Add(rowHeader, dataFrames.Count);
             }
             dataFrames.Add(dataFrame);
         }
     }
     if (dataFrames.Count == 0)
     {
         return null;
     }
     return new GraphPaneData(graphPane.Title.Text, dataFrames);
 }
Пример #4
0
 public DataFrameBuilder SetDataFrame(DataFrame dataFrame)
 {
     return new DataFrameBuilder(this) { DataFrame = dataFrame};
 }
Пример #5
0
 public bool Equals(DataFrame other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.ColumnGroups, ColumnGroups) && other.RowCount == RowCount && Equals(other.RowHeader, RowHeader) && Equals(other.Title, Title);
 }