diff --git a/src/Nexus.UI/Charts/Chart.razor.cs b/src/Nexus.UI/Charts/Chart.razor.cs index d9e63437..306f9c7b 100644 --- a/src/Nexus.UI/Charts/Chart.razor.cs +++ b/src/Nexus.UI/Charts/Chart.razor.cs @@ -28,6 +28,8 @@ public partial class Chart : IDisposable private DateTime _zoomedBegin; private DateTime _zoomedEnd; + private readonly SKRect _defaultZoomBox = new SKRect(0, 0, 1, 1); + /* Common */ private const float TICK_SIZE = 10; @@ -50,7 +52,6 @@ public partial class Chart : IDisposable private readonly TimeAxisConfig[] _timeAxisConfigs; /* Others */ - private bool _beginAtZero; private readonly SKColor[] _colors; public Chart() @@ -133,9 +134,8 @@ public Chart() protected override void OnParametersSet() { - if (BeginAtZero != _beginAtZero) + if (BeginAtZero || _zoomBox == _defaultZoomBox) { - _beginAtZero = BeginAtZero; Task.Run(() => { _axesMap = LineSeriesData.Series @@ -523,8 +523,8 @@ private void ApplyZoom(SKRect zoomBox) private void ResetZoom() { /* zoom box */ - _oldZoomBox = new SKRect(0, 0, 1, 1); - _zoomBox = new SKRect(0, 0, 1, 1); + _oldZoomBox = _defaultZoomBox; + _zoomBox = _defaultZoomBox; /* time range */ _zoomedBegin = LineSeriesData.Begin;