public static void GeneratePlotData(List <CategoryNode> rootNodes, out List <IntervalBarSeries> allSeries, out List <string> labels, out List <double> gridLines) { double linePos = 0.0; int fullIndex = 0; int palleteIndex = 0; allSeries = new List <IntervalBarSeries>(); labels = new List <string>(); gridLines = new List <double>(); if (rootNodes != null) { for (int i = 0; i < rootNodes.Count; i++) { CategoryNode root = rootNodes[i]; root.SetSeriesData(fullIndex++, pallete[palleteIndex]); allSeries.Add(root.Series); labels.Add(root.Name); gridLines.Add(linePos++); Stack <CategoryNode> subtree = new Stack <CategoryNode>(root.Children); while (subtree.Count != 0) { CategoryNode subNode = subtree.Pop(); subNode.SetSeriesData(fullIndex++, pallete[palleteIndex]); allSeries.Add(subNode.Series); labels.Add(subNode.Name); gridLines.Add(linePos++); foreach (CategoryNode child in subNode.Children) { subtree.Push(child); } } if (i < rootNodes.Count - 1) { palleteIndex = (palleteIndex + 1) % pallete.Length; linePos++; fullIndex++; labels.Add(""); } } } }
public CategoryNode(string name, CategoryNode parent) : this(name) { this.Parent = parent; Series.BarWidth = 0.35; parent.Children.Add(this); }