public FFTWindow() { InitializeComponent(); _transform = new FFT(); _transform.init(10); _heatmap2DArrayDataSeries = new Heatmap2DArrayDataSeries <double>(_spectrogramBuffer, ix => ix, iy => iy); FirstCreateSeries(); LineRenderableSeries.DataSeries = _xyDataSeries; HeatmapRenderableSeries.DataSeries = _heatmap2DArrayDataSeries; UpdateDataOnTimerTick(); _timer = new DispatcherTimer(DispatcherPriority.Render) { Interval = TimeSpan.FromMilliseconds(10), IsEnabled = true }; _timer.Tick += TimerOnTick; }
int RMSCount = 0; //current sample count for RMS calculation #region ViewModel Constructor public ViewModel() { VoltageDataSeries = new XyDataSeries <double, double>(); AmplitudeDataSeries = new XyDataSeries <double, double>(); DataSeries = new XyDataSeries <double, double>(); _transform = new FFT(); _transform.init(10); IsFrequencyDomain = true; _timerNewDataUpdate = new Timer(dt * 1000); _timerNewDataUpdate.AutoReset = true; _timerNewDataUpdate.Elapsed += OnNewData; ViewportManager = new DefaultViewportManager(); VoltageDataSeries.FifoCapacity = FifoSize; AmplitudeDataSeries.FifoCapacity = FifoSize / RMSSamples; DataSeries.FifoCapacity = FifoSize; MaxDb = new DoubleRange(0, 200); _timerNewDataUpdate.Start(); }