Пример #1
0
        public static void Main()
        {
            _window = new GameWindow(GameWindowSettings.Default, _nativeWindowSettings);
            var isNetworkGraph = false;

            if (isNetworkGraph)
            {
                // var graphData = TestGraphGenerator.GenerateNetworkGraph();
                // _graph = new NetworkGraph<string>(graphData);
            }
            else
            {
                _graph = ScatterGraphGenerator.GenerateScatterGraph();
            }

            var aspect = (float)_window.ClientSize.X / _window.ClientSize.Y;

            _graph.State.Camera.Target.AspectRatio  = aspect;
            _graph.State.Camera.Current.AspectRatio = aspect;

            _control = new GraphGlfwWindowControl <string>(_window, _graph.State);
            _control.BindToEvents();

            GLDebugLog.Message  += OnMessage;
            _window.RenderFrame += OnRenderFrame;
            _window.UpdateFrame += OnUpdate;
            _window.Run();
        }
Пример #2
0
        private static void OnUpdate(FrameEventArgs obj)
        {
            var r         = new Random();
            var seriesIdx = r.Next(_graph.State.Series.Count);
            var series    = _graph.State.Series[seriesIdx];

            var(x, y) = ScatterGraphGenerator.GenNormalDistPt(r);
            var pt     = DateTime.UtcNow.Ticks;
            var str    = pt.ToString();
            var offset = series.Points.Count;

            series.Add(str, x, y);
            _graph.State.Update((float)obj.Time);
        }