Pre loader

VerticalSliceModifier NullReferenceException

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hello

I’m having problems using the VericalSliceModifier.

The first problem is the label does not line up with the line on the graph when first loading, see pic.

Vertical Slice and Label not aligned

If I resize the screen or send a data series to the chart then the 2 do align.

The next problem is as soon as I try to move the Vertical Slice I get a Null Exception error.

Here is my XAML code where I add the vertical slice

<s:SciChartSurface.ChartModifier>
            <s:ModifierGroup>
                <s:RubberBandXyZoomModifier ExecuteOn="MouseLeftButton" IsEnabled="True" IsXAxisOnly="False" IsAnimated="True"/>
                <s:ZoomExtentsModifier ExecuteOn="MouseDoubleClick"/>
                <s:MouseWheelZoomModifier XyDirection="XYDirection"/>
                <s:XAxisDragModifier DragMode="Pan"/>
                <s:YAxisDragModifier DragMode="Pan"/>                                                             
                <s:VerticalSliceModifier >
                    <s:VerticalSliceModifier.VerticalLines>
                        <s:VerticalLineAnnotation  Style="{StaticResource sliceStyleStart}" X1="2"/>
                        <!--<s:VerticalLineAnnotation Name="MarkerStop" Style="{StaticResource sliceStyleStop}" X1="0.5" IsHidden="{Binding ElementName=enableTimeMeasurement, Path=IsChecked, Converter={StaticResource InvertBoolConverter}}" />-->
                    </s:VerticalSliceModifier.VerticalLines>
                </s:VerticalSliceModifier>

            </s:ModifierGroup>
        </s:SciChartSurface.ChartModifier>

and the style resource

 <Style x:Key="sliceStyleStart" TargetType="s:VerticalLineAnnotation">
        <Setter Property="ShowLabel" Value="True"/>
        <Setter Property="Stroke" Value="Green"/>
        <Setter Property="IsEditable" Value="True"/>
        <Setter Property="LabelPlacement" Value="Axis"/>
    </Style>

and the NullReferenceException details from VisualStudio

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Abt.Controls.SciChart.Wpf
StackTrace:
at Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.GetBasePoints()
at A.O.UpdatePositions()
at A.M.set_TB(Canvas C)
at Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.AddAdorners(Canvas adornerLayer)
at Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.OnIsSelectedChanged(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.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Abt.Controls.SciChart.Visuals.Annotations.AnnotationCollection.TrySelectAnnotation(IAnnotation annotationBase)
at Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.OnAnnotationMouseDown(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at GDS_AV.App.Main() in C:\Development\GDS_AV\GDS_AV\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

I did have this working at one point and I’m not sure what I did to stop it.

Simon

Images
  • You must to post comments
0
0

ok I have sent a few posts but not sure if it’s worked as they are not currently showing here, just in case here are the answers again.

Yes I’m using v3.4.2.6778

Yes I’m using a NumericAxis on the X Axis.

I have a small test app with everything stripped out apart from the SciChart, I can send this to you if you give me an email address to send it to.

Simon

  • Andrew Burnett-Thompson
    Hi simon, send it to sales [at] scichart [dot] com and I'll pick it up. Best regards, Andrew
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies