Pre loader

Tag: ZOrder

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 votes
7k views

Hi there,

I’m having an issue showing selected points on top of all other series.

I have created a polygon selector chart modifier based on the following knowledge article: http://support.scichart.com/index.php?/Knowledgebase/Article/View/17237/32/custom-chartmodifiers—part-3—custom-select-and-drag-a-series

Specifically, the issue that I’m having is that when the user does the polygon selection if the last point of the polygon is on one of the other series, the series shows above the selected points.

http://support.scichart.com/index.php?/Knowledgebase/Article/View/17180/28/changing-z-order-of-renderableseries

I have tried to set IsSelected = true (from above link), but that doesn’t seem to work. Is there another way of doing it? Or am I doing it at the wrong place? I have tried to set the IsSelected = true right before and right after I add the selected point series to the surface.

I have added two images, the first is how the points are currently drawing, and the second of how it should look every time.

0 votes
12k views

Hello
I’m working on a WPF app. Everything is OK except that I don’t understand how to render the series above the annotations.
The XAML code is the following:

<s:SciChartSurface Name="sciChartSurface"
                   s:ThemeManager.Theme="SciChartv4Dark"
                   Annotations="{Binding Path=Annotations}"
                   ChartTitle="{Binding Path=GraphTitle}"
                   DataContext="{Binding Path=ChartViewModel,
                   RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type charts:ChartView}}}"
                   FocusVisualStyle="{x:Null}"
                   Focusable="True"
                   SeriesSource="{Binding Path=Series}"
                   Padding="0 5 8 0">

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


         [...]



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

    <!--  Create an X Axis  -->
    <s:SciChartSurface.XAxis>
        <s:NumericAxis AutoRange="{Binding Path=XAxis.AutoScaling,
                                           Converter={StaticResource BooleanToAutoRangeConverter}}"
                       AxisTitle="{Binding Path=XAxis.AxisTitle}"
                       DrawMajorGridLines="{Binding Path=XAxis.ShowGridLines}"
                       DrawMinorGridLines="False"
                       DrawMinorTicks="True"
                       GrowBy="0, 0.1"
                       AxisBandsFill="#1c1c1e" 
                       VisibleRange="{Binding Path=XAxis.AxisRange,
                                              Mode=TwoWay}"
                       MajorDelta="{Binding XAxis.MajorDelta, Mode=TwoWay}"
                       MinorDelta="{Binding XAxis.MinorDelta, Mode=TwoWay}"
                       AutoTicks="{Binding XAxis.AutoTicks}" 
                       />
    </s:SciChartSurface.XAxis>

    <!--  Create a Y Axis  -->
    <s:SciChartSurface.YAxis>
        <s:NumericAxis AutoRange="{Binding Path=YAxis.AutoScaling,
                                           Converter={StaticResource BooleanToAutoRangeConverter}}"
                       AxisAlignment="Left"
                       AxisTitle="{Binding Path=YAxis.AxisTitle}"
                       DrawMajorGridLines="{Binding Path=YAxis.ShowGridLines}"
                       DrawMinorGridLines="False"
                       DrawMinorTicks="True"
                       GrowBy="0.1, 0.1"
                       IsPrimaryAxis="True"
                       AxisBandsFill="#1c1c1e" 
                       VisibleRange="{Binding Path=YAxis.AxisRange,
                                              Mode=TwoWay}"
                       MajorDelta="{Binding YAxis.MajorDelta, Mode=TwoWay}"
                       MinorDelta="{Binding YAxis.MinorDelta, Mode=TwoWay}"
                       AutoTicks="{Binding YAxis.AutoTicks}"
                       />
    </s:SciChartSurface.YAxis>
</s:SciChartSurface>

Edit: this is the code that creates the horizontal annotation:

 /// <summary>
    /// Creates a chart annotation
    /// </summary>
    /// <param name="a"></param>
    /// <returns></returns>
    private AnnotationBase CreateChartAnnotation(Annotation a)
    {
        HorizontalLineAnnotation annotation;

        //not used??
        //ColorToBrushConverter brushConverter = new ColorToBrushConverter();

        annotation = new HorizontalLineAnnotation() { Y1 = a.ThresholdValue.Value };
        annotation.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(a.Stroke));
        annotation.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
        annotation.IsEditable = false;
        annotation.LabelTextFormatting = string.Format("{0} 0.0", a.Label);
        annotation.StrokeThickness = 2;
        annotation.LabelPlacement = LabelPlacement.Axis;
        annotation.ShowLabel = a.ShowLabel;
        if (a.DashArray != null)
        {
            annotation.StrokeDashArray = new DoubleCollection(a.DashArray);
        }


        return annotation;
    }

I tried to set AnnotationCanvas.BelowChart but the behaviour is very strange: the horizontal annotation line is no more continuous
I attached two jpegs

Regards
Gianpaolo

1 vote
5k views

I have a scatterplot with different series of points and I need to figure out a way to draw each point separately in a different Z order. This will acheive “layering” of the points based on some metadata criteria.

The main issue to solve here is as follows. Each series can have “highlighted” points (outlined in blue on the chart, uses SciChart point selection) and “selected” points (denoted by a star point marker) which are tied to a selection in a grid. Any point in any of the series can be Highlighted and/or Selected. I need the the non-selected and non-highlighted points to be drawn first, then the selected points, then the highlighted points. This would guarantee that the highlighted points are always drawn on top of all others, and the selected points drawn on top of all but the highlighted.

My attempt has been to create a custom chart modifier and override OnParentSurfaceRendered. In that method I build dictionaries of points based on the metadata grouping criteria, then start with the lowest Z index group (the non-highlighted and non-selected points) draw those points, and continue up to the highest Z order group (the highlighted points).

Is there a simpler way to achieve this point layering functionality across data series?

Thanks.

Showing 3 results

Try SciChart Today

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

Start TrialCase Studies