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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

0
0

Hello

I have an MVVM application where I bind the series source of a SciChartSurface to an observable collection property of the view model as follows:

<scv:SciChartSurface x:Name="sciChart" Grid.Row="0" SeriesSource="{Binding ChartSeries}" Annotations="{Binding Annotations}" Padding="5" >

The series are added to the collection in the constructor of the view model:

chartSeries.Add(new ChartSeriesViewModel(someSeries, new FastLineRenderableSeries()));

Datapoints are then appended to the series in order to render a real-time chart.

Now I would like to create a SeriesValueModifier for one of the series in the collection. But if I add the modifier in the XAML of my control as follows, I get a NullReferenceException.

<scv:SciChartSurface.ChartModifier>
  <scc:ModifierGroup>
    <scc:SeriesValueModifier/>
    <!-- other modifiers  -->
  </scc:ModifierGroup>
</scv:SciChartSurface.ChartModifier>

Exception stack trace:
at Abt.Controls.SciChart.ChartModifiers.SeriesValueModifier.c1a531b1c42b9ab0451eceb19120d18fc(IRenderableSeries c05145c4df3be7fd753b3248c336dae8d)
at A.c19dd4d74f6373c95c517d29624d76e4b.cacf72b657252e3e73860afb89d70cb9f[c13c28af86f0b14202b9c7ef43b1bd11a](IEnumerable1 c40a30a1bb6416cd164565919fdef15a9, Action1 c885aac61bc9832561b7ff07903c88d5e)
at A.c19dd4d74f6373c95c517d29624d76e4b.cacf72b657252e3e73860afb89d70cb9f[c13c28af86f0b14202b9c7ef43b1bd11a](IEnumerable c40a30a1bb6416cd164565919fdef15a9, Action1 c885aac61bc9832561b7ff07903c88d5e)
at Abt.Controls.SciChart.ChartModifiers.SeriesValueModifier.OnRenderableSeriesCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection
1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at Abt.Controls.SciChart.Visuals.SciChartSurface.c914ae6e949e85ff0bd26d406a09606d1(IChartSeriesViewModel cb3791dede44f6f025adf5a17149fa8bf)
at Abt.Controls.SciChart.Visuals.SciChartSurface.OnSeriesSourceDependencyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.WeakEventManager.ListenerList.DeliverEvent(Listener& listener, Object sender, EventArgs args, Type managerType)
at System.Windows.WeakEventManager.ListenerList1.DeliverEvent(Object sender, EventArgs e, Type managerType)
at System.Windows.WeakEventManager.DeliverEventToList(Object sender, EventArgs args, ListenerList list)
at System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
at System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection
1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at MS.Internal.FrameworkObject.OnLoaded(RoutedEventArgs args)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

  • You must to post comments
0
0

Hi Alexander,

Thank you for reporting! I’ve glanced through the source code of SeriesValueModifier and possible reason is that the SciChartSurface.Annotations property is set to Null. Please, check if you have binding to the annotations collection in the code, and if so, please, ensure it is initialized before the SeriesSource property.

If this isn’t your case, could you please help us to reproduce the issue in a small sample project? This helps to locate/fix issues fast. We appreciate your help!

Best regards,
Yuriy

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.