Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort entries in a scatterplot

Hi all!

I'm using a scatter plot where I append values read from a TCP/IP connection. The x-axis represents the time. I some cases due to buffering delays values may be received in wrong order and hence plotted in wrong order, e.g. values with timestamp 1,2,3,10,4,5,6,7,8,9. The result is a graph that may jump back and forth in time.

 

1. Is there a way to sort the entries already inserted in a ScatterPlot?

2. Or, do I have to implement a smarter usage of PlotXYAppend, that actually plots in correct order?

 

Best regards, Björn.

0 Kudos
Message 1 of 2
(3,900 Views)

Unforunately the API does not support a method of sorting the plotted data points. I suppose it is not a very common use case. Ideally the data would be sorted before it is plotted. However if that is cumbersome for your application, you could retrieve the data from the plot using GetXData and GetYData, sort the data, then clear the plot and replot. If you did this before every data point you plotted it may have the same effect. Essentially this is what our API would be doing behind the scenes if this functionality existed anyway. The downside is that it may have a performance hit if you are using thousands of data points.

National Instruments
0 Kudos
Message 2 of 2
(3,891 Views)