Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make graph draw over old data when using a PagedChart Adjuster on axis

Solved!
Go to solution

Just wanted to provide an update.

 

I figured out another way to get my desired behavior that does not involve the use of a PagedChart adjuster or a customer plot renderer. I was unable to adopt your solution into my application and did not want to spend anymore time figuring out why. Here is a brief explanation of my solution.

 

My graph's DataSource is binded to a AnalogWaveform<double>[] read-only property on my view model.

 

<ni:Graph x:Name="Graph" Margin="0" HorizontalAlignment="Stretch" Height="600" DataSource="{Binding InfoCollections, Mode=OneWay}" PlotAreaBackground="Beige">
public AnalogWaveform<double>[] InfoCollections
{
    get { return AnalogWaveform<double>.FromArray2D(_classFromModel.InfoCollections); }
}

I realized that I do not need the "shifting in time" behavior that is provided by the paged chart. So, I added a 2-dimensional (InfoCollections) array to my _classFromModel. InfoCollections is a 2 by (whatever my x axis range is) array that holds the data I want to display on the graph. Everytime I read new data from the serial port, I add it to InfoCollections and increment it's associated index that keeps track of where to put incoming data. If the index is greater or equal to whatever my x axis range is I reset the index back to 0 which effectively provides the "wraparound" behavior that I was looking for in the first place.

 

Also, I have my Adjuster property for my AxisDouble set to None in my XAML and I am now just using standard line plot renderers.

 

<ni:AxisDouble x:Name="XAxisRange" Orientation="Horizontal" Range="{Binding XAxisRange, Mode=OneWay}" Adjuster="None"/>

 

Thanks for the help!

 

0 Kudos
Message 11 of 13
(436 Views)

Sorry I couldn't be of more help. Glad you found an approach that fit your needs!

~ Paul H
0 Kudos
Message 12 of 13
(432 Views)

No apology necessary, thanks again for your help.

0 Kudos
Message 13 of 13
(427 Views)