{"action":"created","issue":{"url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/701","repository_url":"https://api.github.com/repos/Live-Charts/Live-Charts","labels_url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/701/labels{/name}","comments_url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/701/comments","events_url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/701/events","html_url":"https://github.com/Live-Charts/Live-Charts/issues/701","id":283766243,"number":701,"title":"ArgumentOutOfRangeException when zooming in on chart","user":{"login":"NicolaiNyberg","id":8720733,"avatar_url":"https://avatars1.githubusercontent.com/u/8720733?v=4","gravatar_id":"","url":"https://api.github.com/users/NicolaiNyberg","html_url":"https://github.com/NicolaiNyberg","followers_url":"https://api.github.com/users/NicolaiNyberg/followers","following_url":"https://api.github.com/users/NicolaiNyberg/following{/other_user}","gists_url":"https://api.github.com/users/NicolaiNyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolaiNyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolaiNyberg/subscriptions","organizations_url":"https://api.github.com/users/NicolaiNyberg/orgs","repos_url":"https://api.github.com/users/NicolaiNyberg/repos","events_url":"https://api.github.com/users/NicolaiNyberg/events{/privacy}","received_events_url":"https://api.github.com/users/NicolaiNyberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-12-21T03:53:39Z","updated_at":"2018-04-25T20:54:01Z","closed_at":null,"author_association":"NONE","body":"#### How to reproduce?\r\n\r\n*I have created a WPF CartesianChart with two LineSeries displaying intra day forex tick data.\r\nWhen I zoom in (by setting MinX and MaxX on X Axis, LiveCharts triggers an exception\r\n```\r\nSystem.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.\r\nParameter name: index\r\n   at MS.Utility.FrugalStructList`1.Insert(Int32 index, T value)\r\n   at System.Windows.Media.PathSegmentCollection.Insert(Int32 index, PathSegment value)\r\n   at LiveCharts.Wpf.LineSeries.EndSegment(Int32 atIndex, CorePoint location) in c:\\Users\\btord\\Documents\\Projects\\LiveCharts\\WpfView\\LineSeries.cs:line 480\r\n   at LiveCharts.SeriesAlgorithms.LineAlgorithm.Update() in c:\\Users\\btord\\Documents\\Projects\\LiveCharts\\Core40\\SeriesAlgorithms\\LineAlgorithm.cs:line 188\r\n   at LiveCharts.ChartUpdater.Update(Boolean restartsAnimations, Boolean force) in c:\\Users\\btord\\Documents\\Projects\\LiveCharts\\Core40\\ChartUpdater.cs:line 125\r\n   at LiveCharts.Wpf.Components.ChartUpdater.UpdaterTick(Boolean restartView, Boolean force) in c:\\Users\\btord\\Documents\\Projects\\LiveCharts\\WpfView\\Components\\ChartUpdater.cs:line 89\r\n   at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)\r\n   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)\r\n   at System.Windows.Threading.DispatcherOperation.InvokeImpl()\r\n   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)\r\n   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)\r\n   at System.Windows.Threading.DispatcherOperation.Invoke()\r\n   at System.Windows.Threading.Dispatcher.ProcessQueue()\r\n   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)\r\n   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)\r\n   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)\r\n   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)\r\n   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)\r\n   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)\r\n   at System.Windows.Application.RunDispatcher(Object ignore)\r\n   at System.Windows.Application.RunInternal(Window window)\r\n   at MyApp.Main()\r\n\r\n```\r\n*\r\n\r\n#### Extra notes\r\n\r\n*I have a check in my code ensuring that MaxX will never be less than or equal to MinX.\r\nI am running the app via Remote Desktop on Windows Server 2012\r\nI am using GearedValues with Quality.High*\r\n\r\n#### I am using\r\n\r\n<table>\r\n<tr>\r\n    <td>Live-Charts version</td>\r\n    <td>0.9.7.0</td>\r\n</tr>\r\n<tr>\r\n    <td>Geared Live-Charts version</td>\r\n    <td>1.2.8.2</td>\r\n</tr>\r\n<tr>\r\n    <td>.Net Version</td>\r\n    <td>4.7.2114.0</td>\r\n</tr>\r\n<tr>\r\n    <td>Windows</td>\r\n    <td>Windows Server 2012</td>\r\n</tr>\r\n</table>\r\n"},"comment":{"url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/comments/384430581","html_url":"https://github.com/Live-Charts/Live-Charts/issues/701#issuecomment-384430581","issue_url":"https://api.github.com/repos/Live-Charts/Live-Charts/issues/701","id":384430581,"user":{"login":"beto-rodriguez","id":10853349,"avatar_url":"https://avatars1.githubusercontent.com/u/10853349?v=4","gravatar_id":"","url":"https://api.github.com/users/beto-rodriguez","html_url":"https://github.com/beto-rodriguez","followers_url":"https://api.github.com/users/beto-rodriguez/followers","following_url":"https://api.github.com/users/beto-rodriguez/following{/other_user}","gists_url":"https://api.github.com/users/beto-rodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/beto-rodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beto-rodriguez/subscriptions","organizations_url":"https://api.github.com/users/beto-rodriguez/orgs","repos_url":"https://api.github.com/users/beto-rodriguez/repos","events_url":"https://api.github.com/users/beto-rodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/beto-rodriguez/received_events","type":"User","site_admin":false},"created_at":"2018-04-25T20:54:01Z","updated_at":"2018-04-25T20:54:01Z","author_association":"COLLABORATOR","body":"This is most likely a threading issue, in version 0.x any series inherit from FrameworkElement, thus the object could be running in the UI thread.\r\n\r\nThis is an importing issue that forced the rewrite of the library, 1.0 should come soon, and offers multi threading solutions, in the current layout you could be updating your chart from multiple threads and you don't probably know it.\r\n\r\nPlease in version 1.0 ensure you are not modifying the Series.Values property while the UI is updating.\r\n\r\nDo not:\r\n\r\n    SeriesCollection = new SeriesCollection() { // come series ... };\r\n\r\n    <CartesianChart Series=\"{Binding SeriesCollection}\" />\r\n\r\nInstead please help the library to keep the UI thread only with UI elements, and the data in the main thread, try this syntax instead.\r\n\r\n     Values = new ChartValues<double> {...};\r\n\r\n     <CartesianChart >\r\n         <CartesianChart.Series>\r\n                <LineSeries Values=\"{Binding Values}\" />\r\n\r\nNow the library should not throw in this scenario even if you are modifying the Values instance from multiple threads.\r\n\r\nWell version 1.0 should be out in some days and there are many improvements, this is one of them."}}
{"actor":{"display_login":"beto-rodriguez"}}