Skip to content

Commit

Permalink
fix desync between series in chart and in model due to clone before c…
Browse files Browse the repository at this point in the history
…utting non-displaybale nodes #68
  • Loading branch information
jamaa committed Aug 3, 2023
1 parent a667abd commit 037010d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
6 changes: 6 additions & 0 deletions source/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
BlueM.Wave Release Notes
========================

Version 2.4.4
-------------
FIXED:
* Fixed issue with deleting series or editing series properties in the properties window,
this only affected series with extreme dates that cannot be entirely displayed in the chart #68

Version 2.4.3
-------------
FIXED:
Expand Down
6 changes: 5 additions & 1 deletion source/Classes/TimeSeries.vb
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,12 @@ Public Class TimeSeries
''' <summary>
''' Clones a time series
''' </summary>
Public Function Clone() As TimeSeries
''' <param name="preserveId">if True, the Id is preserved, otherwise a new unique Id is assigned (default)</param>
Public Function Clone(Optional preserveId As Boolean = False) As TimeSeries
Dim target As New TimeSeries(Me.Title)
If preserveId Then
target._id = Me.Id
End If
target.Unit = Me.Unit
target.Objekt = Me.Objekt
target.Type = Me.Type
Expand Down
7 changes: 4 additions & 3 deletions source/Controllers/WaveController.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2124,9 +2124,10 @@ Friend Class WaveController
''' <param name="ts">Die anzuzeigende Zeitreihe</param>
Private Sub SeriesAdded(ts As TimeSeries)

'Remove nodes if necessary (#68)
'Check for extreme dates not supported by TChart
'and if necessary create a copy with removed nodes for display purposes (#68)
If ts.StartDate < Constants.minOADate Then
ts = ts.Clone()
ts = ts.Clone(preserveId:=True)
Dim t_too_early = New List(Of DateTime)
For Each t As DateTime In ts.Dates
If t < Constants.minOADate Then
Expand All @@ -2141,7 +2142,7 @@ Friend Class WaveController
Log.AddLogEntry(Log.levels.warning, $"Unable to display {t_too_early.Count} nodes between {t_too_early.First().ToString(Helpers.CurrentDateFormat)} and {t_too_early.Last().ToString(Helpers.CurrentDateFormat)}!")
End If
If ts.EndDate > Constants.maxOADate Then
ts = ts.Clone()
ts = ts.Clone(preserveId:=True)
Dim t_too_late As New List(Of DateTime)
For Each t As DateTime In ts.Dates.Reverse()
If t > Constants.maxOADate Then
Expand Down
4 changes: 2 additions & 2 deletions source/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.4.3.*")>
'<Assembly: AssemblyFileVersion("2.4.3.*")>
<Assembly: AssemblyVersion("2.4.4.*")>
'<Assembly: AssemblyFileVersion("2.4.4.*")>

0 comments on commit 037010d

Please sign in to comment.