Exemplo n.º 1
0
        public LiveDataFixed()
        {
            this.InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            avaPlot1 = this.Find <AvaPlot>("avaPlot1");

            avaPlot1.Configure(middleClickMarginX: 0);

            // plot the data array only once
            avaPlot1.plt.PlotSignal(liveData);
            avaPlot1.plt.AxisAutoX(margin: 0);
            avaPlot1.plt.SetAxisLimits(yMin: -1, yMax: 2.5);

            // create a traditional timer to update the data
            _updateDataTimer = new Timer(_ => UpdateData(), null, 0, 5);

            // create a separate timer to update the GUI
            _renderTimer          = new DispatcherTimer();
            _renderTimer.Interval = TimeSpan.FromMilliseconds(10);
            _renderTimer.Tick    += Render;
            _renderTimer.Start();

            Closed += (sender, args) =>
            {
                _updateDataTimer?.Dispose();
                _renderTimer?.Stop();
            };
        }
Exemplo n.º 2
0
        private void PlotRandomData(object sender, RoutedEventArgs e)
        {
            avaPlot1.Reset();

            int    pointCount = 5;
            Random rand       = new Random();

            double[] dataX  = DataGen.Consecutive(pointCount);
            double[] dataY  = DataGen.Random(rand, pointCount);
            string[] labels = { "One", "Two", "Three", "Four", "Five" };

            avaPlot1.plt.PlotScatter(dataX, dataY, label: "series 1");
            avaPlot1.plt.Title("Plot Title");
            avaPlot1.plt.XLabel("Horizontal Axis");
            avaPlot1.plt.YLabel("Vertical Axis");

            avaPlot1.plt.XTicks(dataX, labels);
            avaPlot1.plt.XAxis.TickLabelStyle(rotation: 90);
            avaPlot1.plt.AxisAuto();
            avaPlot1.plt.Layout(left: 20, top: 50, bottom: 100, right: 20);
            avaPlot1.Configure(recalculateLayoutOnMouseUp: false);

            avaPlot1.Render();
        }
Exemplo n.º 3
0
 private void PanEnable(object sender, RoutedEventArgs e)
 {
     avaPlot1?.Configure(enablePanning: true);
 }