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

Hi!

Connecting to my latest reply on this thread
https://www.scichart.com/questions/question/strange-behaviour-of-collapsing-panes#sabai-entity-content-8887
I still can’t make panes disappear correctly with multiple panes.

Here is the sample project demonstrating what you proposed on the previous thread, the first chartpane is shown but the panes do not resize.
https://drive.google.com/open?id=0B19IHNOVxrKCR21aeG4tOHlRNmM

Please make this project work as expected (i.e. there is 3 panes in the list, but only the second displayed in the list on the area of the 3 panes) to show me, how this works.

thanks.

Kristóf

  • You must to post comments
0
0

Hi Kristóf,

Unfortunately, it isn’t possible with the current implementation because SciChartGroup was designed to work as it does. And although it allows customization, there isn’t any easy way to change this default behavior to the your desired one without rewriting the control. I’m not sure if there is something we can do to help you with this.

Thank you for understanding,

Best regards,
Yuriy

  • You must to post comments
0
0

Hi Yuriy,

I am sad to hear this, but i tried a workaround which you may be able to help with.
I bind the pane list called VisiblePanes to the ItemSource. Normally it is set to ChartPaneViewModels which contains all of the chart panes. When I want to display only one, I create a new list for VisiblePanes and add the only pane which i want to display. Like this:

public void MaximizePane(ChartPaneViewModel pVM)
{
if (pVM.IsMaximized == false) //not maximized, we will maximize it now
{
VisibleChartPanes = new ObservableCollection();
pVM.IsLastChartPane = true;
VisibleChartPanes.Add(pVM);
}
if (pVM.IsMaximized == true) //maximized, we will restore all others
{
pVM.IsLastChartPane = false;
VisibleChartPanes = ChartPaneViewModels;
ChartPaneViewModels[ChartPaneViewModels.Count – 1].IsLastChartPane = true;
}
}

The problem is that I also have an AnnotationCreationChartModifier, which throws a nullreference excption in the following case.
1., Maximize a pane
2., Display the multiple panes again
3., Tryin to create an annotation.

The stack trace looks like this:
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.FromCoordinates(Double xCoord, Double yCoord)
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.FromCoordinates(Point coords)
following location: Abt.Controls.SciChart.Visuals.Annotations.AnnotationBase.UpdatePosition(Point point1, Point point2)
following location: Abt.Controls.SciChart.ChartModifiers.AnnotationCreationModifier.OnModifierMouseUp(ModifierMouseArgs mouseButtonEventArgs)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.WB(IChartModifier C, ModifierEventArgsBase D)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.TB(Action2 C, ModifierEventArgsBase D)
following location: Abt.Controls.SciChart.ChartModifiers.ModifierGroup.OnModifierMouseUp(ModifierMouseArgs e)
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. (ModifierMouseArgs , IReceiveMouseEvents , Boolean )
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. . . (IReceiveMouseEvents )
following location: Abt.Controls.SciChart.Common.Extensions.EnumerableExtensions. [ ](IEnumerable
1 , Action`1 )
following location: Abt.Controls.SciChart.Utility.Mouse.MouseManager. . (Object , MouseButtonEventArgs )

The Sichartsurface in the itemtemplate looks like this:
<s:SciChartSurface x:Name=”PART_ChartPaneView”
Padding=”0″
Grid.Column=”0″
BorderThickness=”0,0,1,1″
ViewportManager=”{Binding ViewportManager}”
SeriesSource=”{Binding ChartSeriesViewModels}”
Annotations=”{Binding ChartAnnotations,Mode=TwoWay}”

                                       >

                        <!-- Bingin the visible range of the pane to the SurfaceViewModel's visible range, connecting all panes to 
                        share the same x axis-->
                        <s:SciChartSurface.XAxis>
                            <s:DateTimeAxis VisibleRange="{Binding ParentViewModel.XVisibleRange, Mode=TwoWay}" 
                                                CursorTextFormatting="{Binding ParentViewModel.XAxisFormatting, Mode=TwoWay}" />
                        </s:SciChartSurface.XAxis>

                        <!-- Binding the visible range of the pane to the paneviewmodel's visible range property -->
                        <s:SciChartSurface.YAxis>
                                <s:NumericAxis VisibleRange="{Binding YVisibleRange, Mode=TwoWay}"/>
                        </s:SciChartSurface.YAxis>

                        <s:SciChartSurface.ChartModifier>
                                <s:ModifierGroup s:MouseManager.MouseEventGroup="ChartGroupMouseEvents">


                                    <s:AnnotationCreationModifier AnnotationCreated="annotationCreationModifier_AnnotationCreated"
                                                                  IsEnabled="{Binding ParentViewModel.IsAnnotationCreatorEnabled, Mode=TwoWay}"
                                                                  ReceiveHandledEvents="False"      
                                                                  utils:AnnotationExtension.AnnotationStyle="{Binding ParentViewModel.ChartAnnotationStyle,Mode=TwoWay}"
                                                                  utils:AnnotationExtension.AnnotationType="{Binding ParentViewModel.ChartAnnotationType,Mode=TwoWay}">

                                    </s:AnnotationCreationModifier>
                                    <s:VerticalSliceModifier Name="sliceModifier"
                                                             ReceiveHandledEvents="True">
                                        <s:VerticalSliceModifier.VerticalLines>

                                            <s:VerticalLineAnnotation Style="{StaticResource sliceStyle}"
                                                                      X1="{Binding ParentViewModel.SliceModifierPosition, Mode=TwoWay}">
                                            </s:VerticalLineAnnotation>  
                                            </s:VerticalSliceModifier.VerticalLines>
                                        </s:VerticalSliceModifier>
                                    <s:CursorModifier ReceiveHandledEvents="True" />
                            </s:ModifierGroup>
                        </s:SciChartSurface.ChartModifier>
                    </s:SciChartSurface>

Have you got any idea what is casing this?

  • You must to post comments
0
0

Hi Kristóf,

I think the reason is that the AnnotationCreationChartModifier gets detached when you remove a pane, but you still keep reference to it in a ViewModel. You should either recreate it, or, if you have binding to it, just check the IsAttached property. You shouldn’t use it when IsAttached is “False”, it will cause a NullReference exception.

Hope this helps!

  • You must to post comments
0
0

Hi Yurij,

How do I recreate it when it is declared this way in xaml and
I do not have reference to the AnnotationCreatorChartModifier itself?

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.