ig.OlapFlatDataSource

ig.OlapFlatDataSource_image
igOlapFlatDataSource コンポーネントは、フラット データ コレクションで処理するための複数多次元 (OLAP スタイル) 解析を有効にします。データ コレクションまたは igDataSource™ インスタンスの場合、ユーザー構成に基づいて階層のディメンションおよびメジャーを作成するために必要なメタデータを抽出します。igOlapFlatDataSource コンポーネントは、コンポーネントの API を直接使用、または OLAP データの視覚化および対話が可能な 1 つ以上の Ignite UI ウィジェットを介して、要求に応じてデータの計算および集計を実行します (igPivotView™ または igPivotGrid™ など)。

コード サンプル

<!doctype html>
<html>
<head>
    <!-- Infragistics Combined CSS -->
    <link href="css/themes/infragistics/infragistics.theme.css" rel="stylesheet" type="text/css" />
    <link href="css/structure/infragistics.css" rel="stylesheet" type="text/css" />
    <!-- jQuery Core -->
    <script src="js/jquery.js" type="text/javascript"></script>
    <!-- jQuery UI -->
    <script src="js/jquery-ui.js" type="text/javascript"></script>
    <!-- Infragistics Combined Scripts -->
    <script src="js/infragistics.core.js" type="text/javascript"></script>
    <script src="js/infragistics.lob.js" type="text/javascript"></script>
    <script type="text/javascript">
        var data =
                [{ "ProductCategory": "Clothing", "UnitPrice": 12.81, "SellerName": "Stanley Brooker", "Country": "Bulgaria", "City": "Plovdiv", "Date": "01/01/2012", "UnitsSold": 282 },
                { "ProductCategory": "Clothing", "UnitPrice": 49.57, "SellerName": "Elisa Longbottom", "Country": "US", "City": "New York", "Date": "01/05/2013", "UnitsSold": 296 },
                { "ProductCategory": "Bikes", "UnitPrice": 3.56, "SellerName": "Lydia Burson", "Country": "Uruguay", "City": "Ciudad de la Costa", "Date": "01/06/2011", "UnitsSold": 68 },
                { "ProductCategory": "Accessories", "UnitPrice": 85.58, "SellerName": "David Haley", "Country": "UK", "City": "London", "Date": "04/07/2012", "UnitsSold": 293 },
                { "ProductCategory": "Components", "UnitPrice": 18.13, "SellerName": "John Smith", "Country": "Japan", "City": "Yokohama", "Date": "12/08/2012", "UnitsSold": 240 },
                { "ProductCategory": "Clothing", "UnitPrice": 68.33, "SellerName": "Larry Lieb", "Country": "Uruguay", "City": "Ciudad de la Costa", "Date": "05/12/2011", "UnitsSold": 456 },
                { "ProductCategory": "Components", "UnitPrice": 16.05, "SellerName": "Walter Pang", "Country": "Bulgaria", "City": "Sofia", "Date": "02/19/2013", "UnitsSold": 492 }];
 
        $(function () {
            // create the OlapFlatDataSource instance
            var dataSource = new $.ig.OlapFlatDataSource({
                dataSource: data,
                metadata: {
                    cube: {
                        name: "Sales",
                        caption: "Sales",
                        measuresDimension: {
                            caption: "Measures",
                            measures: [ //for each measure, name and aggregator are required
                                {
                                    caption: "Units Sold", name: "UnitsSold",
                                    // returns a function that will be used as sum aggregatro on the 'UnitsSold property' of the data objects
                                    aggregator: $.ig.OlapUtilities.prototype.sumAggregator('UnitsSold')
                                }]
                        },
                        dimensions: [ // for each dimension name and hierarchies are required
                            {
                                caption: "Seller", name: "Seller", hierarchies: [{
                                    caption: "Seller", name: "Seller", levels: [
                                        {
                                            name: "AllSellers", caption: "All Sellers",
                                            memberProvider: function (item) { return "All Sellers"; }
                                        },
                                        {
                                            name: "SellerName", caption: "Seller",
                                            memberProvider: function (item) { return item.SellerName; }
                                        }]
                                }]
                            },
                            {
                                caption: "Date", name: "Date", /*displayFolder: "Folder1\\Folder2",*/ hierarchies: [
                                    $.ig.OlapUtilities.prototype.getDateHierarchy(
                                        "Date", // the source property name
                                        ["year", "quarter", "month", "date"], // the date parts for which levels will be generated (optional)
                                        "Dates", // The name for the hierarchy (optional)
                                        "Date", // The caption for the hierarchy (optional)
                                        ["Year", "Quarter", "Month", "Day"], // the captions for the levels (optional)
                                        "All Periods") // the root level caption (optional)
                                ]
                            }
                        ]
                    }
                },
                // Preload hiearhies for the rows, columns, filters and measures
                rows: "[Date].[Dates]",
                columns: "[Seller].[Seller]",
                measures: "[Measures].[UnitsSold]"
 
            });
 
            $('#pivotView').igPivotView({
                dataSource: dataSource
            });
        });
    </script>
</head>
<body>
    <div id="pivotView"></div>
</body>
</html>

関連サンプル

関連トピック

依存関係

jquery-1.9.1.js
infragistics.util.js

Copyright © 1996 - 2025 Infragistics, Inc. All rights reserved.