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.
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.