Esempio n. 1
0
        private static void ColorizerExample()
        {
            const int  nodeCount = 20;
            SimpleNode root      = new SimpleNode()
            {
                Content = $"Node {nodeCount.ToString("0")}",
                Metric  = nodeCount,
            };

            root = AppendChildren(root, nodeCount);

            FlameGraph newGraph = new FlameGraph(new FlameGraphOptions()
            {
                Title  = "Hello Flame Graph",
                Width  = 800,
                Height = 600,
                FrameBackgroundProvider = node =>
                {
                    if (node.Metric > 10)
                    {
                        return(Color.OrangeRed);
                    }
                    return(Color.DarkOrange);
                },
            });

            string fileName = Path.Combine("Examples", nameof(ColorizerExample) + ".svg");

            DeleteFileWhenExists(fileName);
            newGraph.BuildTo(root, fileName);
        }
Esempio n. 2
0
        private static void SimpleNodeExample()
        {
            const int  nodeCount = 20;
            SimpleNode root      = new SimpleNode()
            {
                Content = $"Node {nodeCount.ToString("0")}",
                Metric  = nodeCount,
            };

            root = AppendChildren(root, nodeCount);

            FlameGraph newGraph = new FlameGraph(new FlameGraphOptions()
            {
                Title  = "Hello Flame Graph",
                Width  = 800,
                Height = 600,
            });

            string fileName = Path.Combine("Examples", nameof(SimpleNodeExample) + ".svg");

            DeleteFileWhenExists(fileName);
            newGraph.BuildTo(root, fileName);
        }