Page Tree
Other Releases
...
After setting up the tables and queries that you will use, you need to configure one of the tables as the DataSource in the DataGridWindow configuration (1 in image below).
To manipulate a DataGrid control in CodeBehind, the best approach is to use the Control Name field (2 in image below) , for the configuration dialog.
...
Note |
---|
A delegate will only call a method which that agrees with its signature and return type. A method can be either a static method associated with a class, or it can be an instance method associated with an object. |
...
Code Block |
---|
Dictionary<int, ArgumentValue[]> mapEmployeeToOrders = null; private ArgumentValue[] SparklineCollectionDelegate(string fieldName, System.Data.DataRow row) { ArgumentValue[] sourceCollection; int emplID = TK.To< int>(row["EmployeeID"]); if (!this.mapEmployeeToOrders.TryGetValue(emplID, out sourceCollection)) sourceCollection = new ArgumentValue[0]; return sourceCollection; } |
The Sparkline A sparkline is updated following the logic seen in the sample code below:
Code Block |
---|
// Get data from tables // DataTable employees = @Dataset.Table.Employees.SelectCommand(); DataTable orders = @Dataset t.Table.Orders.SelectCommand(); DataTable invoices = @Dataset.Query.Invoices.SelectCommand(); // // this.SetSparkline(style); // Set Style to Sparkline this.mapEmployeeToOrders = new Dictionary<int, ArgumentValue[]>(); foreach (DataRow empl in employees.Rows) { int emplID = TK.To<int>(empl["EmployeeID"]); ist<ArgumentValue> sourceCollection = new List<ArgumentValue>(); foreach (DataRow order in orders.Select("EmployeeID = " + emplID)) { int orderID = TK.To< int>(order["OrderID"]); ArgumentValue av = new ArgumentValue(); av.Argument = order["OrderDate"]; // x-axis for sparkline foreach (DataRow invoice in invoices.Select("OrderID = " + orderID)) { double value = TK.To< double >(av.Value); double quantity = TK.To< double >(invoice["Quantity"]); double unitPrice = TK.To< double >(invoice["UnitPrice"]); av.Value = value + (quantity * unitPrice); // y-axis for sparkline } sourceCollection.Add(av); } // map values (y-axis) and order date (x-axis) to employee ID this.mapEmployeeToOrders[emplID] = sourceCollection.ToArray(); } |
The styles available for Sparkline styles are:
Note |
---|
Values are represented by bars that either grow up or grow down from an invisible line. |
...