Spark line "above" Axis line possible ?

3 posts, 0 answers
  1. Stéphane
    Stéphane avatar
    8 posts
    Member since:
    Dec 2012

    Posted 04 Sep 2013 Link to this post

    Hello,
    Is it possible to have the spark line above axis line? The problem is when data are zero, the spark line is hidden under axis line, the same as if there is no data...

    Thanks
    Stephane
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 05 Sep 2013 Link to this post

    Hello Stephane,

    You can use the Panel.ZIndex attached property to position the Polyline on top of the Line element in the Template of the sparkline. For example:

    <Style TargetType="telerik:RadLinearSparkline" BasedOn="{StaticResource RadLinearSparklineStyle}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:RadLinearSparkline">
                    <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid>
                            <Path Fill="{TemplateBinding NormalRangeFill}"
                                Data="{Binding NormalRangeRect, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource RectToRectangleGeometryConverter}}"
                                Visibility="{TemplateBinding NormalRangeVisibility}" />
                            <Polyline Visibility="{TemplateBinding LineShapeVisibility}"
                                        Panel.ZIndex="10"
                                    Style="{TemplateBinding LineShapeStyle}"
                                    Points="{Binding LinePoints, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource PointCollectionCloneConverter}}"
                                    StrokeLineJoin="Round"
                                    Stroke="{TemplateBinding LineStroke}" />
                            <Line Stroke="{TemplateBinding AxisStroke}"
                                StrokeThickness="1"
                                X1="0"
                                Y1="{TemplateBinding ZeroYPosition}"
                                X2="{TemplateBinding AxisWidth}"
                                Y2="{TemplateBinding ZeroYPosition}"
                                Visibility="{TemplateBinding AxisVisibility}">
                            </Line>
                            <telerik:IndicatorsContainer Name="PART_IndicatorsContainer"
                                                        ItemStyle="{TemplateBinding IndicatorStyle}"
                                                        ItemsSource="{TemplateBinding IndicatorsPoints}"
                                                        Visibility="{TemplateBinding IndicatorsVisibility}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    For additional information on RadControls for WPF support for implicit styles, please refer to our online documentation.

    Regards,
    Tsvetie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stéphane
    Stéphane avatar
    8 posts
    Member since:
    Dec 2012

    Posted 06 Sep 2013 Link to this post

    Ok thank you.

    It will be good to have a  'LineZIndex'   Property in the SparkLine controls.

    For now, I do the job in the following way:
    void OnLoaded(object sender, RoutedEventArgs e)
            {
                // Set the Spark Line above the axis line
                Polyline l_Polyline = FindVisualChild<Polyline>(this);
                Canvas.SetZIndex(l_Polyline, 1000);
            }
Back to Top