This is a migrated thread and some comments may be shown as answers.

Spark line "above" Axis line possible ?

2 Answers 64 Views
Sparkline
This is a migrated thread and some comments may be shown as answers.
Stéphane
Top achievements
Rank 1
Iron
Stéphane asked on 04 Sep 2013, 09:46 AM
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 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 05 Sep 2013, 03:30 PM
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 >>
0
Stéphane
Top achievements
Rank 1
Iron
answered on 06 Sep 2013, 06:42 AM
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);
        }
Tags
Sparkline
Asked by
Stéphane
Top achievements
Rank 1
Iron
Answers by
Tsvetie
Telerik team
Stéphane
Top achievements
Rank 1
Iron
Share this question
or