示例#1
0
        private Task <IEnumerable <object> > FetchDataAsync(int drilldownLevel)
        {
            return(System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                IEnumerable <object> data = null;
                switch (drilldownLevel)
                {
                case 0:
                    data = HierarchicalDataSource.GetGroupedData("Country", _currentValue, "City");
                    break;

                case 1:
                    data = HierarchicalDataSource.GetGroupedData("City", _currentValue, "Year");
                    break;

                case 2:
                    data = HierarchicalDataSource.GetGroupedData("Year", _currentValue, "Month");
                    break;

                case 3:
                    data = HierarchicalDataSource.GetGroupedData("Month", _currentValue, "Day");
                    break;

                default:
                    break;
                }
                return data;
            }));
        }
示例#2
0
        protected override void SetupChart()
        {
            treeMap = this.Chart as C1.Win.Chart.TreeMap;

            treeMap.Header.Content    = "Sales Distribution by Product";
            treeMap.Header.Style.Font = StyleInfo.ChartHeaderFont;

            treeMap.DataSource      = HierarchicalDataSource.GetProducts();
            treeMap.Binding         = "Orders";
            treeMap.BindingName     = "Name";
            treeMap.ChildItemsPath  = "Items";
            treeMap.MaxDepth        = 0;
            treeMap.Legend.Position = Position.None;

            treeMap.DataLabel.Content      = "{name}";
            treeMap.DataLabel.Style.Stroke = Brushes.Black;
            treeMap.DataLabel.Position     = LabelPosition.Center;
            treeMap.ToolTip.Content        = "{name} Sales : {value}";

            treeMap.SelectionMode = ChartSelectionMode.Point;
            treeMap.SelectionStyle.StrokeColor = Color.Black;
            treeMap.SelectedItem   = (treeMap.DataSource as List <Product>)[0].Items[0];
            treeMap.NodeRendering += TreeMap_NodeRendering;
            treeMap.Rendered      += (s, e) => { index = -1; _selectedGroup.Clear(); };
        }
        protected override void SetupChart()
        {
            //Setup FlexChart
            _flexChart.Header.Content    = "World GDP Ranking";
            _flexChart.Header.Style.Font = StyleInfo.ChartHeaderFont;

            _flexChart.DataSource = HierarchicalDataSource.GetFlatOrHierarchicalGDPData(true);
            _flexChart.BindingX   = "Country";

            var ser1 = new Series()
            {
                Binding = "CurrentPrices", Name = "Current Prices"
            };
            var ser2 = new Series()
            {
                Binding = "PPPValuation", Name = "PPP Valuation", ChartType = ChartType.LineSymbols
            };

            _flexChart.Series.Add(ser1);
            _flexChart.Series.Add(ser2);

            //Setup FlexPie
            _flexPie.Header.Content    = "Category-wise Total Sales";
            _flexPie.Header.Style.Font = StyleInfo.ChartHeaderFont;

            _flexPie.DataSource         = SalesDataSource.GetSeasonSales(5);
            _flexPie.BindingName        = "Name";
            _flexPie.Binding            = "TotalSales";
            _flexPie.DataLabel.Content  = "{y} : {p:0.0} % of Total";
            _flexPie.DataLabel.Position = PieLabelPosition.Center;
            _flexPie.DataLabel.Border   = true;
        }
示例#4
0
        static void OnReady()
        {
            var serviceRoot = "http://demos.kendoui.com/service";
            var homogeneous = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url      = serviceRoot + "/Employees",
                        dataType = "jsonp"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "EmployeeId",
                        hasChildrenString = "HasEmployees"
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = homogeneous.As <JsArray>(),
                dataTextField = "FullName"
            });
        }
示例#5
0
        protected override void SetupChart()
        {
            var items = HierarchicalDataSource.GetGroupedData("Country");

            manager = new DrillDownManager(items, "Value", "Name");
            manager.GroupNames.AddRange(new string[] { "Country", "City", "Year", "Month", "Day" });
            manager.BeforeDrill += Manager_BeforeDrill;
            manager.AfterDrill  += Manager_AfterDrill;
            manager.Refresh();

            //FlexChart settings
            flexChart1.BindingX = "Name";
            flexChart1.Binding  = "Value";
            flexChart1.Series.Add(new Series()
            {
                Name = "Value"
            });
            flexChart1.DataSource           = manager.CurrentItems.Views;
            flexChart1.ToolTip.Content      = "X:{x}\nY:{Value}";
            flexChart1.DataLabel.Style.Font = new Font("Segoe UI", 9);
            flexChart1.DataLabel.Position   = C1.Chart.LabelPosition.Top;
            flexChart1.DataLabel.Content    = "{y}";

            flexChart1.AxisY.Format      = "#,##0,K";
            flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;
            flexChart1.MouseClick       += ChartMouseClick;
        }
示例#6
0
        static void OnReady()
        {
            var serviceRoot = "http://demos.kendoui.com/service";
            var homogeneous = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = serviceRoot + "/Employees",
                        dataType = "jsonp"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "EmployeeId",
                        hasChildrenString = "HasEmployees"
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = homogeneous.As<JsArray>(),
                dataTextField = "FullName"
            });

        }
 protected override void SetupChart()
 {
     this.flexChart1.Header.Content    = "Sales Data";
     this.flexChart1.Header.Style.Font = StyleInfo.ChartHeaderFont;
     this.flexChart1.DataSource        = _data = HierarchicalDataSource.GetHierarchicalDataItems();
     this.flexChart1.BindingX          = "Key";
     this.flexChart1.Binding           = "Value";
     this.flexChart1.Series.Add(new Series {
         Name = "Sales"
     });
 }
示例#8
0
        static void OnReady()
        {
            var inlineDefault = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                    new { text = "Furniture", items = new JsArray {
                              new { text = "Tables & Chairs" },
                              new { text = "Sofas" },
                              new { text = "Occasional Furniture" }
                          } },
                    new { text = "Decor", items = new JsArray {
                              new { text = "Bed Linen" },
                              new { text = "Curtains & Blinds" },
                              new { text = "Carpets" }
                          } }
                }
            });

            var inline = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                    new { categoryName = "Storage", subCategories = new JsArray {
                              new { subCategoryName = "Wall Shelving" },
                              new { subCategoryName = "Floor Shelving" },
                              new{ subCategoryName = "Kids Storage" }
                          } },
                    new { categoryName = "Lights", subCategories = new JsArray {
                              new { subCategoryName = "Ceiling" },
                              new { subCategoryName = "Table" },
                              new { subCategoryName = "Floor" }
                          } }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        children = "subCategories"
                    }
                }
            });

            new jQuery("#treeview-left").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inlineDefault.As <JsArray>()
            });
            new jQuery("#treeview-right").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = inline.As <JsArray>(),
                dataTextField = new JsArray <JsString> {
                    "categoryName", "subCategoryName"
                }.As <JsString>()
            });
        }
        protected override void SetupChart()
        {
            var sunburst = this.Chart as C1.Win.Chart.Sunburst;

            sunburst.Binding            = "Value";
            sunburst.BindingName        = "Year,Quarter,Month";
            sunburst.ChildItemsPath     = "Items";
            sunburst.DataLabel.Position = PieLabelPosition.Center;
            sunburst.DataLabel.Content  = "{name}";
            sunburst.ToolTip.Content    = "In {name} Sales : {value}\nShare : {P:0}%";
            sunburst.DataSource         = HierarchicalDataSource.GetSunburstData();
            sunburst.Header.Content     = "Sales over the years";
            sunburst.Header.Style.Font  = StyleInfo.ChartHeaderFont;
        }
示例#10
0
        static void OnReady()
        {
            var inlineDefault = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                        new { text = "Furniture", items = new JsArray {
                            new { text = "Tables & Chairs" },
                            new { text = "Sofas" },
                            new { text = "Occasional Furniture" }
                        } },
                        new { text = "Decor", items = new JsArray {
                            new { text = "Bed Linen" },
                            new { text = "Curtains & Blinds" },
                            new { text = "Carpets" }
                        } }
                    }
            });

            var inline = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                data = new JsArray {
                        new { categoryName = "Storage", subCategories = new JsArray {
                            new { subCategoryName = "Wall Shelving" },
                            new { subCategoryName = "Floor Shelving" },
                            new{ subCategoryName = "Kids Storage" }
                        } },
                        new { categoryName = "Lights", subCategories = new JsArray {
                            new { subCategoryName = "Ceiling" },
                            new { subCategoryName = "Table" },
                            new { subCategoryName = "Floor" }
                        } }
                    },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        children = "subCategories"
                    }
                }
            });
            new jQuery("#treeview-left").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inlineDefault.As<JsArray>()
            });
            new jQuery("#treeview-right").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = inline.As<JsArray>(),
                dataTextField = new JsArray<JsString> { "categoryName", "subCategoryName" }.As<JsString>()
            });
        }
        protected override void SetupChart()
        {
            var treeMap = this.Chart as C1.Win.Chart.TreeMap;

            treeMap.Header.Content    = "Sales Distribution by Product";
            treeMap.Header.Style.Font = StyleInfo.ChartHeaderFont;

            treeMap.Binding            = "CurrentSales";
            treeMap.BindingName        = "Type";
            treeMap.ChildItemsPath     = "Items";
            treeMap.DataSource         = HierarchicalDataSource.GetTreeMapData();
            treeMap.MaxDepth           = 2;
            treeMap.DataLabel.Content  = "{name}";
            treeMap.DataLabel.Position = LabelPosition.Center;
        }
示例#12
0
        protected override void SetupChart()
        {
            var treeMap = this.Chart as C1.Win.Chart.TreeMap;

            treeMap.Header.Content    = "Sales Distribution by Product";
            treeMap.Header.Style.Font = StyleInfo.ChartHeaderFont;

            treeMap.DataSource             = HierarchicalDataSource.GetTreeMapData();
            treeMap.Binding                = "CurrentSales";
            treeMap.BindingName            = "Type";
            treeMap.ChildItemsPath         = "Items";
            treeMap.MaxDepth               = 2;
            treeMap.DataLabel.Style.Stroke = Brushes.White;
            treeMap.ToolTip.Content        = "Current Sales: {CurrentSales:C0}\nPrevious Sales: {PreviousSales:C0}";
            treeMap.NodeRendering         += _treeMap_NodeRendering;
        }
        protected override void SetupChart()
        {
            var sunburst = this.Chart as C1.Win.Chart.Sunburst;

            sunburst.Binding              = "Value";
            sunburst.BindingName          = "Year,Quarter,Month";
            sunburst.ChildItemsPath       = "Items";
            sunburst.DataLabel.Position   = PieLabelPosition.Center;
            sunburst.DataLabel.Content    = "{name}";
            sunburst.ToolTip.Content      = "{name} Sales : {value}\nShare : {P:0}%";
            sunburst.DataSource           = HierarchicalDataSource.GetSunburstData();
            sunburst.SelectionMode        = ChartSelectionMode.Point;
            sunburst.SelectedItemPosition = Position.Left;
            sunburst.SelectedItemOffset   = 0.2;
            sunburst.SelectedIndex        = 0;
            sunburst.Header.Content       = "Sales over the years";
            sunburst.Header.Style.Font    = StyleInfo.ChartHeaderFont;
            sunburst.Rendered            += (s, e) => { _udOffset.Value = (decimal)sunburst.SelectedItemOffset; };
        }
        protected override void SetupChart()
        {
            Queue <string> drilldownPath = new Queue <string>();

            drilldownPath.Enqueue("Year");
            drilldownPath.Enqueue("Country");

            var items = HierarchicalDataSource.GetFlatDataItems(500);

            manager              = new DrillDownManager(items, "Amount", "Year,Country");
            manager.BeforeDrill += Manager_BeforeDrill;
            manager.AfterDrill  += Manager_AfterDrill;
            //Triggers the AfterDrill event and update the chart as per the current DrillDownLevel
            manager.Refresh();

            //FlexChart settings
            flexChart1.BindingX = "Name";
            flexChart1.Binding  = "Value";
            flexChart1.Series.Add(new Series()
            {
                Name = "Value"
            });
            flexChart1.DataSource           = manager.CurrentItems.Views;
            flexChart1.DataLabel.Style.Font = new Font("Segoe UI", 9);
            flexChart1.DataLabel.Position   = C1.Chart.LabelPosition.Top;
            flexChart1.DataLabel.Content    = "{y:n0}";
            flexChart1.ToolTip.Active       = false;
            flexChart1.Header.Style.Font    = StyleInfo.ChartHeaderFont;
            flexChart1.MouseClick          += ChartMouseClick;

            //FlexPie settings
            _flexPie.BindingName        = "Name";
            _flexPie.Binding            = "Value";
            _flexPie.DataSource         = manager.CurrentItems.Views;
            _flexPie.DataLabel.Position = PieLabelPosition.Center;
            _flexPie.DataLabel.Content  = "{name} | {value:n0}";
            _flexPie.ToolTip.Content    = "{P:0}%";
            _flexPie.Header.Style.Font  = StyleInfo.ChartHeaderFont;
            _flexPie.MouseClick        += ChartMouseClick;
        }
示例#15
0
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As<JsObject>()["ProductID"].As<JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false

                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As<JsObject>()["CategoryID"].As<JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource = Categories.As<JsArray>(),
                dataTextField = new JsArray<JsString> { "CategoryName", "ProductName", "OrderID" }.As<JsString>()
            });
        }
示例#16
0
 private void SetHierarchicalData()
 {
     flexChart1.DataSource           = HierarchicalDataSource.GetFlatOrHierarchicalGDPData(false);
     flexChart1.AxisX.GroupNames     = "Continent";
     flexChart1.AxisX.GroupItemsPath = "Items";
 }
示例#17
0
        static void OnReady()
        {
            // TreeView bound to Categories > Products > OrderDetails
            var OrderDetails = new DataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As <JsObject>()["ProductID"].As <JsNumber>())
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenFunc = () => false
                    }
                }
            };

            var Products = new HierarchicalDataSourceConfiguration
            {
                type   = "odata",
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        id = "ProductID",
                        hasChildrenString = "Order_Details",
                        children          = OrderDetails
                    }
                },
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As <JsObject>()["CategoryID"].As <JsNumber>())
                    }
                }
            };

            var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration
            {
                type      = "odata",
                transport = new DataSourceTransportConfiguration
                {
                    read = new DataSourceTransportReadConfiguration
                    {
                        url = "http://demos.kendoui.com/service/Northwind.svc/Categories"
                    }
                },
                schema = new HierarchicalDataSourceSchemaConfiguration
                {
                    model = new HierarchicalDataSourceSchemaModelConfiguration
                    {
                        hasChildrenString = "Products",
                        id       = "CategoryID",
                        children = Products
                    }
                }
            });

            new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration
            {
                dataSource    = Categories.As <JsArray>(),
                dataTextField = new JsArray <JsString> {
                    "CategoryName", "ProductName", "OrderID"
                }.As <JsString>()
            });
        }