public void ChildColours(NodeDto nodes, int checkins) { //var rootCheckins = checkins; if (nodes.children == null) return; foreach (var child in nodes.children) { var colours = new ColourConverter(); child.data.colourHex = colours.GetColour(checkins, child.data.checkins).Substring(2, 6); child.data.percentage = ParaCalculator(checkins, child.data.checkins, 5.5)*150; //Math.Pow(((child.data.checkins / (double)checkins)), 1.0 / 5.5)*150; ChildColours(child, checkins); } }
public void CullNodes(NodeDto node, int checkins) { if (node != null && node.children != null) { foreach (var child in node.children) { child.children = child.children .Where(n => n.data.checkins >= checkins) .OrderBy(n => n.data.checkins) .ToList(); CullNodes(child, checkins); } } }
public void AddFile(SourceItemDto file) { var parts = file.Path.Split('/'); var depth = parts.Length; //sets root to first segment of file path if (Root == null) { Root = new NodeDto { name = parts[2], id = NodeCount++.ToString(CultureInfo.InvariantCulture) }; } var currentNode = Root; //Start at 2 to always skip '$/reed' and the root for (var i = 3; i < depth; i++) { var existingNode = currentNode.children.FirstOrDefault(n => n.name == parts[i]); if (existingNode == null) { var newNode = new NodeDto { id = NodeCount++.ToString(CultureInfo.InvariantCulture), name = parts[i], //FullPath = file.Path, //IsFile = Path.GetExtension(parts[i]).Length > 0 }; newNode.data.checkins = file.NumChanges; currentNode.children.Add(newNode); currentNode = newNode; } else { currentNode = existingNode; currentNode.data.checkins += file.NumChanges; } } }