Skip to content

Commit 1eb7d2f

Browse files
committed
Merge pull request #97 from xzoth/master
Fixed LineSpectrum Bar calculate issue
2 parents 2ab1cfd + 2c7af91 commit 1eb7d2f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Samples/WinformsVisualization/Visualization/LineSpectrum.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private void CreateSpectrumLineInternal(Graphics graphics, Pen pen, float[] fftB
117117
{
118118
SpectrumPointData p = spectrumPoints[i];
119119
int barIndex = p.SpectrumPointIndex;
120-
double xCoord = (_barWidth * barIndex) + (BarSpacing * barIndex) + 1 + _barWidth / 2;
120+
double xCoord = BarSpacing * (barIndex + 1) + (_barWidth * barIndex) + _barWidth / 2;
121121

122122
var p1 = new PointF((float) xCoord, height);
123123
var p2 = new PointF((float) xCoord, height - (float) p.Value - 1);
@@ -128,7 +128,7 @@ private void CreateSpectrumLineInternal(Graphics graphics, Pen pen, float[] fftB
128128

129129
protected override void UpdateFrequencyMapping()
130130
{
131-
_barWidth = Math.Max(((_currentSize.Width - (BarSpacing * (BarCount - 1))) / BarCount), 0.00001);
131+
_barWidth = Math.Max(((_currentSize.Width - (BarSpacing * (BarCount + 1))) / BarCount), 0.00001);
132132
base.UpdateFrequencyMapping();
133133
}
134134

0 commit comments

Comments
 (0)