protected void DoTree(TreeNode parent, RCCube right, ref double a, ref double g) { if (right.Axis.ColCount > 1) { // throw new NotImplementedException ("Cannot handle time cols on cubes yet."); // But we will still handle them as if the time col didn't exist. } if (right.Axis.Symbol != null) { Dictionary <RCSymbolScalar, TreeNode> map = new Dictionary <RCSymbolScalar, TreeNode> (); for (int i = 0; i < right.Cols; ++i) { string colName = right.ColumnAt(i); TreeNode colNode = new TreeNode(parent, colName, i); colNode.v = colName; colNode.n = 0; ColumnBase col = right.GetColumn(i); bool numeric = typeof(long).IsAssignableFrom(col.GetElementType()); for (int j = 0; j < col.Count; ++j) { RCSymbolScalar symbol = right.Axis.SymbolAt(col.Index[j]); TreeNode rowNode = new TreeNode(colNode, symbol.Key.ToString(), col.Index[j]); object box = col.BoxCell(j); if (numeric) { rowNode.n = (long)box; rowNode.m = (long)box; rowNode.g = Math.Abs((long)box); } else { rowNode.n = 1; rowNode.m = 1; rowNode.g = 1; } rowNode.v = box.ToString(); colNode.n += rowNode.n; colNode.g += Math.Abs(rowNode.n); map[rowNode.s] = rowNode; } a += colNode.n; g += Math.Abs(colNode.g); } } else { for (int i = 0; i < right.Cols; ++i) { string colName = right.ColumnAt(i); TreeNode colNode = new TreeNode(parent, colName, i); colNode.v = colName; colNode.n = 0; ColumnBase col = right.GetColumn(i); bool numeric = typeof(long).IsAssignableFrom(col.GetElementType()); for (int j = 0; j < right.Count; ++j) { TreeNode rowNode = new TreeNode(colNode, null, col.Index[j]); object box = col.BoxCell(j); if (numeric) { rowNode.n = (long)box; rowNode.m = (long)box; rowNode.g = Math.Abs((long)box); } else { rowNode.n = 1; rowNode.m = 1; rowNode.g = 1; } rowNode.v = box.ToString(); colNode.n += rowNode.n; colNode.g += Math.Abs(rowNode.n); } a += colNode.n; g += Math.Abs(colNode.g); } } }
protected void DoChart(RCCube result, RCSymbolScalar name, ref long row, long col, RCCube cube) { for (int i = 0; i < cube.Cols; ++i) { string colname = cube.NameAt(i); ColumnBase data = cube.GetColumn(i); RCSymbolScalar cell = RCSymbolScalar.From(row, (long)col, 0L); RCSymbolScalar parent = new RCSymbolScalar(name, colname); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, parent); result.WriteCell("v", cell, colname); result.Write(cell); for (int j = 0; j < data.Count; ++j) { string val = data.BoxCell(j).ToString(); cell = RCSymbolScalar.From(row, (long)col + data.Index[j] + 1, 0L); RCSymbolScalar child = new RCSymbolScalar(parent, (long)j); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col + data.Index[j] + 1); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, child); result.WriteCell("v", cell, val); result.Write(cell); } ++row; } if (cube.Axis.Global != null) { RCSymbolScalar cell = RCSymbolScalar.From(row, col, 0L); RCSymbolScalar parent = new RCSymbolScalar(name, "G"); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, parent); result.WriteCell("v", cell, "G"); result.Write(cell); for (int i = 0; i < cube.Axis.Global.Count; ++i) { string val = cube.Axis.Global[i].ToString(); cell = RCSymbolScalar.From(row, col + i + 1, 0L); RCSymbolScalar child = new RCSymbolScalar(parent, (long)i); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col + i + 1); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, child); result.WriteCell("v", cell, val); result.Write(cell); } ++row; } if (cube.Axis.Event != null) { RCSymbolScalar cell = RCSymbolScalar.From(row, col, 0L); RCSymbolScalar parent = new RCSymbolScalar(name, "E"); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, parent); result.WriteCell("v", cell, "E"); result.Write(cell); for (int i = 0; i < cube.Axis.Event.Count; ++i) { string val = cube.Axis.Event[i].ToString(); cell = RCSymbolScalar.From(row, col + i + 1, 0L); RCSymbolScalar child = new RCSymbolScalar(parent, (long)i); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col + i + 1); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, child); result.WriteCell("v", cell, val); result.Write(cell); } ++row; } if (cube.Axis.Time != null) { RCSymbolScalar cell = RCSymbolScalar.From(row, col, 0L); RCSymbolScalar parent = new RCSymbolScalar(name, "T"); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, parent); result.WriteCell("v", cell, "T"); result.Write(cell); for (int i = 0; i < cube.Axis.Time.Count; ++i) { string val = cube.Axis.Time[i].ToString(); cell = RCSymbolScalar.From(row, col + i + 1, 0L); RCSymbolScalar child = new RCSymbolScalar(parent, (long)i); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col + i + 1); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, child); result.WriteCell("v", cell, val); result.Write(cell); } ++row; } if (cube.Axis.Symbol != null) { RCSymbolScalar cell = RCSymbolScalar.From(row, col, 0L); RCSymbolScalar parent = new RCSymbolScalar(name, "S"); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, parent); result.WriteCell("v", cell, "S"); result.Write(cell); for (int i = 0; i < cube.Axis.Symbol.Count; ++i) { string val = cube.Axis.Symbol[i].ToString(); cell = RCSymbolScalar.From(row, col + i + 1, 0L); RCSymbolScalar child = new RCSymbolScalar(parent, (long)i); result.WriteCell("r", cell, (long)row); result.WriteCell("c", cell, (long)col + i + 1); result.WriteCell("l", cell, 0L); result.WriteCell("k", cell, child); result.WriteCell("v", cell, val); result.Write(cell); } ++row; } }