Example #1
0
        public UsingSeriesValueModifier()
        {
            InitializeComponent();

            _timerNewDataUpdate           = new Timer(dt * 1000);
            _timerNewDataUpdate.AutoReset = true;
            _timerNewDataUpdate.Elapsed  += OnNewData;

            // Create new Dataseries of type X=double, Y=double
            _series0 = new XyDataSeries <double, double>()
            {
                FifoCapacity = FifoSize, SeriesName = "Orange Series"
            };
            _series1 = new XyDataSeries <double, double>()
            {
                FifoCapacity = FifoSize, SeriesName = "Blue Series"
            };
            _series2 = new XyDataSeries <double, double>()
            {
                FifoCapacity = FifoSize, SeriesName = "Green Series"
            };

            // Set the dataseries on the chart's RenderableSeries
            renderableSeries0.DataSeries = _series0;
            renderableSeries1.DataSeries = _series1;
            renderableSeries2.DataSeries = _series2;
        }
Example #2
0
        private void CreateDataSetAndSeries()
        {
            _series0 = new XyDataSeries <double, double>();
            _series1 = new UniformGridDataSeries3D <double>(100, 100)
            {
                StartX = 0, StepX = 0.1, StartZ = 0
            };
            _series2 = new UniformGridDataSeries3D <double>(100, 100)
            {
                StartX = 0, StepX = 0.1, StartZ = 0
            };

            _series0.FifoCapacity = FifoSize;

            for (int a = 0; a < FifoSize; a++)
            {
                OnNewData(this, null);
            }

            RenderableSeries0.DataSeries = _series0;
            surfaceMesh.Maximum          = 22;
            surfaceMesh.Minimum          = 0;
            surfaceMesh.DataSeries       = _series1;

            RenderableSeries1.DataSeries = _series0;
            surfaceMesh1.Maximum         = 22;
            surfaceMesh1.Minimum         = 0;
            surfaceMesh1.DataSeries      = _series2;
        }
Example #3
0
        private void CreateDataSetAndSeries()
        {
            // Create new Dataseries of type X=double, Y=double
            series0 = new XyDataSeries <double, double>();
            series1 = new XyDataSeries <double, double>();
            series2 = new XyDataSeries <double, double>();

            if (IsFifoCheckBox.IsChecked == true)
            {
                // Add three FIFO series to fill with data.
                // setting the FIFO capacity will denote this series as a FIFO series. New data is appended until the size is met, at which point
                //  old data is discarded. Internally the FIFO series is implemented as a circular buffer so that old data is pushed out of the buffer
                //  once the capacity has been reached
                // Note: Once a FIFO series has been added to a dataset, all subsequent series must be FIFO series. In addition, the FifoSize must be the
                //  same for all FIFO series in a dataset.
                series0.FifoCapacity = FifoSize;
                series1.FifoCapacity = FifoSize;
                series2.FifoCapacity = FifoSize;
            }

            // Set the dataseries on the chart's RenderableSeries
            RenderableSeries0.DataSeries = series0;
            RenderableSeries1.DataSeries = series1;
            RenderableSeries2.DataSeries = series2;
        }
Example #4
0
        private void GenerateData()
        {
            _scatterData = new XyDataSeries <double, double>();
            _fittedData  = new XyDataSeries <double, double>();

            _scatterData.Append(_xData, _scatterY);
            _fittedData.Append(_xData, _lineY);
        }
Example #5
0
 private static IRenderableSeriesViewModel GetStackedMountain(IXyDataSeries dataSeries, bool isOneHundredPercent, string styleKey)
 {
     return(new StackedMountainRenderableSeriesViewModel
     {
         DataSeries = dataSeries,
         StyleKey = styleKey,
         IsOneHundredPercent = isOneHundredPercent,
     });
 }
        public StaticPidChart()
        {
            yawAngles = new XyDataSeries<double, double>() { SeriesName = "Yaw Angle" };
            yawSetPoints = new XyDataSeries<double, double>() { SeriesName = "Yaw Set Point" };
            tiltAngles = new XyDataSeries<double, double>() { SeriesName = "Tilt Angle" };
            tiltSetPoints = new XyDataSeries<double, double>() { SeriesName = "Tilt Set Point" };

            InitializeComponent();
        }
Example #7
0
 private static IRenderableSeriesViewModel GetStackedColumn(IXyDataSeries dataSeries, bool isOneHundredPercent, string styleKey, string group)
 {
     return(new StackedColumnRenderableSeriesViewModel
     {
         DataSeries = dataSeries,
         StyleKey = styleKey,
         IsOneHundredPercent = isOneHundredPercent,
         StackedGroupId = group,
     });
 }
        private void FillData(IXyDataSeries <double, double> dataSeries)
        {
            var data = DataManager.Instance.GetRandomDoubleSeries(50);

            dataSeries.Append(data.XData, data.YData);

            sciChart.RenderableSeries.Add(new FastLineRenderableSeries()
            {
                Stroke     = DataManager.Instance.GetRandomColor(),
                DataSeries = dataSeries,
            });
        }
Example #9
0
        public SpectrumAnalyzerExampleViewModel()
        {
            _dataSeries = new XyDataSeries <double, double>();

            _transform = new FFT2();
            _transform.init(10);

            IsFrequencyDomain = true;

            _updateTimer.Elapsed  += TimerElapsed;
            _updateTimer.AutoReset = true;

            _startCommand = new ActionCommand(OnExampleEnter);
            _stopCommand  = new ActionCommand(OnExampleExit);
        }
Example #10
0
        public MainWindow()
        {
            InitializeComponent();

            _audioSeriesSource = new XyDataSeries <float, float>
            {
                FifoCapacity = SAMPLE_COUNT
            };

            for (int i = 0; i < _xSeries.Length; i++)
            {
                _xSeries[i] = i;
            }

            StartAudio();
        }
Example #11
0
        public ECGMonitorViewModel()
        {
            // Create a data series. We use FIFO series as we
            // want to discard old data after 5000pts
            // At the sample rate of ~500Hz and 5 seconds
            // visible range we'll need 2500 points in the FIFO.
            // We set 5000 so no data gets discarded while still in view
            _series0 = new XyDataSeries <double, double>()
            {
                FifoCapacity = 5000
            };

            // Simulate waveform
            _sourceData = LoadWaveformData("Waveform.txt");

            // Fix chart range in Y-Direction
            YVisibleRange = new DoubleRange(-0.5, 1.5);
        }
        public MainWindow()
        {
            try
            {
                InitializeComponent();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            //Graphing Add In Code-Behind
            SoundData = new XyDataSeries <double, short>();
            SoundData.FifoCapacity = this.Capacity * 16000;

            //View Model Update
            Sthetho             = new StethoViewModel(Init, Stop, Clear, Retrieve);
            this.DataContext    = Sthetho;
            Sthetho.IsStreaming = false;
            Sthetho.FilterHeart = false;

            //Open File (Remove for serial Stream)
            reader = OpenFile(inputfile);

            //Audio Class
            StethoPlayer = new AudioPlayer(15200, 16, 1);

            //Open Serial Port
            SerialDataIn = new SerialCom(921600, "COM8");

            //Open File For Writing
            Sthetho.OutFileName = "StethoSound"; //Deprecated
            Sthetho.WriteToFile = true;

            VertAnnotate.CoordinateMode    = SciChart.Charting.Visuals.Annotations.AnnotationCoordinateMode.Absolute;
            VertAnnotate.Y1                = -32000;
            VertAnnotate.VerticalAlignment = VerticalAlignment.Top;
            Sthetho.AnnotationX            = 0;

            //Create filter objects
            BandPassfilter = OnlineFilter.CreateHighpass(ImpulseResponse.Finite, samplerate, fc1);
            //Denoiser = OnlineFilter.CreateDenoise(25);
        }
        private IDataSeries FillData(IXyDataSeries <double, double> dataSeries, string name)
        {
            var randomWalk = 10.0;

            // Generate the X,Y data with sequential dates on the X-Axis and slightly positively biased random walk on the Y-Axis
            var xBuffer = new double[Count];
            var yBuffer = new double[Count];

            for (int i = 0; i < Count; i++)
            {
                randomWalk += (_random.NextDouble() - 0.498);
                yBuffer[i]  = randomWalk;
                xBuffer[i]  = i;
            }

            // Buffer above and append all in one go to avoid multiple recalculations of series range
            dataSeries.Append(xBuffer, yBuffer);
            dataSeries.SeriesName = name;

            return(dataSeries);
        }
Example #14
0
        private void OnRunExample()
        {
            Task.Factory.StartNew(() =>
            {
                DataSeries = null;

                // Generate Data and mark time
                var dataSeries = new XyDataSeries <double, double>();
                var stopwatch  = Stopwatch.StartNew();
                var xyData     = new RandomWalkGenerator(0.0d).GetRandomWalkSeries(Count);
                stopwatch.Stop();

                // Append to SciChartSurface and mark time
                stopwatch = Stopwatch.StartNew();
                dataSeries.Append(xyData.XData, xyData.YData);
                DataSeries = dataSeries;
                stopwatch.Stop();

                // Zoom viewport to extents
                ViewportManager.AnimateZoomExtents(TimeSpan.FromMilliseconds(500));
            });
        }
        public void StartNewSession(Session newSession)
        {
            session = newSession;
            yawDataSeries = session.YawDataSeries;
            tiltDataSeries = session.TiltDataSeries;

            session.PropertyChanged += OnNewControllerDataReceived;

            ClearDataSeries();

            yawAngles = new XyDataSeries<double, double>() { FifoCapacity = FifoSampleSize, SeriesName = "Yaw Angle" };
            yawSetPoints = new XyDataSeries<double, double>() { FifoCapacity = FifoSampleSize, SeriesName = "Yaw Set Point" };
            tiltAngles = new XyDataSeries<double, double>() { FifoCapacity = FifoSampleSize, SeriesName = "Tilt Angle" };
            tiltSetPoints = new XyDataSeries<double, double>() { FifoCapacity = FifoSampleSize, SeriesName = "Tilt Set Point" };

            YawAngleSeries.DataSeries = yawAngles;
            YawSetPointSeries.DataSeries = yawSetPoints;
            TiltAngleSeries.DataSeries = tiltAngles;
            TiltSetPointSeries.DataSeries = tiltSetPoints;

            Log.Debug("Starting PID Charting");
        }
 public UseHighQualityRenderingViewModel()
 {
     _dataSeries0 = CreateDataSeries();
 }
Example #17
0
 public void OnPageExit()
 {
     DataSeries = null;
 }
Example #18
0
        public MainWindow()
        {
            InitializeComponent();

            SERVER_IP = GetAddresses()[0];

            UpdateText("Starting server on IP Address: " + SERVER_IP);

            // Write the SDP FILE.
            string lines = "First line.\r\nSecond line.\r\nThird line.";

            // Write the string to a file.
            System.IO.StreamWriter file = new System.IO.StreamWriter(".\\videoDescription.sdp");
            file.WriteLine(contents);

            file.Close();



            var currentAssembly  = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            // Default installation path of VideoLAN.LibVLC.Windows
            var libDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));


            vlcPlayer.SourceProvider.CreatePlayer(libDirectory, new string[] { "--network-caching=0", "--clock-jitter=0", "clock-syncro=0" } /* pass your player parameters here */);
            vlcPlayer.SourceProvider.MediaPlayer.Play(new FileInfo(".\\videoDescription.sdp"));

            //OpticalFlowServer.startServer(null);
            this.Loaded += OnLoaded;

            xWorldAcc = new XyDataSeries <float, float>();
            yWorldAcc = new XyDataSeries <float, float>();
            zWorldAcc = new XyDataSeries <float, float>();

            xDeviceAcc = new XyDataSeries <float, float>();
            yDeviceAcc = new XyDataSeries <float, float>();
            zDeviceAcc = new XyDataSeries <float, float>();

            xWorldVel = new XyDataSeries <float, float>();
            yWorldVel = new XyDataSeries <float, float>();
            zWorldVel = new XyDataSeries <float, float>();

            xDeviceVel = new XyDataSeries <float, float>();
            yDeviceVel = new XyDataSeries <float, float>();
            zDeviceVel = new XyDataSeries <float, float>();

            xRealVel = new XyDataSeries <float, float>();
            yRealVel = new XyDataSeries <float, float>();
            zRealVel = new XyDataSeries <float, float>();

            positionVec          = new XyzDataSeries3D <double>();
            realSensePositionVec = new XyzDataSeries3D <double>();


            //a.Move((int)(myCanvas.Width/2), (int)(myCanvas.Height/2));

            udpServer = new OpticalFlowServer(optiflowCanvas, consoleOutput, PORT_NO, SERVER_IP,
                                              new IXyDataSeries <float, float>[] { xWorldAcc, yWorldAcc, zWorldAcc },
                                              new IXyDataSeries <float, float>[] { xDeviceAcc, yDeviceAcc, zDeviceAcc },
                                              new IXyDataSeries <float, float>[] { xWorldVel, yWorldVel, zWorldVel },
                                              new IXyDataSeries <float, float>[] { xDeviceVel, yDeviceVel, zDeviceVel },
                                              new IXyDataSeries <float, float>[] { xRealVel, yRealVel, zRealVel },
                                              positionVec,
                                              realSensePositionVec);


            Thread test = new Thread(new ThreadStart(udpServer.startServer));

            test.Start();
        }
        public ParaSubDiePartingPageViewModel(IMapper mapper, Fanuc fanuc)
        {
            _fanuc  = fanuc;
            _mapper = mapper;

            LoadedCommand    = new RelayCommand(OnLoaded);
            UnloadedCommand  = new RelayCommand(OnUnloaded);
            StartSciChartCmd = new RelayCommand(OnStartSciChart);

            SectionNumSetCmd          = new RelayCommand(OnSectionNumSet);
            BottomDeadCentreSetCmd    = new RelayCommand(OnBottomDeadCentreSet);
            Speed_TopDeadCentreSetCmd = new RelayCommand(OnSpeed_TopDeadCentreSet);
            TopDeadCentreSetCmd       = new RelayCommand(OnTopDeadCentreSet);

            Pos_1SetCmd = new RelayCommand(OnPos_1Set);
            Pos_2SetCmd = new RelayCommand(OnPos_2Set);
            Pos_3SetCmd = new RelayCommand(OnPos_3Set);
            Pos_4SetCmd = new RelayCommand(OnPos_4Set);
            Pos_5SetCmd = new RelayCommand(OnPos_5Set);
            Pos_6SetCmd = new RelayCommand(OnPos_6Set);
            Pos_7SetCmd = new RelayCommand(OnPos_7Set);
            Pos_8SetCmd = new RelayCommand(OnPos_8Set);

            Speed_1SetCmd = new RelayCommand(OnSpeed_1Set);
            Speed_2SetCmd = new RelayCommand(OnSpeed_2Set);
            Speed_3SetCmd = new RelayCommand(OnSpeed_3Set);
            Speed_4SetCmd = new RelayCommand(OnSpeed_4Set);
            Speed_5SetCmd = new RelayCommand(OnSpeed_5Set);
            Speed_6SetCmd = new RelayCommand(OnSpeed_6Set);
            Speed_7SetCmd = new RelayCommand(OnSpeed_7Set);
            Speed_8SetCmd = new RelayCommand(OnSpeed_8Set);

            BottomDeadCentreSetCmd = new RelayCommand(OnBottomDeadCentreSet);

            for (int i = 0; i < 8; i++)
            {
                ParaDiePartingProcInfoEnables.Add(false);
            }


            Messenger.Default.Register <ParaDiePartingInfo>(this, "ParaDiePartingInfoMsg", msg =>
            {
                ParaDiePartingInfo = _mapper.Map <ParaDiePartingInfo, ParaDiePartingInfoDto>(msg);
            });

            Messenger.Default.Register <ParaDiePartingProcInfo>(this, "ParaDiePartingProcInfoMsg", msg =>
            {
                ParaDiePartingProcInfo = _mapper.Map <ParaDiePartingProcInfo, ParaDiePartingProcInfoDto>(msg);

                for (int i = 0; i < 8; i++)
                {
                    if (i < ParaDiePartingProcInfo.SectionNum)
                    {
                        ParaDiePartingProcInfoEnables[i] = true;
                    }
                    else
                    {
                        ParaDiePartingProcInfoEnables[i] = false;
                    }
                }
            });


            string jsonBaseInfo;

            using (StreamReader sr = new StreamReader(@"baseinfo.cfg", true))
            {
                jsonBaseInfo = sr.ReadToEnd();
            }
            var _baseInfo = JsonConvert.DeserializeObject <BaseInfo>(jsonBaseInfo);
            var fifo      = _baseInfo.SciChartXTimeMax;

            PosSeries = new XyDataSeries <double, double>();
            PosSeries.FifoCapacity   = fifo;
            SpeedSeries              = new XyDataSeries <double, double>();
            SpeedSeries.FifoCapacity = fifo;

            Messenger.Default.Register <StateMonitorLineChartData>(this, "SimulateLineChartDataMsg", OnData);
        }