WPF PointLineDirection

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

NoamO
Posts: 2
Joined: Tue Jun 26, 2018 6:13 am

WPF PointLineDirection

Post by NoamO » Tue Jun 26, 2018 7:46 am

Hi,
I'm using lightningchart ultimate semibindable ViewXY graph.
How do I control the direction of the graph?

At Start
Image

A few minutes later
Image

You can see that the direction of the graph in my project starts at the end of x axis (time) and being drawn back to the origin.
Also, the x axis is moving as time passes.
I would like it to start from the beginning, and that the x axis will start moving only when the line is in 5% distancs from the end.
and will keep draw and move.
This is the code:

Code: Select all

  <lcusb:LightningChartUltimate x:Name="Cht" FontFamily="Calibri" Grid.Row="2" Margin="60 0 30 0">
                <lcusb:LightningChartUltimate.Title>
                    <lcusb:ChartTitle Visible="False" />
                </lcusb:LightningChartUltimate.Title>
                <lcusb:LightningChartUltimate.ChartBackground>
                    <lcusb:Fill Color="{StaticResource TransparentColor}" GradientFill="Solid" />
                </lcusb:LightningChartUltimate.ChartBackground>
                <lcusb:LightningChartUltimate.ViewXY>
                    <lcusb:ViewXY x:Name="ViewXy" GraphBorderColor="{StaticResource GraphBorderBrush}">
                        <lcusb:ViewXY.ZoomPanOptions>
                            <lcusb:ZoomPanOptions AxisMouseWheelAction="None" CtrlEnabled="False"
                                                  LeftMouseButtonAction="None" MiddleMouseButtonAction="None"
                                                  MouseWheelZooming="Off" MultiTouchPanEnabled="False"
                                                  MultiTouchZoomEnabled="False" RightMouseButtonAction="None"
                                                  RightToLeftZoomAction="Off" ShiftEnabled="False" />
                        </lcusb:ViewXY.ZoomPanOptions>

                        <lcusb:ViewXY.GraphBackground>
                            <lcusb:Fill Color="{StaticResource BackgroundGraphColor}" GradientFill="Solid" />
                        </lcusb:ViewXY.GraphBackground>
                        <lcusb:ViewXY.PointLineSeries>
                            <lcusb:PointLineSeries x:Name="LeftSeries" MouseHighlight="None"
                                                   MouseInteraction="False">
                                <lcusb:PointLineSeries.Title>
                                    <lcusb:SeriesTitle Text="" />
                                </lcusb:PointLineSeries.Title>
                                <lcusb:PointLineSeries.LineStyle>
                                    <lcusb:LineStyle Color="{StaticResource LineChartLeftBrush}"
                                                     AntiAliasing="Normal" Width="2" />
                                </lcusb:PointLineSeries.LineStyle>
                            </lcusb:PointLineSeries>
                            <lcusb:PointLineSeries x:Name="RightSeries" AssignYAxisIndex="1" MouseHighlight="None"
                                                   LineVisible="{Binding Common.VisualInfo.DoShowThreeGraphs, Converter={StaticResource ToFalseConverter}}"
                                                   MouseInteraction="False" ShowInLegendBox="False">
                                <lcusb:PointLineSeries.Title>
                                    <lcusb:SeriesTitle Text="" />
                                </lcusb:PointLineSeries.Title>
                                <lcusb:PointLineSeries.LineStyle>
                                    <lcusb:LineStyle Color="{StaticResource LineChartRightBrush}"
                                                     AntiAliasing="Normal" Width="2" />
                                </lcusb:PointLineSeries.LineStyle>
                            </lcusb:PointLineSeries>
                        </lcusb:ViewXY.PointLineSeries>
                        <lcusb:ViewXY.YAxes>
                            <lcusb:AxisY AxisColor="{StaticResource GraphBorderBrush}"
                                         LabelsColor="{StaticResource AxisLabelColor}" LabelsFont="Calibri Light,18"
                                         AxisThickness="0" LabelTicksGap="20" MajorDiv="20"
                                         AutoDivSeparationPercent="100" Maximum="100" MinorDivCount="2"
                                         AllowSeriesDragDrop="False" MajorDivCount="6" RangeRevertEnabled="False">
                                <lcusb:AxisY.MinorGrid>
                                    <lcusb:GridOptions Color="{StaticResource MinorGridColor}" />
                                </lcusb:AxisY.MinorGrid>
                                <lcusb:AxisY.MajorGrid>
                                    <lcusb:GridOptions Color="{StaticResource MinorGridColor}" />
                                </lcusb:AxisY.MajorGrid>
                                <lcusb:AxisY.Title>
                                    <lcusb:AxisYTitle DistanceToAxis="0" Visible="False" />
                                </lcusb:AxisY.Title>
                                <lcusb:AxisY.Units>
                                    <lcusb:AxisYTitle Visible="False" />
                                </lcusb:AxisY.Units>
                                <lcusb:AxisY.MinorDivTickStyle>
                                    <lcusb:AxisTickStyle Visible="False" />
                                </lcusb:AxisY.MinorDivTickStyle>
                                <lcusb:AxisY.MajorDivTickStyle>
                                    <lcusb:AxisTickStyle Color="{StaticResource AxisLabelColor}" LineLength="20"
                                                         Visible="False" Alignment="Far" />
                                </lcusb:AxisY.MajorDivTickStyle>
                                <lcusb:AxisY.ScaleNibs>
                                    <lcusb:AxisDragNib Color="{StaticResource ColorAxisDragNib}" />
                                </lcusb:AxisY.ScaleNibs>
                            </lcusb:AxisY>
                            <lcusb:AxisY x:Name="AxisY" AxisColor="{StaticResource AxisLabelColor}" Visible="False"
                                         MouseHighlight="None">
                                <lcusb:AxisY.Title>
                                    <lcusb:AxisYTitle Text="" Visible="False" />
                                </lcusb:AxisY.Title>
                                <lcusb:AxisY.ScaleNibs>
                                    <lcusb:AxisDragNib Color="{StaticResource ColorAxisDragNib}" />
                                </lcusb:AxisY.ScaleNibs>
                                <lcusb:AxisY.MajorGrid>
                                    <lcusb:GridOptions Color="{StaticResource AxisColorBrush}" PatternScale="1"
                                                       Visible="False" />
                                </lcusb:AxisY.MajorGrid>
                            </lcusb:AxisY>
                        </lcusb:ViewXY.YAxes>
                        <lcusb:ViewXY.XAxes>
                            <lcusb:AxisX x:Name="AxisX" AxisColor="{StaticResource AxisColorBrush}"
                                         MouseHighlight="None" LabelsColor="{StaticResource AxisLabelColor}"
                                         LabelsFont="Carilli, 16" ValueType="Time" AxisThickness="0"
                                         AutoFormatLabels="False" LabelsTimeFormat="HH:mm" ScrollMode="Scrolling"
                                         AllowSeriesDragDrop="False">
                                <lcusb:AxisX.Title>
                                    <lcusb:AxisXTitle Text="" Visible="False" />
                                </lcusb:AxisX.Title>
                                <lcusb:AxisX.MajorGrid>
                                    <lcusb:GridOptions Visible="False" />
                                </lcusb:AxisX.MajorGrid>
                                <lcusb:AxisX.MajorDivTickStyle>
                                    <lcusb:AxisTickStyle Color="{StaticResource GraphBorderBrush}" LineLength="15"
                                                         Alignment="Far" />
                                </lcusb:AxisX.MajorDivTickStyle>
                                <lcusb:AxisX.MinorDivTickStyle>
                                    <lcusb:AxisTickStyle Visible="False" />
                                </lcusb:AxisX.MinorDivTickStyle>
                                <lcusb:AxisX.ScaleNibs>
                                    <lcusb:AxisDragNib Color="{StaticResource AxisColorBrush}" />
                                </lcusb:AxisX.ScaleNibs>
                                <lcusb:AxisX.MinorGrid>
                                    <lcusb:GridOptions Visible="False" />
                                </lcusb:AxisX.MinorGrid>
                            </lcusb:AxisX>
                        </lcusb:ViewXY.XAxes>
                        <lcusb:ViewXY.Bands>
                            <lcusb:Band x:Name="band" Binding="YAxis" ValueEnd="60" ValueBegin="40"
                                        MouseHighlight="None" MaxLimit="100" UseLimits="True"
                                        BorderColor="{StaticResource ColorBandBorder}" DisableDragToAnotherAxis="False"
                                        Behind="True" IncludeInAutoFit="False" ShowInLegendBox="False">
                                <lcusb:Band.Title>
                                    <lcusb:SeriesTitle MouseHighlight="None" />
                                </lcusb:Band.Title>
                                <lcusb:Band.Fill>
                                    <lcusb:Fill Color="{StaticResource BackgroundBandColor}" GradientFill="Solid" />
                                </lcusb:Band.Fill>
                            </lcusb:Band>
                        </lcusb:ViewXY.Bands>
                    </lcusb:ViewXY>
                </lcusb:LightningChartUltimate.ViewXY>
            </lcusb:LightningChartUltimate>

Can anyone help?
Thank you

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: WPF PointLineDirection

Post by ArctionKestutis » Tue Jun 26, 2018 9:16 am

Hi,

Looks like you are building real-time monitoring application. Have you looked already through our Demo App examples. There is group of examples dedicated to this type of app. Each example has the source code, which you can inspect and modify for your purpose.
The short version: initially set XAxis minimum (where line drawing should begin) & set range (as maximum) you want maintain; now you can start adding point to you line series and set XAxis.ScrollPosition to correspond latest x-value; on each ScrollPosition update the XAxis range will shift only if value more that Maximum.

You can choose between several XAxis scroll modes. Check those from our Demo App and User's Manual chapter 5.3.1 Real-time monitoring scrolling.

Hope this helps.

NoamO
Posts: 2
Joined: Tue Jun 26, 2018 6:13 am

Re: WPF PointLineDirection

Post by NoamO » Tue Jun 26, 2018 1:05 pm

Thank you.
That's true, it's a real time app. I took a look in the user manual but it's not very informative.
Whare can I find the code snippets?

ArctionKestutis
Posts: 383
Joined: Mon Mar 14, 2016 9:22 am

Re: WPF PointLineDirection

Post by ArctionKestutis » Tue Jun 26, 2018 2:13 pm

Open Demo App, select example and click one of two buttons/icons at the top. Press Show source code… button to view the source code of selected example. The source code is available as C# and VB.NET (machine-converted). In Visual Studio you can open whole solution of Demo App (with examples as individual projects).
ShowSourceCode.jpg
ShowSourceCode.jpg (221.63 KiB) Viewed 4378 times