public DotHtmlTable SimpleTable(IEnumerable <KeyValuePair <string, IDotHtmlLabel> > tableContents) { var table = DotUtils.Table() .SetBorder(0); //Add a row with a single cell and port name for each entry table .AddRows( tableContents.Select( item => DotUtils.Cell() .SetContents(item.Value) .SetPort(item.Key) ) ); //Set common attributes of added cells foreach (var row in table.Skip(1)) { row.FirstCell .SetBorder(1) .SetSides(DotSides.Top); } return(table); }
private DotNode AddBasisBlades(AstFrame frame) { var innerTable = DotUtils.Table() .SetBorder(0); innerTable .AddRow() .AddCells("Grade", "Index", "ID", "Name", "Indexed Name", "Binary Name", "Grade + Index Name"); foreach (var cell in innerTable.FirstRow) { cell .SetBorder(1) .SetSides(DotSides.Top, DotSides.Bottom); } for (var grade = 0; grade <= frame.VSpaceDimension; grade++) { var n = frame.KvSpaceDimension(grade); for (var index = 0; index < n; index++) { var basisBlade = frame.BasisBlade(grade, index); innerTable .AddRow() .AddCells( basisBlade.Grade.ToString(), basisBlade.Index.ToString(), basisBlade.BasisBladeId.ToString(), basisBlade.Name, basisBlade.IndexedName, basisBlade.BinaryIndexedName, basisBlade.GradeIndexName ); } } var table = DotUtils.Table() .SetBorder(0); table.AddRows( DotUtils.Cell().SetContents("Basis Blades".Bold()), DotUtils.Cell().SetContents(innerTable) ); var node = Graph .AddNode("Basis Blades") .SetLabel(table); Graph.AddEdge("Inner Product Matrix", "Basis Blades"); return(node); }
public static DotGraph ToGraphViz(this GaNumMapBilinearTree bilinearMap, bool showFullGraph = false, bool showLeafValues = false) { var dotGraph = DotGraph.Directed("Graph"); dotGraph.AddQuadTree(bilinearMap.BasisBladesMapTree, showFullGraph); if (!showLeafValues) { return(dotGraph); } foreach (var leafPair in bilinearMap.BasisBladesMapTree.LeafValuePairs) { var dotHtmlTable = DotUtils.Table(); dotHtmlTable.SetBorder(0); dotHtmlTable.SetCellBorder(1); var dotHtmlRow = dotHtmlTable.AddRow(); var mv = leafPair.Item3; foreach (var term in mv.Terms) { var columnTable = DotUtils.Table(); columnTable.SetBorder(0); columnTable.SetCellBorder(0); columnTable.AddRow( term.Key.PatternToString(mv.VSpaceDimension).ToHtmlString() ); columnTable.AddRow(term.Value.ToString("G")); dotHtmlRow.AddCell(columnTable); } var parentNodeName = leafPair.Item1.PatternToString(bilinearMap.DomainVSpaceDimension) + ", " + leafPair.Item2.PatternToString(bilinearMap.DomainVSpaceDimension); var node = dotGraph.AddNode("coef" + parentNodeName); node.SetLabel(dotHtmlTable); node.SetShape(DotNodeShape.Note); node.SetStyle(DotNodeStyle.Solid); node.SetColor(DotColor.Rgb(Color.Black)); node.SetFontColor(DotColor.Rgb(Color.Black)); var dotEdge = node.AddEdgeFrom(parentNodeName); dotEdge.SetArrowHead(DotArrowType.Inv); dotEdge.SetArrowTail(DotArrowType.Inv); dotEdge.SetStyle(DotEdgeStyle.Solid); dotEdge.SetColor(DotColor.Rgb(Color.Black)); dotEdge.SetFontColor(DotColor.Rgb(Color.Black)); } return(dotGraph); }
private void AddStatistics() { var statsTable = DotUtils.Table() .SetCellBorder(1) .SetBorder(0); var stats = CodeBlock.GetStatistics(); var flag = false; foreach (var pair in stats) { var row = statsTable.AddRow(pair.Key, pair.Value); if (flag) { row[0].SetSides(DotSides.Top); row[1].SetSides(DotSides.Top); } else { row[0].SetBorder(0); row[1].SetBorder(0); flag = true; } row[0].SetAlign(DotAlign.Right); row[1].SetAlign(DotAlign.Left); } var colorsTable = GetColorsTable(); var finalTable = DotUtils.Table() .SetCellBorder(1) .SetBorder(0); finalTable .AddRow() .AddCells(statsTable, colorsTable); Graph .AddNode("Statistics") .SetFontSize(11) .SetLabel(finalTable) .SetFontName("Consolas") .SetFillColor(Color.White.ToDotRgbColor()) .SetShape(DotNodeShape.Rectangle) .SetStyle(DotNodeStyle.Bold, DotNodeStyle.Rounded, DotNodeStyle.Filled); }
public DotHtmlTable Table(string iconName, IDotHtmlLabel titleContents) { var table = DotUtils.Table() .SetBorder(0); table.AddRow( DotUtils.ImageCell(Path.Combine(IconsPath, iconName + "64.png")), DotUtils.Cell().SetContents(titleContents) ); return(table); }
private DotHtmlTable GetColorsTable() { var dict = new Dictionary <int, Tuple <int, int> >(); for (var i = 0; i <= MaxLevels; i++) { var colorNum = GetEdgeColorIndex(i); Tuple <int, int> range; if (dict.TryGetValue(colorNum, out range) == false) { dict.Add(colorNum, new Tuple <int, int>(i, i)); } else { if (i < range.Item1) { dict[colorNum] = new Tuple <int, int>(i, range.Item2); } else if (i > range.Item2) { dict[colorNum] = new Tuple <int, int>(range.Item1, i); } } } var colorsTable = DotUtils.Table() .SetCellBorder(1) .SetBorder(0); foreach (var pair in dict) { colorsTable .AddRow() .AddCell( pair.Value.Item1 == pair.Value.Item2 ? pair.Value.Item1.ToString() : (pair.Value.Item1 + " : " + pair.Value.Item2) ) .SetBackgroundColor( ColorTemplate[ColorTemplate.MaxColors][pair.Key] ); } return(colorsTable); }
public DotHtmlTable SimpleTable(IEnumerable <string> tableContents) { var table = DotUtils.Table() .SetBorder(0); //Add a row with a single cell for each entry table.AddRows(tableContents); //Set common attributes of added cells foreach (var row in table.Skip(1)) { row.FirstCell .SetBorder(1) .SetSides(DotSides.Top); } return(table); }
private DotNode AddIpm(AstFrame frame) { var innerTable = DotUtils.Table() .AddRows(frame.VSpaceDimension + 1, frame.VSpaceDimension + 1) .SetBorder(0); var vectorsNames = frame.BasisVectors.Select(item => item.Name).ToArray(); var ipm = frame.GetInnerProductMatrix(); for (var row = 0; row < frame.VSpaceDimension; row++) { innerTable[row + 1][0].SetContents(vectorsNames[row]); innerTable[0][row + 1].SetContents(vectorsNames[row]); for (var col = 0; col < frame.VSpaceDimension; col++) { innerTable[row + 1][col + 1].SetContents(ipm[row, col].ToString()); } } var table = DotUtils.Table() .SetBorder(0); table.AddRows( DotUtils.Cell().SetContents("Inner Product Matrix".Bold()), DotUtils.Cell().SetContents(innerTable) ); var node = Graph .AddNode("Inner Product Matrix") .SetLabel(table); Graph.AddEdge(frame.AccessName, node.NodeName); return(node); }