diff --git a/Signals And Transforms/Installer/Installer.wixproj b/Signals And Transforms/Installer/Installer.wixproj
index 62e4fa2..e48a58b 100644
--- a/Signals And Transforms/Installer/Installer.wixproj
+++ b/Signals And Transforms/Installer/Installer.wixproj
@@ -62,4 +62,7 @@
+
+ "c:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool\signtool" sign /sha1 "4380105fab106823f712f185d0c3f9d6d9f6df55" /t http://timestamp.verisign.com/scripts/timstamp.dll /v $(TargetFileName)
+
\ No newline at end of file
diff --git a/Signals And Transforms/Installer/Product.wxs b/Signals And Transforms/Installer/Product.wxs
index eca230d..310ae61 100644
--- a/Signals And Transforms/Installer/Product.wxs
+++ b/Signals And Transforms/Installer/Product.wxs
@@ -4,7 +4,7 @@
-
+
diff --git a/Signals And Transforms/Properties/Resources.Designer.cs b/Signals And Transforms/Properties/Resources.Designer.cs
index 57d99f8..375e551 100644
--- a/Signals And Transforms/Properties/Resources.Designer.cs
+++ b/Signals And Transforms/Properties/Resources.Designer.cs
@@ -132,6 +132,24 @@ public static string OPEN {
}
}
+ ///
+ /// Looks up a localized string similar to Frequency.
+ ///
+ public static string PLOT_FREQUENCY_HISTOGRAM_BOTTOM_AXIS {
+ get {
+ return ResourceManager.GetString("PLOT_FREQUENCY_HISTOGRAM_BOTTOM_AXIS", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Amplitude.
+ ///
+ public static string PLOT_FREQUENCY_HISTOGRAM_LEFT_AXIS {
+ get {
+ return ResourceManager.GetString("PLOT_FREQUENCY_HISTOGRAM_LEFT_AXIS", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Frequency Amplitudes.
///
diff --git a/Signals And Transforms/Properties/Resources.resx b/Signals And Transforms/Properties/Resources.resx
index 57464dd..09dd426 100644
--- a/Signals And Transforms/Properties/Resources.resx
+++ b/Signals And Transforms/Properties/Resources.resx
@@ -141,6 +141,12 @@
Open
+
+ Frequency
+
+
+ Amplitude
+
Frequency Amplitudes
diff --git a/Signals And Transforms/SignalsAndTransforms.csproj b/Signals And Transforms/SignalsAndTransforms.csproj
index be36a5d..32a6087 100644
--- a/Signals And Transforms/SignalsAndTransforms.csproj
+++ b/Signals And Transforms/SignalsAndTransforms.csproj
@@ -143,6 +143,7 @@
+
diff --git a/Signals And Transforms/View Models/ConvolutionViewModel.cs b/Signals And Transforms/View Models/ConvolutionViewModel.cs
index dc10161..8f86281 100644
--- a/Signals And Transforms/View Models/ConvolutionViewModel.cs
+++ b/Signals And Transforms/View Models/ConvolutionViewModel.cs
@@ -100,7 +100,7 @@ private void LoadTestData()
public IList ResultPlotPoints { get; private set; }
- public IList ResultFrequencyHistogram { get; private set; }
+ public FrequencyHistogramViewModel ResultFrequencyHistogram { get; private set; }
public void PlotData()
@@ -137,12 +137,8 @@ public void PlotData()
ComplexFastFourierTransform cmplxFFT = new ComplexFastFourierTransform();
FrequencyDomain frequencyDomain = cmplxFFT.Transform(convolutionResult, workbookSourceSignal.SamplingHZ);
- ResultFrequencyHistogram = new List(frequencyDomain.FrequencyAmplitudes.Count);
- foreach (var freq in frequencyDomain.FrequencyAmplitudes)
- {
- ResultFrequencyHistogram.Add(new DataPoint(freq.Key, freq.Value));
- }
-
+ ResultFrequencyHistogram = new FrequencyHistogramViewModel(frequencyDomain);
+
NotifyPropertyChanged(nameof(SignalPlotPoints));
NotifyPropertyChanged(nameof(ConvolutionPlotPoints));
NotifyPropertyChanged(nameof(ResultPlotPoints));
diff --git a/Signals And Transforms/View Models/FrequencyHistogramViewModel.cs b/Signals And Transforms/View Models/FrequencyHistogramViewModel.cs
new file mode 100644
index 0000000..debfd71
--- /dev/null
+++ b/Signals And Transforms/View Models/FrequencyHistogramViewModel.cs
@@ -0,0 +1,43 @@
+using SignalProcessor;
+using System;
+using OxyPlot;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using OxyPlot.Axes;
+using OxyPlot.Series;
+
+namespace SignalsAndTransforms.View_Models
+{
+ public class FrequencyHistogramViewModel : PlotModel
+ {
+ public FrequencyHistogramViewModel(FrequencyDomain frequencyDomain)
+ {
+ Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_TITLE;
+ Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_LEFT_AXIS });
+ Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Title = Properties.Resources.PLOT_FREQUENCY_HISTOGRAM_BOTTOM_AXIS });
+
+ if (frequencyDomain != null)
+ {
+ HistogramSeries chs = new HistogramSeries();
+ chs.Items.AddRange(GetFrequencyBins(frequencyDomain));
+ Series.Add(chs);
+ }
+ }
+
+ private IList GetFrequencyBins(FrequencyDomain frequencyDomain)
+ {
+ int binCount = (int)Math.Ceiling(frequencyDomain.SampleRateHz / 2);
+ List histogramItems = new List(binCount);
+
+ foreach (var amplitude in frequencyDomain.FrequencyAmplitudes)
+ {
+ HistogramItem item = new HistogramItem(amplitude.Key - 0.25, amplitude.Key + 0.25, amplitude.Value, 1);
+ histogramItems.Add(item);
+ }
+
+ return histogramItems;
+ }
+ }
+}
diff --git a/Signals And Transforms/View Models/SignalGeneratorViewModel.cs b/Signals And Transforms/View Models/SignalGeneratorViewModel.cs
index ee31126..a123557 100644
--- a/Signals And Transforms/View Models/SignalGeneratorViewModel.cs
+++ b/Signals And Transforms/View Models/SignalGeneratorViewModel.cs
@@ -44,7 +44,7 @@ private void LoadSignalsFromActiveWorkBook()
}
public IList PlotPoints { get; private set; }
- public IList FrequencyHistogram { get; private set; }
+ public PlotModel FrequencyViewModel { get; private set; }
public String Title { get; private set; }
@@ -67,8 +67,7 @@ private void ActiveWorkBookChangedHandler(object sender, PropertyChangedEventArg
public void PlotSignals()
{
PlotPoints = new List(512);
- FrequencyHistogram = new List(512);
-
+
Signal workbookSourceSignal = workBookManager.ActiveWorkBook().SumOfSources();
if (workbookSourceSignal == null)
{
@@ -84,13 +83,11 @@ public void PlotSignals()
ComplexFastFourierTransform cmplxFFT = new ComplexFastFourierTransform();
FrequencyDomain frequencyDomain = cmplxFFT.Transform(workbookSourceSignal.Samples, workbookSourceSignal.SamplingHZ);
- foreach (var freq in frequencyDomain.FrequencyAmplitudes)
- {
- FrequencyHistogram.Add(new DataPoint(freq.Key, freq.Value));
- }
+
+ FrequencyViewModel = new FrequencyHistogramViewModel(frequencyDomain);
NotifyPropertyChanged(nameof(PlotPoints));
- NotifyPropertyChanged(nameof(FrequencyHistogram));
+ NotifyPropertyChanged(nameof(FrequencyViewModel));
}
private void NotifyPropertyChanged(string propertyName)
diff --git a/Signals And Transforms/Views/ConvolutionView.xaml b/Signals And Transforms/Views/ConvolutionView.xaml
index cf83523..71f0c51 100644
--- a/Signals And Transforms/Views/ConvolutionView.xaml
+++ b/Signals And Transforms/Views/ConvolutionView.xaml
@@ -44,10 +44,6 @@
MarkerType="Square"/>
-
-
-
-
-
+
diff --git a/Signals And Transforms/Views/SignalGeneratorView.xaml b/Signals And Transforms/Views/SignalGeneratorView.xaml
index 5b67f66..0375f5d 100644
--- a/Signals And Transforms/Views/SignalGeneratorView.xaml
+++ b/Signals And Transforms/Views/SignalGeneratorView.xaml
@@ -41,10 +41,6 @@
MarkerType="Square"/>
-
-
-
-
-
+