Example #1
0
        public ActionResult FixedHeader(IndexViewModel model)
        {
            var DB = SampleDB.Data.Where(mock => mock.Job.StartsWith("A"));

            model.pivot = DB.ToPivotTable(
                new List <PivotColumn <MockData> >()
            {
                new PivotColumn <MockData>("initial", (t) => t.car.Substring(0, 1), (t) => t.car.Substring(0, 1))
                {
                    Order = PivotOrder.Descending,
                },
                new PivotColumn <MockData>("car"),
            },
                new List <PivotColumn <MockData> >()
            {
                new PivotColumn <MockData>("category", (t) => t.Job.Split(' ').First(), (t) => t.Job.Split(' ').First()),
                new PivotColumn <MockData>("Job", (t) => string.Join(" ", t.Job.Split(' ').Skip(1))),
            },
                new List <PivotMeasure <MockData> >()
            {
                PivotMeasure <MockData> .Average("Avg.Cash", (t) => t.cash),
            }
                );
            return(View(model));
        }
Example #2
0
 public ActionResult Measure(IndexViewModel model)
 {
     model.pivot = SampleDB.Data.ToPivotTable(
         PivotColumn <MockData> .Build("country", "gender"),
         PivotColumn <MockData> .Build("stock_market"),
         new List <PivotMeasure <MockData> >()
     {
         PivotMeasure <MockData> .Sum("Sum", (t) => t.stock),
         PivotMeasure <MockData> .Average("Avg", (t) => t.stock),
         PivotMeasure <MockData> .Min("Min", (t) => t.stock),
         PivotMeasure <MockData> .Max("Max", (t) => t.stock),
     }
         );
     return(View(model));
 }