Beispiel #1
0
        public virtual HierarchyTableConfig GetData()
        {
            var data = new HierarchyTableConfig {
                IsLowerTable = IsLowerTable, IsTopTable = IsTopTable
            };

            foreach (var col in Input.Columns.Where(col => col.Name.Contains("IS_MERCK")))
            {
                _isRbIndex = col.Position;
            }
            foreach (var col in Input.Columns.Where(col => col.Name.Contains("Name")))
            {
                _NameColIndex = col.Position;
            }
            var factory = new CubeTableFactory()
            {
                CellMaps           = GetCellMap(Input.Columns),
                AutoCreateHeader   = false,
                AutoCreateCellMaps = false,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new LevelWiseRowColorFunctionaility(IsTopTable),
                    new RowSpecificRankLevelFunctionality(),
                    new AlternateRowColorFunctionality <Row>()
                    {
                        EvenColor = "#ffffff;", OddColor = "#B2DFDD"
                    },
                    new HighlightRowIfRb()
                    {
                        colIndex = _isRbIndex
                    },
                    new HoverValueAddRowFunctionality(IsLowerTable)
                    {
                        CompanyTextColIndex = _NameColIndex, CompanyValueColIndex = Input.Columns.Last().Position
                    }
                }
            };
            var table = factory.Create(Input);

            //table.Classes.Add("table");
            table.Classes.Add("snapshot-table-bordered");
            var header = new TableHeader();

            header.Rows.Add(FirstHeader(data));
            header.Rows.Add(SecondHeader());
            table.Header = header;
            table.Classes.Add(IsTopTable ? "top-table" : "bottom-table");
            if (ShowFullLength)
            {
                table.Classes.Add("LargeNameColTable");
            }
            data.Table = table;
            GetVarianceColumn(data, factory);
            return(data);
        }
Beispiel #2
0
        public Table GetTableData()
        {
            foreach (var col in Input.Columns.Where(col => col.Name.Contains("IS_MERCK")))
            {
                _isMerckIndex = col.Position;
            }

            var tableFactory = new CubeTableFactory
            {
                CellMaps           = GetCellMap(Input.Columns, KPI.ToUpper() == "SALES"),
                AutoCreateCellMaps = false,
                AutoCreateHeader   = false,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new AlternateRowColorFunctionality <Row>()
                    {
                        EvenColor = "#ffffff;", OddColor = "#E1F5F5"
                    },
                    new LevelWiseRowColorFunctionaility(false),
                    new TotalRowHighlight()
                    {
                        colIndex = 1
                    },
                    new HighlightRowIfMerck()
                    {
                        colIndex = _isMerckIndex
                    }
                }
            };
            var header = new TableHeader();

            if (KPI.ToUpper() == "GROWTH")
            {
                header.Rows.Add(GetHeaderForGrowth());
            }
            else if (PeriodType.ToUpper() == "MAT" || PeriodType.ToUpper() == "YTD")
            {
                header.Rows.Add(GetHeader(true));
            }
            else
            {
                header.Rows.Add(GetHeader(false));
            }
            tableFactory.Header = header;
            Table table = tableFactory.Create(Input);

            table.Attributes.Add("id", TrendChartControlId);
            table.Classes.Add("trend-table");
            return(table);
        }
Beispiel #3
0
        public Table GetTableData()
        {
            var tableFactory = new CubeTableFactory
            {
                CellMaps           = GetCellMap(Input.Columns),
                AutoCreateCellMaps = false,
                AutoCreateHeader   = false,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new AlternateRowColorFunctionality <Row>()
                    {
                        EvenColor = "#ffffff;", OddColor = "#E1F5F5"
                    },
                    new LevelWiseRowColorFunctionaility(false),
                    new TotalRowHighlight()
                    {
                        colIndex = 1
                    },
                    new HighlightRowIfRb()
                    {
                        colIndex = _isRbIndex
                    }
                }
            };
            var header = new TableHeader();

            header.Rows.Add(GetHeader());
            tableFactory.Header = header;
            Table table = tableFactory.Create(Input);

            table.Attributes.Add("id", TrendChartControlId);
            table.Classes.Add("trend-table");
            //if (ShowFullLength)
            //    table.Classes.Add("LargeNameColTable");
            return(table);
        }
Beispiel #4
0
        public HoverData GetData()
        {
            var data = new HoverData();

            var tableFactory = new CubeTableFactory()
            {
                CellMaps           = GetMap(Input),
                Header             = GetHeader(Input.Columns),
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new AlternateRowColorFunctionality <Row>()
                    {
                        EvenColor = "#FFFFFF", OddColor = "#d8efee"
                    }
                },
                AutoCreateHeader = false
            };
            var table = tableFactory.Create(Input);

            table.Classes.Add("latest-data-hover");
            data.TableNode = table;

            return(data);
        }
Beispiel #5
0
        public SingleTableModel GetData()
        {
            //string WidgetName = WidgetName;
            var header = new TableHeader();
            //var footer = new TableFooter();
            var firstHeaderRow = new TableRow()
            {
                Cells =
                {
                    new SimpleNode(name:"th", value:"Rank"),
                    new SimpleNode(name:"th", value:"Company"),
                    new SimpleNode(name:"th", value:"Sales")
                    {
                        Styles = new Dictionary <string,string>()
                        {
                            { "text-align",   "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"MS%")
                    {
                        Styles = new Dictionary <string,string>()
                        {
                            { "text-align",   "center" }
                        }
                    }
                }
            };

            var footerRow = new TableRow()
            {
                Cells =
                {
                    new SimpleNode(name:"th", value:Periodtext + "-" + EndDate)
                    {
                        Attributes = new Dictionary <string,string>()
                        {
                            { "colspan",      "4"}
                        }
                    }
                }
            };

            header.Rows.Add(firstHeaderRow);
            //header.Classes.Add("sfhtHeader");
            //footer.Rows.Add(footerRow);
            //footer.Classes.Add("homeTableFooter");

            var cellMaps = new List <ICellMap <Row> >
            {
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "CorporationRank"
                    },
                    CellFactory = new TextCellFactory(nodeName: "td")
                    {
                        Classes = new List <string>()
                        {
                            "Rank_Col"
                        },
                        Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    RowCellDataProvider = new CubeCellDataProvider(Input.Columns)
                },

                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Company"
                    }, CellFactory = new TextCellFactory(nodeName: "td")
                    {
                        Classes = new List <string>()
                        {
                            "Rank_Company"
                        }
                    }, RowCellDataProvider = new CubeCellDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "SALES"
                    }, CellFactory = new CustomNumberCellFactory(colId: 3, nodeName: "td")
                    {
                        NumberFormatString = "#,##0,", Suffix = "k", Classes = new List <string>()
                        {
                            "Rank_Sales"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    }, RowCellDataProvider = new CubeCellDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "MS%"
                    }, CellFactory = new CustomNumberCellFactory(colId: 4, nodeName: "td")
                    {
                        NumberFormatString = "##0.0", Suffix = "%", Classes = new List <string>()
                        {
                            "Rank_MS"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    }, RowCellDataProvider = new CubeCellDataProvider(Input.Columns)
                },
            };

            var cubeTableFactory = new CubeTableFactory
            {
                Header   = header,
                CellMaps = cellMaps,
                //Footer = footer,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new RbRowHighlight()
                },
                AutoCreateHeader = false
            };
            var table = cubeTableFactory.Create(Input);
            var data  = new SingleTableModel()
            {
                Title  = (WidgetName == "Top10IntPrdTable") ? "Top 10 Int Product" : "Top 10 Companies by Sales",
                _Table = table
            };

            return(data);
        }
        public SingleTableModel GetData()
        {
            var header = new TableHeader();
            var h1     = new TableRow()
            {
                Cells =
                {
                    //new SimpleNode(name:"th",value:"Rank"){Styles = new Dictionary<string, string>(){{"text-align","left"}}},
                    new ComplexNode(name:"th")
                    {
                        ChildNodes = new List <INode>()
                        {
                            new SimpleNode("img", "")
                            {
                                Classes = new List <string>()
                                {
                                    "expandCollapseAll"
                                }, Attributes ={                 { "src", "Content/Images/expandAll.png" }, { "title", "Expand/Collapse all" }, { "onClick", _IsMoleculeAtAGlance? "RbHelper.ExpandCollapseAll(this,'2' )":"RbHelper.ExpandCollapseAll(this,'1' )" } }
                            },
                            new SimpleNode(name:"div", value:"Rank")
                            {
                                Classes = new List <string>()
                                {
                                    "expandCollAllText"
                                }, Styles = new Dictionary <string, string>()
                                {
                                    { "text-align", "left" }
                                }
                            },
                        },
                        Classes = new List <string>()
                        {
                            "Rank"
                        },
                        Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "left" }
                        }
                    },
                    new SimpleNode(name:"th", value:NameColumnValue)
                    {
                        Classes = new List <string>()
                        {
                            "Company"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "left" }
                        }
                    },
                    new SimpleNode(name:"th", value:MeasureText + " Sales")
                    {
                        Classes = new List <string>()
                        {
                            "Sales"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Share%")
                    {
                        Classes = new List <string>()
                        {
                            "Share"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Growth % VYA")
                    {
                        Classes = new List <string>()
                        {
                            "Growth"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Share Pts Chg")
                    {
                        Classes = new List <string>()
                        {
                            "SharePtsChg"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    }
                }
            };

            header.Rows.Add(h1);
            int childLevel = Input.Rows.Select(r => r.Level).Max();
            var cellMaps   = new List <ICellMap <Row> >
            {
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Ranking"
                    }, CellFactory = new ExpandCollapseHyperLinkCellFactory()
                    {
                        Classes = new List <string>()
                        {
                            "Rank"
                        }, ChildLevel = childLevel, IsMoleculeAtAGlance = _IsMoleculeAtAGlance
                    }, RowCellDataProvider = new ExpandCollapseCellDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Name"
                    }, CellFactory = new NameCellFactory(nodeName: "td")
                    {
                        IsMakeTextShort     = true, NameCollength = ShowFullLength?999:35,
                        IsMoleculeAtAGlance = _IsMoleculeAtAGlance, IsBrandAtAGlance = _IsBrandAtAGlance, IsSubbrandAtAGlance = _IsSubbrandAtAGlance,
                        ChildLevel          = childLevel, Classes = new List <string> {
                            "Company"
                        }
                    }, RowCellDataProvider = new ExpandCollapseCellDataProvider(Input.Columns)
                },

                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Total Units Sales", "Total Units Sales Arrow"
                    }, CellFactory = new NumberDecimalWithArrowIndicationCellFactory(2)
                    {
                        NumberFormatString = _IsThousand?"#,###,":"#,#0", Suffix = _IsThousand?"k":"", Classes = new List <string>()
                        {
                            "Sales"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },

                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Share %", "Market Share % Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "Share"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Growth % VYA", "Growth % VYA Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "Growth"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Share Pts Chg", "Share Pts Chg Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "SharePtsChg"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
            };

            foreach (var col in Input.Columns.Where(col => col.Name.ToUpper() == "IS_MERCK"))
            {
                _isRbIndex = col.Position;
            }

            var cubeTableFactory = new CubeTableFactory
            {
                Header             = header,
                CellMaps           = cellMaps,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new RowSpecificRankLevelFunctionality(),
                    new ExpandCollTableAlternateColorFunctionality()
                    {
                        ChildLevel = childLevel
                    },
                    new HighlightRowIfRb()
                    {
                        colIndex = _isRbIndex
                    }
                },
                AutoCreateHeader = false
            };
            var input = GetProperRanking(Input);

            var table = cubeTableFactory.Create(input);

            if (ShowFullLength)
            {
                table.Classes.Add("LargeNameColTable");
            }
            var data = new SingleTableModel()
            {
                Title  = "",
                _Table = table
            };

            return(data);
        }
        public SingleTableModel GetData()
        {
            var header = new TableHeader();
            var tokens = _Measure.Split(' ').ToList();
            var h1     = new TableRow()
            {
                Cells =
                {
                    //new SimpleNode(name:"th",value:"Market/Region"){Classes = new List<string>(){"Categories"},Styles = new Dictionary<string, string>(){{"text-align","left"}}},
                    new ComplexNode(name:"th")
                    {
                        ChildNodes = new List <INode>()
                        {
                            new SimpleNode("img", "")
                            {
                                Classes = new List <string>()
                                {
                                    "expandCollapseAll"
                                }, Attributes ={                 { "src", "Content/Images/expandAll.png" }, { "title", "Expand/Collapse all" }, { "onClick", "RbHelper.ExpandCollapseAll(this,'1' )" } }
                            },
                            new SimpleNode(name:"div", value:CompanyOrBrandHeader)
                            {
                                Classes = new List <string>()
                                {
                                    "expandCollAllText"
                                }, Styles = new Dictionary <string, string>()
                                {
                                    { "text-align", "left" }
                                }
                            },
                        },
                        Classes = new List <string>()
                        {
                            "Categories"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "left" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Total " + tokens.First() + "(Fixed) Sales")
                    {
                        Classes = new List <string>()
                        {
                            "Sales"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Merck" + tokens.First() + "(Fixed) Sales")
                    {
                        Classes = new List <string>()
                        {
                            "Sales"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Total Contribution %")
                    {
                        Classes = new List <string>()
                        {
                            "Contribution"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Merck Contribution %")
                    {
                        Classes = new List <string>()
                        {
                            "Contribution"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Total Growth vs. PPYA*")
                    {
                        Classes = new List <string>()
                        {
                            "Growth"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    },
                    new SimpleNode(name:"th", value:"Merck Growth vs. PPYA*")
                    {
                        Classes = new List <string>()
                        {
                            "Growth"
                        }, Styles = new Dictionary <string, string>()
                        {
                            { "text-align", "center" }
                        }
                    }
                }
            };

            header.Rows.Add(h1);

            int childLevel = Input.Rows.Select(r => r.Level).Max();
            var cellMaps   = new List <ICellMap <Row> >
            {
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Category/Region"
                    }, CellFactory = new ExpandCollapseHyperLinkCellFactory()
                    {
                        ChildLevel = childLevel, InactiveParent = 1, Classes = new List <string>()
                        {
                            "Categories"
                        }
                    }, RowCellDataProvider = new ExpandCollapseCellDataProvider(Input.Columns)
                },
                //new CubeCellMap() {Columns = new List<string>(){"Total Units Sales","Total Units Sales Arrow"},CellFactory = new IndicatorCellFactory() {TextFormat = new TextFormat(){FormatString = "#,#0"},Classes = new List<string>() { "Sales" } },RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns) },

                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Total Units Sales", "Total Units Sales Arrow"
                    }, CellFactory = new NumberDecimalWithArrowIndicationCellFactory(2)
                    {
                        NumberFormatString = _IsThousand?"#,###,":"#,#0", Suffix = _IsThousand?"k":"", Classes = new List <string>()
                        {
                            "Sales"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                //Merck Units Sales
                //Total Sales Share %
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Merck Units Sales", "Merck Units Sales Arrow"
                    }, CellFactory = new NumberDecimalWithArrowIndicationCellFactory(2)
                    {
                        NumberFormatString = _IsThousand?"#,###,":"#,#0", Suffix = _IsThousand?"k":"", Classes = new List <string>()
                        {
                            "Sales"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Total Sales Share %", "Total Sales Share % Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "Growth"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Total Merck Share %", "Total Merck Share % Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "Growth"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },

                //new CubeCellMap() {Columns = new List<string>(){"Market Share %","Market Share % Arrow"},CellFactory = new IndicatorCellFactory() {TextFormat = new TextFormat(){FormatString = "#,#0.0"},Classes = new List<string>() { "Share" } },RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns) },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Total Growth % VYA", "Total Growth % VYA Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "Growth"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                new CubeCellMap()
                {
                    Columns = new List <string>()
                    {
                        "Merck Growth % VYA", "Merck Growth % VYA Arrow"
                    }, CellFactory = new IndicatorCellFactory()
                    {
                        TextFormat = new TextFormat()
                        {
                            FormatString = "#,#0.0"
                        }, Classes = new List <string>()
                        {
                            "SharePtsChg"
                        }
                    }, RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns)
                },
                //new CubeCellMap() {Columns = new List<string>(){"Share Pts Chg","Share Pts Chg Arrow"},CellFactory = new IndicatorCellFactory() {TextFormat = new TextFormat(){FormatString = "#,#0.0"},Classes = new List<string>() { "SharePtsChg"} },RowCellDataProvider = new CubeMultipleColumnDataProvider(Input.Columns) },
            };
            var cubeTableFactory = new CubeTableFactory
            {
                Header             = header,
                CellMaps           = cellMaps,
                RowFunctionalities = new List <IRowFunctionality <Row> >()
                {
                    new RowSpecificRankLevelFunctionality(),
                    new ExpandCollTableAlternateColorFunctionality()
                    {
                        ChildLevel = childLevel
                    },
                },
                AutoCreateHeader = false
            };
            var table = cubeTableFactory.Create(Input);

            table.Classes.Add("cat-all-category-by-loc");

            var data = new SingleTableModel()
            {
                Title  = "",
                _Table = table
            };

            return(data);
        }