06-09-2017 04:14 AM - edited 06-09-2017 04:17 AM
"I have searched the examples but none of them use XY graph. Is it even possible to chart in real time using this XY graph? "
1) then you should try again (e.g. "XY Graph Data Types.vi")
2) note that there is a difference between charts and graphs, the first keeps an internal buffer/history, and new values are appended, second displays only what is input to them (and to answer your question YES)
06-09-2017 04:26 AM
Here is an idea, based on something I saw here. I can take the values from the Sine functions, build them into array and use a shift register to add points at each iteration. I can send each vector to an axis on the XY graph and it will plot all the available points.
06-09-2017 04:50 AM
yup, so far everyone (including me in my answer before switched X and Y)
try this:
06-09-2017 04:51 AM
Copying from detailed help, available when using the Context Help (Ctrl-H) and hovering over an XY Graph terminal.
Displaying a Single Plot on XY Graphs
The XY graph accepts three data types for single-plot XY graphs. The XY graph accepts a cluster that contains an x array and a y array.
The XY graph also accepts an array of points, where a point is a cluster that contains an x value and a y value. The XY graph also accepts an array of complex data, in which the real part is plotted on the x-axis and the imaginary part is plotted on the y-axis.
Displaying Multiple Plots on XY Graphs
The XY graph accepts three data types for displaying multiple plots. The XY graph accepts an array of plots, where a plot is a cluster that contains an x array and a y array.
The XY graph also accepts an array of clusters of plots, where a plot is an array of points. A point is a cluster that contains an x value and a y value. The XY graph also accepts an array of clusters of plots, where a plot is an array of complex data, in which the real part is plotted on the x-axis and the imaginary part is plotted on the y-axis.
This section of the help is very useful, but I have to re-read it almost every time I want multiple plots. In your case, you currently only want a single plot, so that's a little simpler. In my snippet, I showed the use of the second option: "an array of points, where a point is a cluster that contains an x value and a y value".
06-09-2017 04:56 AM
ps: the color (and thus type) of the xy-graph on the block diagram changes depending what you wired into it
(in this thread we have brown and pink/red so far)
have a look at the labview examples again, especially the "XY Graph Data Types.vi"
06-09-2017 05:35 AM
@jwscs wrote:
@Wentao_Ji ... plz check your vi, it doesnt work! you made the same error as OP
I thought the OP wanted something like a Lissajous curve.
06-09-2017 05:52 AM - edited 06-09-2017 05:53 AM
i don't know what that is, but if its a thing .. that might be my fault then :cheers:
TIL https://en.wikipedia.org/wiki/Lissajous_curve
06-09-2017 06:00 AM
@cookie_monster9 wrote:
Here is an idea, based on something I saw here. I can take the values from the Sine functions, build them into array and use a shift register to add points at each iteration. I can send each vector to an axis on the XY graph and it will plot all the available points.
You are right here.
I thought your question was about differentiating a graph from a chart. Basically, what you want is to make a graph to behave like a chart, I guess that's what you mean by "in real time". That is going to require your extra code to maintain a history for the graph, as the chart will do automatically, and that's what everyone was talking about.
As @cbutcher and @jwscs have also mentioned, it is also possible to display multiple plots on one XY Graph, if that was your intention.
06-09-2017 06:05 AM
Yes, that's what I was thinking. The image on the Wikipedia page just reminds me of the first time of playing around with oscilloscopes and waveform generators. ![]()
06-09-2017 06:08 AM - edited 06-09-2017 06:10 AM
Wentao_Ji wrote:As @cbutcher and @jwscs have also mentioned, it is also possible to display multiple plots on one XY Graph, if that was your intention.
To be clear, my snippet only plotted one curve, of the lissajous curve type.
Edit: I failed to read clearly enough. Sorry! Sadly I can't delete my post, so an apologetic edit is the best I can manage.