Esempio n. 1
0
            /// <summary>
            /// Draw this series on the view
            /// </summary>
            public void DrawOnView(IGraphView graphView)
            {
                if (series.Type == Series.SeriesType.Line)
                {
                    series.Type = Series.SeriesType.Scatter;
                }

                string title = Title;

                if (series.Title != null && !series.Title.StartsWith("Series") && numSeries == 1)
                {
                    title = series.Title;
                }

                if (!graph.DisabledSeries.Contains(title))
                {
                    // Create the series and populate it with data.
                    if (series.Type == Models.Graph.Series.SeriesType.Bar)
                    {
                        graphView.DrawBar(title, X, Y, series.XAxis, series.YAxis, Colour, series.ShowInLegend);
                    }

                    else if (series.Type == Series.SeriesType.Scatter)
                    {
                        graphView.DrawLineAndMarkers(title, X, Y, series.XAxis, series.YAxis, Colour,
                                                     series.Line, series.Marker, series.ShowInLegend);
                    }
                    else if (X2 != null && Y2 != null)
                    {
                        graphView.DrawArea(title, X, Y, X2, Y2, series.XAxis, series.YAxis, Colour, series.ShowInLegend);
                    }
                }
            }
Esempio n. 2
0
        void InitGraph()
        {
            graph = GraphBuilder <T, P> .Build(seedEntities, graphBackend.GetRelations, builderRNG, Settings.Instance.maxGraphNodes);

            if (graph == null)
            {
                return;
            }

            // delay the view construction, so this.drawRect can be set before that runs.
            Exec(() => view = new IMView <T, P>(graph, this));

            // run layout, unless the user wants to use caches and a cache could be loaded
            bool runLayout = Settings.Instance.cacheLayouts ?
                             !GraphPosSerialization.LoadGraphLayout(graph, seedEntities, graphBackend.GetDecoratedType()) :
                             true;

            if (runLayout)
            {
                layoutRunning = true;
                // make the view focus on the initial graph unfolding
                adjustTransformMode = AdjustTransformMode.Instant;
                Exec(DoAutoLayout);
            }
        }
Esempio n. 3
0
        public override void Draw(IGraphView graph)
        {
            switch (DatePeriod)
            {
            case DatePeriod.DAY:
                graph.XAxisTitle = "Days";
                break;

            case DatePeriod.WEEK:
                graph.XAxisTitle = "Weeks";
                break;

            case DatePeriod.MONTH:
                graph.XAxisTitle = "Months";
                break;

            case DatePeriod.QUARTER:
                graph.XAxisTitle = "Quarters";
                break;

            case DatePeriod.YEAR:
                graph.XAxisTitle = "Years";
                break;
            }
            graph.XAxisDayScale  = true;
            graph.XAxisFontAngle = 90;

            base.Draw(graph);
        }
Esempio n. 4
0
        /// <summary>Attach the model to the view.</summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">The explorer presenter.</param>
        /// <param name="cache">Cached definitions to be used.</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter, List <SeriesDefinition> cache)
        {
            this.graph             = model as Graph;
            this.graphView         = view as GraphView;
            this.explorerPresenter = explorerPresenter;

            graphView.OnAxisClick       += OnAxisClick;
            graphView.OnLegendClick     += OnLegendClick;
            graphView.OnCaptionClick    += OnCaptionClick;
            graphView.OnHoverOverPoint  += OnHoverOverPoint;
            graphView.OnAnnotationClick += OnAnnotationClick;
            explorerPresenter.CommandHistory.ModelChanged += OnGraphModelChanged;
            this.graphView.AddContextAction("Copy graph to clipboard", CopyGraphToClipboard);
            this.graphView.AddContextOption("Include in auto-documentation?", IncludeInDocumentationClicked, graph.IncludeInDocumentation);

            if (cache == null)
            {
                DrawGraph();
            }
            else
            {
                SeriesDefinitions = cache;
                DrawGraph(cache);
            }
        }
Esempio n. 5
0
        public virtual void Draw(IGraphView graph)
        {
            graph.Title = Title;
            switch (Type)
            {
            case VisualizationType.POINTS:
                graph.ShowPoints(Legend, x, y);
                break;

            case VisualizationType.LINE:
                graph.ShowLine(Legend, x, y);
                break;

            case VisualizationType.LINEWITHPOINTS:
                graph.ShowLineWithPoints(Legend, x, y);
                break;

            case VisualizationType.HISTOGRAM:
                graph.ShowHistogram(Legend, x, y);
                break;

            default:
                break;
            }
        }
Esempio n. 6
0
        public void WriteGv(IGraphView graph)
        {
            graph.BeginDigraph("LRFSM");
            //graph.SetGraphProperties(RankDir.LeftToRight);

            int stateCount = automata.States.Count;

            foreach (var state in automata.States)
            {
                graph.AddNode(state.Index, shape: Shape.Mrecord, label: StateToHtml(state.Index));
            }

            foreach (var state in automata.States)
            {
                foreach (var transition in state.Transitions)
                {
                    foreach (var action in transition.Actions)
                    {
                        if (action.Kind == ParserActionKind.Shift)
                        {
                            graph.AddEdge(state.Index, action.State, grammar.Symbols[transition.Token].Name);
                        }
                    }
                }
            }

            graph.EndDigraph();
        }
Esempio n. 7
0
        public void WriteGv(IGraphView graph)
        {
            graph.BeginDigraph("LRFSM");
            //graph.SetGraphProperties(RankDir.LeftToRight);

            int stateCount = automata.States.Count;

            foreach (var state in automata.States)
            {
                graph.AddNode(state.Index, shape: Shape.Mrecord, label: StateToHtml(state.Index));
            }

            foreach (var state in automata.States)
            {
                foreach (var transition in state.Transitions)
                {
                    foreach (var action in transition.Actions)
                    {
                        if (action.Kind == ParserActionKind.Shift)
                        {
                            graph.AddEdge(state.Index, action.State, grammar.Symbols[transition.Token].Name);
                        }
                    }
                }
            }

            graph.EndDigraph();
        }
Esempio n. 8
0
 public SppfGraphWriter(Grammar grammar, IGraphView graph, bool showRules)
 {
     this.grammar   = grammar;
     this.graph     = graph;
     this.visited   = new HashSet <SppfNode>();
     this.front     = new Stack <SppfNode>();
     this.showRules = showRules;
 }
 public SppfGraphWriter(Grammar grammar, IGraphView graph, bool showRules)
 {
     this.grammar   = grammar;
     this.graph     = graph;
     this.visited   = new HashSet<SppfNode>();
     this.front     = new Stack<SppfNode>();
     this.showRules = showRules;
 }
Esempio n. 10
0
 private void CreateView()
 {
     _view = EditorApplication.isPlayingOrWillChangePlaymode ? (IGraphView) new SleipnirGraphViewPlaymode() : new SleipnirGraphViewEditmode();
     if (_view is VisualElement element)
     {
         rootVisualElement.Add(element);
         element.StretchToParentSize();
     }
 }
Esempio n. 11
0
 public GraphPresenter(IGraphView view, int maxVertices = 25)
 {
     if (maxVertices < 2)
     {
         throw new ArgumentOutOfRangeException();
     }
     _view          = view;
     _reservedGraph = null;
     MaxVertices    = maxVertices;
 }
 public override void Draw(IGraphView graph)
 {
     graph.PrepairPointsForDateScale(x, dates[0]);
     graph.YAxisTitle = "Commits";
     foreach (var y in yByAuthor)
     {
         Legend = y.Key;
         this.y = y.Value;
         base.Draw(graph);
     }
 }
Esempio n. 13
0
 public override void Draw(IGraphView graph)
 {
     graph.YAxisTitle = "Probability";
     if (ShowProbabilityDistribution)
     {
         base.Draw(graph);
     }
     if (ShowProbabilityDensity)
     {
         graph.ShowHistogram("", densityX, densityY);
     }
 }
Esempio n. 14
0
        public override void Draw(IGraphView graph)
        {
            graph.PrepairPointsForDateScale(x, dates[0]);
            graph.YAxisTitle = "Defect density (defects per KLOC)";

            Legend = "Traditional defect density";
            this.y = tdd;
            base.Draw(graph);

            Legend = "Alternative defect density";
            this.y = dd;
            base.Draw(graph);
        }
Esempio n. 15
0
        public override void Draw(IGraphView graph)
        {
            graph.PrepairPointsForDateScale(x, dates[0]);
            graph.YAxisTitle = "Defect density (defects per KLOC)";

            Legend = "Traditional defect density";
            this.y = tdd;
            base.Draw(graph);

            Legend = "Alternative defect density";
            this.y = dd;
            base.Draw(graph);
        }
Esempio n. 16
0
 public void Load(Type type, IBehavior behavior, UnityEngine.Object target)
 {
     if (behavior == null)
     {
         Close();
     }
     this.m_TargetObject = target;
     this.m_Behavior     = behavior;
     this.m_GraphView    = Activator.CreateInstance(type, this, behavior.GetGraph(), this.m_TargetObject) as IGraphView;
     EditorUtility.SetDirty(this);
     this.titleContent = new GUIContent(ObjectNames.NicifyVariableName(behavior.GetGraph().GetType().Name) + " Editor");
     this.m_GraphView.CenterGraphView();
     Repaint();
 }
Esempio n. 17
0
        /// <summary>Attach the model to the view.</summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">The explorer presenter.</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.graph             = model as Graph;
            this.graphView         = view as GraphView;
            this.explorerPresenter = explorerPresenter;

            graphView.OnAxisClick      += OnAxisClick;
            graphView.OnLegendClick    += OnLegendClick;
            graphView.OnCaptionClick   += OnCaptionClick;
            graphView.OnHoverOverPoint += OnHoverOverPoint;
            explorerPresenter.CommandHistory.ModelChanged += OnGraphModelChanged;
            this.graphView.AddContextAction("Copy graph to clipboard", false, CopyGraphToClipboard);
            this.graphView.AddContextAction("Include in auto-documentation?", graph.IncludeInDocumentation, IncludeInDocumentationClicked);
            DrawGraph();
        }
Esempio n. 18
0
        /// <summary>Attach the model to the view.</summary>
        /// <param name="model">The model.</param>
        /// <param name="view">The view.</param>
        /// <param name="explorerPresenter">The explorer presenter.</param>
        public void Attach(object model, object view, ExplorerPresenter explorerPresenter)
        {
            this.graph = model as Graph;
            this.graphView = view as GraphView;
            this.explorerPresenter = explorerPresenter;

            graphView.OnAxisClick += OnAxisClick;
            graphView.OnLegendClick += OnLegendClick;
            graphView.OnCaptionClick += OnCaptionClick;
            graphView.OnHoverOverPoint += OnHoverOverPoint;
            explorerPresenter.CommandHistory.ModelChanged += OnGraphModelChanged;
            this.graphView.AddContextAction("Copy graph to clipboard", false, CopyGraphToClipboard);
            this.graphView.AddContextAction("Include in auto-documentation?", graph.IncludeInDocumentation, IncludeInDocumentationClicked);
            DrawGraph();
        }
Esempio n. 19
0
        public override void SetUp()
        {
            base.SetUp();
            visualization = new CodeSizeToDate();
            visualization.DatePeriod = DatePeriod.DAY;
            graphStub = MockRepository.GenerateStub<IGraphView>();
            graphStub.Stub(x => x.ShowLineWithPoints(null, null, null))
                .IgnoreArguments()
                .Callback(new Func<string,double[],double[],bool>((l,x,y) =>
                {
                    this.x = x;
                    this.y = y;

                    return true;
                }));
        }
Esempio n. 20
0
        public override void SetUp()
        {
            base.SetUp();
            visualization            = new CodeSizeToDate();
            visualization.DatePeriod = DatePeriod.DAY;
            graphStub = MockRepository.GenerateStub <IGraphView>();
            graphStub.Stub(x => x.ShowLineWithPoints(null, null, null))
            .IgnoreArguments()
            .Callback(new Func <string, double[], double[], bool>((l, x, y) =>
            {
                this.x = x;
                this.y = y;

                return(true);
            }));
        }
Esempio n. 21
0
        /// <summary>
        /// Add regression line and stats to graph
        /// </summary>
        /// <param name="graphView">The graph to add line and stats to</param>
        /// <param name="stats">The regression stats</param>
        /// <param name="xAxis">The associated x axis</param>
        /// <param name="yAxis">The associated y axis</param>
        /// <param name="colour">The color to use</param>
        /// <param name="seriesIndex">The series index</param>
        private static void AddRegressionToGraph(IGraphView graphView,
                                                 MathUtilities.RegrStats stats,
                                                 Axis.AxisType xAxis, Axis.AxisType yAxis,
                                                 Color colour,
                                                 int seriesIndex)
        {
            if (stats != null)
            {
                double minimumX = graphView.AxisMinimum(xAxis);
                double maximumX = graphView.AxisMaximum(xAxis);
                double minimumY = graphView.AxisMinimum(yAxis);
                double maximumY = graphView.AxisMaximum(yAxis);

                double[] regressionX = new double[] { minimumX, maximumX };
                double[] regressionY = new double[] { stats.m *minimumX + stats.c, stats.m *maximumX + stats.c };
                graphView.DrawLineAndMarkers("", regressionX, regressionY,
                                             xAxis, yAxis, colour,
                                             Series.LineType.Solid, Series.MarkerType.None, true);

                // Show the 1:1 line
                double   lowestAxisScale  = Math.Min(minimumX, minimumY);
                double   largestAxisScale = Math.Max(maximumX, maximumY);
                double[] oneToOne         = new double[] { lowestAxisScale, largestAxisScale };
                graphView.DrawLineAndMarkers("", oneToOne, oneToOne,
                                             xAxis, yAxis, colour,
                                             Series.LineType.Dash, Series.MarkerType.None, true);

                // Draw the equation.
                double interval  = (largestAxisScale - lowestAxisScale) / 13;
                double yPosition = largestAxisScale - seriesIndex * interval;

                string equation = string.Format("y = {0:F2} x + {1:F2}, r2 = {2:F2}, n = {3:F0}\r\n" +
                                                "NSE = {4:F2}, ME = {5:F2}, MAE = {6:F2}\r\n" +
                                                "RSR = {7:F2}, RMSD = {8:F2}",
                                                new object[] { stats.m,
                                                               stats.c,
                                                               stats.R2,
                                                               stats.n,
                                                               stats.NSE,
                                                               stats.ME,
                                                               stats.MAE,
                                                               stats.RSR,
                                                               stats.RMSD });
                graphView.DrawText(equation, lowestAxisScale, yPosition, xAxis, yAxis, colour);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Attach the model to the view.
        /// </summary>
        public void Attach(object Model, object View, ExplorerPresenter explorerPresenter)
        {
            Graph             = Model as Graph;
            GraphView         = View as GraphView;
            ExplorerPresenter = explorerPresenter;

            GraphView.OnAxisClick      += OnAxisClick;
            GraphView.OnPlotClick      += OnPlotClick;
            GraphView.OnLegendClick    += OnLegendClick;
            GraphView.OnTitleClick     += OnTitleClick;
            GraphView.OnCaptionClick   += OnCaptionClick;
            GraphView.OnHoverOverPoint += OnHoverOverPoint;
            ExplorerPresenter.CommandHistory.ModelChanged += OnGraphModelChanged;
            this.GraphView.AddContextAction("Copy graph XML to clipboard", CopyGraphXML);

            // Connect to a datastore.
            DataStore = new Models.DataStore(Graph);

            DrawGraph();
        }
        public override void Draw(IGraphView graph)
        {
            var points = graph.Points.Last();

            var r = GetRegression();
            r.Train(points.Key, points.Value);

            double x1 = points.Key.Min();
            double x2 = points.Key.Max();
            double delta = (x2 - x1) / Intervals;
            x = new double[Intervals];
            y = new double[Intervals];
            for (int i = 0; i < Intervals; i++)
            {
                x[i] = x1;
                y[i] = r.Predict(x1);
                x1 += delta;
            }

            graph.ShowLine("", x, y);
        }
Esempio n. 24
0
        public override void Draw(IGraphView graph)
        {
            var points = graph.Points.Last();

            var r = GetRegression();

            r.Train(points.Key, points.Value);

            double x1    = points.Key.Min();
            double x2    = points.Key.Max();
            double delta = (x2 - x1) / Intervals;

            x = new double[Intervals];
            y = new double[Intervals];
            for (int i = 0; i < Intervals; i++)
            {
                x[i] = x1;
                y[i] = r.Predict(x1);
                x1  += delta;
            }

            graph.ShowLine("", x, y);
        }
Esempio n. 25
0
        public void DescribeGraph(IGraphView view)
        {
            var data = this;

            view.BeginDigraph("tdfa");

            view.SetGraphProperties(rankDir: RankDir.LeftToRight);
            foreach (var S in data.EnumerateStates())
            {
                GraphColor color = S.IsNewline ? GraphColor.Green : GraphColor.Default;
                if (S.IsAccepting)
                {
                    view.AddNode(S.Index, GetStateName(S), style: Style.Bold, color: color);
                }
                else
                {
                    view.AddNode(S.Index, GetStateName(S), color: color);
                }
            }

            foreach (var S in data.EnumerateStates())
            {
                foreach (var t in S.Outgoing)
                {
                    var charSet = data.Alphabet.Decode(t.Symbols);
                    view.AddEdge(t.From, t.To, charSet.ToCharSetString());
                }

                if (S.Tunnel >= 0)
                {
                    view.AddEdge(S.Index, S.Tunnel, style: Style.Dotted);
                }
            }

            view.EndDigraph();
        }
Esempio n. 26
0
 public virtual void Draw(IGraphView graph)
 {
     graph.Title = Title;
     switch (Type)
     {
         case VisualizationType.POINTS:
             graph.ShowPoints(Legend, x, y);
             break;
         case VisualizationType.LINE:
             graph.ShowLine(Legend, x, y);
             break;
         case VisualizationType.LINEWITHPOINTS:
             graph.ShowLineWithPoints(Legend, x, y);
             break;
         case VisualizationType.HISTOGRAM:
             graph.ShowHistogram(Legend, x, y);
             break;
         default:
             break;
     }
 }
Esempio n. 27
0
 public override void Draw(IGraphView graph)
 {
     graph.PrepairPointsForDateScale(x, dates[0]);
     graph.YAxisTitle = "LOC";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Commit size (LOC)";
     graph.YAxisTitle = "Defect density (defects per KLOC)";
     base.Draw(graph);
 }
        public override void Draw(IGraphView graph)
        {
            switch (DatePeriod)
            {
                case DatePeriod.DAY:
                    graph.XAxisTitle = "Days";
                    break;
                case DatePeriod.WEEK:
                    graph.XAxisTitle = "Weeks";
                    break;
                case DatePeriod.MONTH:
                    graph.XAxisTitle = "Months";
                    break;
                case DatePeriod.QUARTER:
                    graph.XAxisTitle = "Quarters";
                    break;
                case DatePeriod.YEAR:
                    graph.XAxisTitle = "Years";
                    break;
            }
            graph.XAxisDayScale = true;
            graph.XAxisFontAngle = 90;

            base.Draw(graph);
        }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "File size in LOC";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Commit size in LOC";
     base.Draw(graph);
 }
Esempio n. 32
0
 public override void Draw(IGraphView graph)
 {
     graph.PrepairPointsForDateScale(x, dates[0]);
     graph.YAxisTitle = "LOC";
     base.Draw(graph);
 }
Esempio n. 33
0
 public override void Draw(IGraphView graph)
 {
     graph.YAxisTitle = "Probability";
     if (ShowProbabilityDistribution)
     {
         base.Draw(graph);
     }
     if (ShowProbabilityDensity)
     {
         graph.ShowHistogram("", densityX, densityY);
     }
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Removed to added code";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Days";
     base.Draw(graph);
 }
Esempio n. 36
0
        public void WriteGraph(IGraphView view, RuntimeGrammar grammar, int[] stateToSymbol)
        {
            var allAccessibleByLayer = GetAllNodes().GroupBy(state => state.Layer);

            var layers = Enumerable
                         .Range(0, currentLayer + 1)
                         .Select(i => new List <GssNode <T> >(2))
                         .ToList();

            foreach (var group in allAccessibleByLayer)
            {
                layers[group.Key].AddRange(group);
            }

            view.BeginDigraph("Gss");

            view.SetGraphProperties(rankDir: RankDir.RightToLeft);

            for (int layerIndex = 0; layerIndex != layers.Count; ++layerIndex)
            {
                var layer = layers[layerIndex];
                view.BeginCluster(layerIndex.ToString());

                view.SetGraphProperties(style: Style.Dotted, label: "U" + layerIndex);
                view.SetNodeProperties(shape: Shape.Circle);

                for (int nodeIndex = 0; nodeIndex != layer.Count; ++nodeIndex)
                {
                    view.AddNode(
                        Tuple.Create("s", layerIndex, nodeIndex),
                        label: StateName(layer[nodeIndex]));
                }

                view.EndCluster();
            }

            view.SetNodeProperties(shape: Shape.Rect);

            int linkIndex = 0;

            for (int layerIndex = 0; layerIndex != layers.Count; ++layerIndex)
            {
                var layer = layers[layerIndex];
                for (int nodeIndex = 0; nodeIndex != layer.Count; ++nodeIndex)
                {
                    var from = layer[nodeIndex];
                    if (from.State < 0)
                    {
                        continue;
                    }

                    int token = stateToSymbol[from.State];
                    var link  = from.FirstLink;
                    while (link != null)
                    {
                        var to = link.LeftNode;

                        view.AddNode(Tuple.Create("t", linkIndex), grammar.SymbolName(token));

                        view.AddEdge(
                            Tuple.Create("s", layerIndex, nodeIndex),
                            Tuple.Create("t", linkIndex)
                            );

                        view.AddEdge(
                            Tuple.Create("t", linkIndex),
                            Tuple.Create("s", to.Layer, layers[to.Layer].IndexOf(to))
                            );

                        ++linkIndex;

                        link = link.NextLink;
                    }
                }
            }

            view.EndDigraph();
        }
Esempio n. 37
0
 /// <summary>
 /// Creates a default view object.
 /// </summary>
 /// <returns>The default view object, or null if there is no default view object.</returns>
 public virtual object CreateDefaultViewObject()
 {
   this.View = new GraphView();
   return this.View;
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Commit size (LOC)";
     graph.YAxisTitle = "Defect density (defects per KLOC)";
     base.Draw(graph);
 }
Esempio n. 39
0
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "File defect density";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "File defect density";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.PrepairPointsForDateScale(x, dates[0]);
     graph.YAxisTitle = "Commits";
     foreach (var y in yByAuthor)
     {
         Legend = y.Key;
         this.y = y.Value;
         base.Draw(graph);
     }
 }
Esempio n. 42
0
        public void WriteGraph(IGraphView graph, Grammar grammar, bool showRules = false)
        {
            var graphWriter = new SppfGraphWriter(grammar, graph, showRules: showRules);

            graphWriter.WriteGraph(this);
        }
Esempio n. 43
0
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Removed to added code";
     base.Draw(graph);
 }
 public override void Draw(IGraphView graph)
 {
     graph.XAxisTitle = "Days";
     base.Draw(graph);
 }