Skip to content

Commit f03abe2

Browse files
committed
Fix for single decade Y axis rendering
1 parent f4396f1 commit f03abe2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

source/NSD.UI/MainWindow.axaml.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,7 @@ private void btnSetAxis_Click(object sender, RoutedEventArgs e)
293293
yArray = spectrum.Values;
294294
UpdateNSDChart(spectrum.Frequencies, yArray);
295295
}
296-
WpfPlot1.Plot.Axes.SetLimits(Math.Log10(viewModel.XMin), Math.Log10(viewModel.XMax), Math.Log10(viewModel.YMin), Math.Log10(viewModel.YMax));
297-
WpfPlot1.Refresh();
296+
SetChartLimitsAndRefresh();
298297
}
299298

300299
public void UpdateNSDChart(Memory<double> x, Memory<double> y)
@@ -348,7 +347,14 @@ private void CommonChartConfig()
348347
WpfPlot1.Plot.Grid.MinorLineWidth = 1;
349348
WpfPlot1.Plot.Grid.MinorLineColor = ScottPlot.Color.FromARGB(0x14000000);
350349
WpfPlot1.Plot.Grid.MajorLineColor = ScottPlot.Color.FromARGB(0x50000000);
351-
WpfPlot1.Plot.Axes.SetLimits(Math.Log10(viewModel.XMin), Math.Log10(viewModel.XMax), Math.Log10(viewModel.YMin), Math.Log10(viewModel.YMax));
350+
SetChartLimitsAndRefresh();
351+
}
352+
353+
private void SetChartLimitsAndRefresh()
354+
{
355+
var top = Math.Log10(viewModel.YMax + (viewModel.YMax * 0.001));
356+
var bottom = Math.Log10(viewModel.YMin - (viewModel.YMin * 0.001));
357+
WpfPlot1.Plot.Axes.SetLimits(Math.Log10(viewModel.XMin), Math.Log10(viewModel.XMax), bottom, top);
352358
WpfPlot1.Refresh();
353359
}
354360

source/NSD.UI/NSD.UI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<PackageReference Include="CsvHelper" Version="33.0.1" />
2828
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
2929
<PackageReference Include="NReco.Csv" Version="1.0.3" />
30-
<PackageReference Include="ScottPlot.Avalonia" Version="5.0.37" />
30+
<PackageReference Include="ScottPlot.Avalonia" Version="5.0.54" />
3131
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
3232
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
3333
</ItemGroup>

0 commit comments

Comments
 (0)