SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

Does anyone know why I would use a SciChartGroup instead of a simple ItemsControl? I tried to use an ItemsControl to show a vertical stack of charts, but I’m getting some weird internal exceptions in SciChart. I’m wondering if the SciChartGroup is a workaround for that?

  • You must to post comments
1
0

Hi Felix,

SciChartGroup’s main intent is to create multi-pane stock charts. It adds some more features over an ItemsControl, such as

  • The ability to stack or tab panes under the main pane
  • Ability to close or hide panes
  • Templatable Titles per pane
  • Automatically adds grid splitters between panes
  • Responds to theme changes

Other than that there is no reason why you need to use SciChartGroup over ItemsControl, and no exceptions we’re aware of when using SciChartSurface with ItemsControl.

Perhaps you could email over some code / solution to reproduce to support and one of us can take a look?

Best regards,
Andrew

  • You must to post comments
0
0

Hi,

Thanks for your quick response.

My error is proving hard to reproduce in a simple scenario. Before I spend too much more time on it, could you take a look at the stack trace and see if you can get any clue as to what might cause this. Specifically, I’m seeing a NullReferenceException at:

  Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Model.DataSeries.DataSeries<System.DateTime,double>.FindClosestLine(System.IComparable x, System.IComparable y, double xyScaleRatio, double xRadius, Abt.Controls.SciChart.Visuals.RenderableSeries.LineDrawMode drawNanAs)   Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.NearestHitResult(System.Windows.Point mouseRawPoint, double hitTestRadiusInPixels, Abt.Controls.SciChart.Common.Extensions.SearchMode searchMode, bool considerYCoordinateForDistanceCalculation) Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.HitTestInternal(System.Windows.Point rawPoint, double hitTestRadius, bool interpolate)    Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.HitTest(System.Windows.Point rawPoint, double hitTestRadius, bool interpolate)    Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Visuals.RenderableSeries.BaseRenderableSeries.VerticalSliceHitTest(System.Windows.Point rawPoint, bool interpolate) Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ChartModifiers.VerticalSliceModifierBase..(Abt.Controls.SciChart.Visuals.RenderableSeries.IRenderableSeries )    Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ChartModifiers.InspectSeriesModifierBase..MoveNext()   Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions..MoveNext()    Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ChartModifiers.VerticalSliceModifier..MoveNext()   Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions.<Abt.Controls.SciChart.SeriesInfo>(System.Collections.Generic.IEnumerable<Abt.Controls.SciChart.SeriesInfo> , System.Action<Abt.Controls.SciChart.SeriesInfo> )   Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ChartModifiers.VerticalSliceModifierBase.HandleMasterMouseEvent(System.Windows.Point mousePoint)    Unknown
    Abt.Controls.SciChart.Wpf.dll!Abt.Controls.SciChart.ChartModifiers.VerticalSliceModifier.OnVerticalLinesCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) Unknown
    System.dll!System.Collections.ObjectModel.ObservableCollection<Abt.Controls.SciChart.Visuals.Annotations.VerticalLineAnnotation>.OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) Unknown
    System.dll!System.Collections.ObjectModel.ObservableCollection<System.__Canon>.InsertItem(int index, System.__Canon item)   Unknown
    mscorlib.dll!System.Collections.ObjectModel.Collection<Abt.Controls.SciChart.Visuals.Annotations.VerticalLineAnnotation>.Add(Abt.Controls.SciChart.Visuals.Annotations.VerticalLineAnnotation item) Unknown
    mscorlib.dll!System.Collections.ObjectModel.Collection<Abt.Controls.SciChart.Visuals.Annotations.VerticalLineAnnotation>.System.Collections.IList.Add(object value) Unknown
    System.Xaml.dll!System.Xaml.Schema.XamlTypeInvoker.AddToCollection(object instance, object item)    Unknown
    System.Xaml.dll!MS.Internal.Xaml.Runtime.ClrObjectRuntime.Add(object collection, System.Xaml.XamlType collectionType, object value, System.Xaml.XamlType valueXamlType) Unknown
    System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentCollection(MS.Internal.Xaml.Context.ObjectWriterContext ctx) Unknown
    System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(MS.Internal.Xaml.Context.ObjectWriterContext ctx)   Unknown
    System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_CheckAssignmentToParentStart(MS.Internal.Xaml.Context.ObjectWriterContext ctx)   Unknown
    System.Xaml.dll!System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(MS.Internal.Xaml.Context.ObjectWriterContext ctx)   Unknown
    System.Xaml.dll!System.Xaml.XamlObjectWriter.WriteStartMember(System.Xaml.XamlMember property)  Unknown
    System.Xaml.dll!System.Xaml.XamlWriter.WriteNode(System.Xaml.XamlReader reader) Unknown
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlReader templateReader, System.Xaml.XamlObjectWriter currentWriter)  Unknown
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadTemplateXaml(System.Xaml.XamlObjectWriter objectWriter)  Unknown
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(System.Windows.DependencyObject container, System.Windows.Markup.IComponentConnector componentConnector, System.Windows.Markup.IStyleConnector styleConnector, System.Collections.Generic.List<System.Windows.DependencyObject> affectedChildren, System.Windows.UncommonField<System.Collections.Hashtable> templatedNonFeChildrenField)   Unknown
    PresentationFramework.dll!System.Windows.FrameworkTemplate.LoadContent(System.Windows.DependencyObject container, System.Collections.Generic.List<System.Windows.DependencyObject> affectedChildren)    Unknown
    PresentationFramework.dll!System.Windows.StyleHelper.ApplyTemplateContent(System.Windows.UncommonField<System.Collections.Specialized.HybridDictionary[]> dataField, System.Windows.DependencyObject container, System.Windows.FrameworkElementFactory templateRoot, int lastChildIndex, System.Collections.Specialized.HybridDictionary childIndexFromChildID, System.Windows.FrameworkTemplate frameworkTemplate) Unknown
    PresentationFramework.dll!System.Windows.FrameworkTemplate.ApplyTemplateContent(System.Windows.UncommonField<System.Collections.Specialized.HybridDictionary[]> templateDataField, System.Windows.FrameworkElement container)   Unknown
    PresentationFramework.dll!System.Windows.FrameworkElement.ApplyTemplate()   Unknown
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize)    Unknown
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize)    Unknown
    PresentationFramework.dll!System.Windows.Controls.StackPanel.StackMeasureHelper(System.Windows.Controls.IStackMeasure measureElement, System.Windows.Controls.IStackMeasureScrollData scrollData, System.Windows.Size constraint)   Unknown
    PresentationFramework.dll!System.Windows.Controls.StackPanel.MeasureOverride(System.Windows.Size constraint)    Unknown
    PresentationFramework.dll!System.Windows.FrameworkElement.MeasureCore(System.Windows.Size availableSize)    Unknown
    PresentationCore.dll!System.Windows.UIElement.Measure(System.Windows.Size availableSize)    Unknown
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayout() Unknown
    PresentationCore.dll!System.Windows.ContextLayoutManager.UpdateLayoutCallback(object arg)   Unknown
    PresentationCore.dll!System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()  Unknown
    PresentationCore.dll!System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()    Unknown
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandlerCore(object resizedCompositionTarget)    Unknown
    PresentationCore.dll!System.Windows.Media.MediaContext.RenderMessageHandler(object resizedCompositionTarget)    Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)  Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(object source, System.Delegate method, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)  Unknown
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame)   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.Run()   Unknown
    PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)  Unknown
    PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window)  Unknown
    PresentationFramework.dll!System.Windows.Application.Run()  Unknown
    Microscope.exe!Microscope.Main()    C#
    [Native to Managed Transition]  
    mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) Unknown
    Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()   Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)    Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart()    Unknown
  • Andrew
    Ok, the stack trace suggests the crash is occurring during HitTest, which is conversion of pixel coordinate to data values, used by CursorModifier, RolloverModifier, SeriesValueModifier, LegendModifier etc... The stack trace also contains something about VerticalLineAnnotation? Are you adding vertical line annotations to the chart? Or are you using VerticalSliceModifier? Is there a minimum set of code you can find which causes the issue so we can take a closer look?
  • F W
    Im working on creating a minimal set of code. In the meantime, here is the XAML. When I remove the vertical line the crash stops. <ItemsControl ItemsSource="{Binding Charts}" Grid.Row="1"> <ItemsControl.ItemTemplate> <DataTemplate DataType="viewModel:ChartViewModel"> <s:SciChartSurface SeriesSource="{Binding Series}" Height="200"> <s:SciChartSurface.XAxis> <s:DateTimeAxis AutoRange="Always" Visibility="Collapsed"/> </s:SciChartSurface.XAxis> <s:SciChartSurface.YAxis> <s:NumericAxis AutoRange="Always"/> </s:SciChartSurface.YAxis> <s:SciChartSurface.ChartModifier> <s:ModifierGroup> <s:VerticalSliceModifier> <s:VerticalSliceModifier.VerticalLines> <s:VerticalLineAnnotation Style="{StaticResource sliceStyle}" X1="{Binding Path=DataContext.Time, RelativeSource={RelativeSource AncestorType=UserControl}}"/> </s:VerticalSliceModifier.VerticalLines> </s:VerticalSliceModifier> </s:ModifierGroup> </s:SciChartSurface.ChartModifier> </s:SciChartSurface> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>
  • You must to post comments
0
0

Hi,

I isolated the problem. It seems to only occur the the property to which ItemsControl.ItemsSource is bound (Charts in the example above) is not an instance of ObservableCollection. We have our own version of ObservableCollection that implements all the same interfaces and the MS one but has some optimizations. When I use an instance of that as the ItemControl.ItemsSource I get the exception above.

For now I have a workaround by using the traditional ObservableCollection, and I’m happy with that, but it would be nice if this could be fixed eventually.

Regards
Felix

  • Andrew
    Hi Felix, we won't be able to fix it if the issue is caused by a custom implementation of ObservableCollection. Not unless you can provide a code sample including your custom collection type that we can investigate.
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.