/*** All the other stuff ***/ public static IColumnConfiguration MapTo(this IColumnConfiguration config, Expression <Func <T, object> > property) { if (property.Body is MemberExpression) { config.Property = (property.Body as MemberExpression).Member as PropertyInfo; } else { config.Property = (((UnaryExpression)property.Body).Operand as MemberExpression).Member as PropertyInfo; } }
public RulerColumnCollection( IColumnConfiguration columnConfiguration, IStaticRulerManager staticRulerManager, ITable table, int rulerIndex) { _columnConfiguration = columnConfiguration; _table = table; _rulerColumns = new List<RulerColumnInfo>(); // Value _valueColumn = new RulerColumnInfo( (curve, ruler) => curve.GetFormattedValue( curve.DataSeries.GetValueAtTime(ruler.Position, GetValueMode.MiddleValue)), //FormatDefinitions.FloatingComma), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.RulerShortText, false); AddColumn(_valueColumn); // Y-Delta _yDeltaColumn = new RulerColumnInfo( (curve, ruler) => curve.GetFormattedValue( ruler.GetDiff(curve.DataSeries).CompareValue), //FormatDefinitions.FloatingComma), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.DeltaY, true); AddColumn(_yDeltaColumn); // T-Delta _tDeltaColumn = new RulerColumnInfo( (curve, ruler) => ruler .GetDiff(curve.DataSeries) .TimeDiff.Abs().GetFormattedValue(), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.DeltaT, true); AddColumn(_tDeltaColumn); // Min _minColumn = new RulerColumnInfo( (curve, ruler) => curve.GetFormattedValue( ruler .GetAggregate(curve.DataSeries, list => list.Select(it => it.Y).MinOrFallback(double.NaN)) .CompareValue), //FormatDefinitions.FloatingComma), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.Min, true); AddColumn(_minColumn); // Max _maxColumn = new RulerColumnInfo( (curve, ruler) => curve.GetFormattedValue( ruler .GetAggregate(curve.DataSeries, list => list.Select(it => it.Y).MaxOrFallback(double.NaN)) .CompareValue), //FormatDefinitions.FloatingComma), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.Max, true); AddColumn(_maxColumn); // Avg _avgColumn = new RulerColumnInfo( (curve, ruler) => curve.GetFormattedValue( ruler .GetAggregate(curve.DataSeries, list => list.Select(it => it.Y).AverageOrFallback(double.NaN)) .CompareValue), //FormatDefinitions.FloatingComma), staticRulerManager, _table, _table.CreateColumn(), rulerIndex, MlResources.Avg, true); AddColumn(_avgColumn); //// Sum //_rulerColumns.Add( // new RulerColumnInfo( // (curve, ruler) => ruler // .GetAggregate(curve, Sum) // .CompareValue.GetFormattedValue(FormatDefinitions.FloatingComma), // _staticRulerManager, // i, // dataGrid, // "Σ (minute) " + (i + 1) + "-" + nextRulerLabel)); }