1

I am trying to move a vertical line that represents the time advance.

This is the code for this vertical line creation:

XAML:

<s:SciChartSurface.RenderableSeries>
   <s:FastLineRenderableSeries x:Name="lineSeries" SeriesColor="Red" />
   <s:FastLineRenderableSeries x:Name="verticalTimeLine"SeriesColor="Green"/>                                  
</s:SciChartSurface.RenderableSeries>

The line is initialized in the code behind as follows (C#):

var verticalLineTimeSeries = new XyDataSeries<float, float>();                
verticalLineTimeSeries.Append(0.0f, 0.0f);
verticalLineTimeSeries.Append(0.0f, 10.0f);
verticalTimeLine.DataSeries = verticalLineTimeSeries;

And this is the code where i've made a test with RenderTransform to move the timeline:

TranslateTransform translateTransform = new TranslateTransform();
translateTransform.X = 400;
translateTransform.Y = 0;
verticalTimeLine.RenderTransform = translateTransform;            
verticalTimeLine.UpdateLayout();

The problem is that the line does not move at all. What am i doing wrong? Thanks in advance.

1 Answers1

1

Well, finally i've been able to resolve my problem by using Annotations. I'm going to post the code in case that someone has a similar problem

First on the Xaml part:

On UserControl Resources we set a simple style, green color and thicknes value 2:

<UserControl.Resources>

    <Style x:Key="AnnotationStyle"TargetType=" s:VerticalLineAnnotation">                        
        <Setter Property="Stroke">
            <Setter.Value>                        
                <SolidColorBrush Color="Green"/>
            </Setter.Value>
        </Setter>               
        <Setter Property="StrokeThickness" Value="2"/>                
    </Style>

</UserControl.Resources>

The annotations:

<s:SciChartSurface.Annotations>
    <s:VerticalLineAnnotation X1="0" x:Name="annotation" Style="{StaticResource AnnotationStyle}" />
</s:SciChartSurface.Annotations>

And this is the code behind to test its movement:

annotation.X1 = 5.5;
  • That's the right way! I was going to add if anyone else is wondering, RenderableSeries in SciChart are not drawn using the WPF Visual Layer, hence things like RenderTransforms wont work on them. You can offset a series, but it takes some manipulation at the data-level. – Dr. Andrew Burnett-Thompson Jan 29 '16 at 07:45