SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
I have a WPF app where a UserControl is created at startup. The control contains two SciChartSurface objects, both initially invisible. About every 10th time I start the application it hangs on the thread with this call stack:
mscorlib.dll!System.Collections.Generic.ObjectEqualityComparer<System.__Canon>.Equals(System.__Canon x, System.__Canon y)
mscorlib.dll!System.Collections.Generic.List<System.IComparable>.Contains(System.IComparable item)
SciChart.Charting.dll!SciChart.Charting.Numerics.TickProviders.TimeSpanTickProviderBase.c5b456a75ec2eca07ab2f0cf38c30f4f2(SciChart.Data.Model.IRange cb7f8a302c4d43c2cfce28a7f59c09882, SciChart.Charting.Model.IAxisDelta<System.TimeSpan> cf1435e1ac3c185934e905ec126bcd3fa)
SciChart.Charting.dll!SciChart.Charting.Numerics.TickProviders.TimeSpanTickProviderBase.GetMajorTicks(SciChart.Charting.Visuals.Axes.IAxisParams axis)
SciChart.Charting.dll!SciChart.Charting.Numerics.TickProviders.TickProvider<System.IComparable>.caf851e93289795305ee933ce4bbca448(SciChart.Charting.Visuals.Axes.IAxisParams c050e7b647895decc0313c2786c4fc396)
SciChart.Charting.dll!SciChart.Charting.Visuals.Axes.AxisCore.CalculateTicks()
SciChart.Charting.dll!SciChart.Charting.Visuals.Axes.AxisBase.OnDraw(SciChart.Drawing.Common.IRenderContext2D renderContext, SciChart.Charting.Visuals.RenderableSeries.IRenderPassData renderPassData)
SciChart.Charting.dll!A.c68de5aaca24f8f81d98aed29fac3caff.c6a7d2b5be124728330bbf562594a9bb9(SciChart.Charting.Visuals.ISciChartSurface c17037e8328cd0abc02d2a6957dfa450c, SciChart.Charting.Services.RenderPassInfo c16b8d70d2b6ecad8f9fca7ac3f5177b8, SciChart.Drawing.Common.IRenderContext2D c41db0419b661c8ac05a2aa6a1ea66092)
SciChart.Charting.dll!A.c68de5aaca24f8f81d98aed29fac3caff.RenderLoop(SciChart.Drawing.Common.IRenderContext2D renderContext)
SciChart.Charting.dll!SciChart.Charting.Visuals.SciChartSurface.DoDrawingLoop()
SciChart.Charting.dll!SciChart.Charting.Visuals.SciChartSurface.c86fb714e67e4ff799a0a0b43ef420019()
SciChart.Charting.dll!SciChart.Charting.Visuals.SciChartSurface.OnRenderSurfaceDraw(object sender, SciChart.Drawing.Common.DrawEventArgs e)
SciChart.Drawing.dll!SciChart.Drawing.Common.RenderSurfaceBase.OnDraw()
SciChart.Drawing.dll!SciChart.Drawing.Common.RenderSurfaceBase.OnRenderTimeElapsed()
SciChart.Drawing.dll!SciChart.Drawing.Common.RenderSurfaceBase.OnRenderSurfaceBaseLoaded(object sender, System.Windows.RoutedEventArgs e)
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs)
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised)
The CPU spikes and the app never responds. Any thoughts as to why this might happen?
Hi Dan, during the initialization phase of SciChart the axis is given a default valid visiblerange of 0,10.
For DateTimeAxis I believe this is todays date + 10 days.
The Axis behaves as follows
What I think is happening is you are setting your Axis.VisibleRange to null, either via a binding, or in code. Then, the axis starts up and tries to do the sequence above. It fails to find a range so it sets its range to 0,10. Now you have set MinorDelta to 0.5 seconds. As a result, SciChart generates 1.7million minor gridlines over 10 days, spaced 0.5 seconds apart – hence your hang!
What I suggest you do is to control this dynamically by only setting the MinorDelta, MajorDelta when it is safe to do so — when range is not absurdly large.
Or, if you want finer grained control over the axis Tick / Label output then please see our TickProvider API.
Best regards,
Andrew
Please login first to submit.