Jump to content

XY Chart in LabView 7.1?


kelbro

Recommended Posts

I have found the XY graph but I am trying to chart Voltage on the X axis and Current on the Y axis. The XY Graph just displays points but does not chart. Any ideas?

Thanks

"does not chart," does not compute for me. What exactly do you mean?

If I guess what you mean...

The XY graph will graph properly formed ordered pairs. You can plot multiple plots, but I won't try to describe the details of that data type in words, you can look it up. If you want an XY to update with new data you can give it new data. Put it in a loop and it looks like it is growing.

The point of XY is that you are not forced to have ever increasing x data as with "waveforms." A wave is by nature a temporal phenomena thus the x is always increasing by some increment. Waveform data does not even require x data - instead you give it an intial value and the increment.

With an XY you can do tricks like draw a circle around a particular datum programatically or introduce max and min lines, lisajous plots, and so on.

Are you with me?

Mike

Link to comment

Thanks Mike. I guess a better description is that I want it to scroll the data points across like the chart below. I am wanting to plot the sample of the Voltage readings from the meter on the Y axis and plot the Current readings on the X axis. My goal is to display the point that the voltage folds back when the current limit is reached.

post-2007-1134679704.jpg?width=400

Thanks

"does not chart," does not compute for me. What exactly do you mean?

If I guess what you mean...

The XY graph will graph properly formed ordered pairs. You can plot multiple plots, but I won't try to describe the details of that data type in words, you can look it up. If you want an XY to update with new data you can give it new data. Put it in a loop and it looks like it is growing.

The point of XY is that you are not forced to have ever increasing x data as with "waveforms." A wave is by nature a temporal phenomena thus the x is always increasing by some increment. Waveform data does not even require x data - instead you give it an intial value and the increment.

With an XY you can do tricks like draw a circle around a particular datum programatically or introduce max and min lines, lisajous plots, and so on.

Are you with me?

Mike

Link to comment

Assuming you feed the graph an X array and a Y array that define the points and if the ordering of the points within the X array is increasing then you should get a graph. You may need to adjust the line type property of the graph to "connect the dots" if all you are getting are the data points.

Link to comment
Thanks Mike. I guess a better description is that I want it to scroll the data points across like the chart below. I am wanting to plot the sample of the Voltage readings from the meter on the Y axis and plot the Current readings on the X axis. My goal is to display the point that the voltage folds back when the current limit is reached.

Thanks

This is what an XY graph does:

You give it a SEQUENCE of ordered pairs and it plots them. If you want lines drawn between ADJACENT points then it will do that. All you have to do is get the sequence in the correct order.

The only way you can get a chart like you describe from voltage and current is if ALL the current data is exactly a particular increment apart and ever increasing.

Is that how your data looks? If the current EVER is less than the voltage then the graph will double back on itself. How could it be other wise?

You can do that and get a scroll effect in this way:

In a while loop you have your XY graph and the single point aquisition function fetching from the two channels, one for voltage and one for current. Every time the loop runs you get a new ordered pair of current and voltage. There is a shift register on the loop (I am going to let you figure out the data structure on your own - if you are going to use XY graphs you need to learn that). Every iteration of the loop adds the new data to the shift register and the XY graph gets its data from that shift resiter.

This way everytime you get new data the data is added to the plot of the XY graph and the graph updates immediately.

Now, here is a question. What is the point of watching the graph build point by point? If there is no good reason, as in you need to make some real time decision based on the readings, then don't do it this way. Simply gather the data in a buffered read and plot it afterward.

I have a feeling that you have not actually plotted anything in an XY graph yet. It would be a good idea to mess around with it if you haven't. Create a data set with a random number generator ands experiment with the XY graph a bit. You can plot the data from to randoms as oredered pair and XY that. Then try to get multiple plots on the same graph. Then you will understand what I am getting at completely.

On second thought attached is an example that makes XY and "clusterrays" them into a multiplot.

Download File:post-48-1134692338.vi

Link to comment

Thanks for the direction. I have only been messing with this for a couple of hours. I was seeing a single point, centered with the data ranges across X and Y. Tried connecting, the dots. No luck. I will try the SR. That may be the ticket. I need to see the 'knee' where the voltage rolls off at the specified current level.

I will give this a try and report back.

Thanks again!

This is what an XY graph does:

You give it a SEQUENCE of ordered pairs and it plots them. If you want lines drawn between ADJACENT points then it will do that. All you have to do is get the sequence in the correct order.

The only way you can get a chart like you describe from voltage and current is if ALL the current data is exactly a particular increment apart and ever increasing.

Is that how your data looks? If the current EVER is less than the voltage then the graph will double back on itself. How could it be other wise?

You can do that and get a scroll effect in this way:

In a while loop you have your XY graph and the single point aquisition function fetching from the two channels, one for voltage and one for current. Every time the loop runs you get a new ordered pair of current and voltage. There is a shift register on the loop (I am going to let you figure out the data structure on your own - if you are going to use XY graphs you need to learn that). Every iteration of the loop adds the new data to the shift register and the XY graph gets its data from that shift resiter.

This way everytime you get new data the data is added to the plot of the XY graph and the graph updates immediately.

Now, here is a question. What is the point of watching the graph build point by point? If there is no good reason, as in you need to make some real time decision based on the readings, then don't do it this way. Simply gather the data in a buffered read and plot it afterward.

I have a feeling that you have not actually plotted anything in an XY graph yet. It would be a good idea to mess around with it if you haven't. Create a data set with a random number generator ands experiment with the XY graph a bit. You can plot the data from to randoms as oredered pair and XY that. Then try to get multiple plots on the same graph. Then you will understand what I am getting at completely.

On second thought attached is an example that makes XY and "clusterrays" them into a multiplot.

Link to comment
Thanks for the direction. I have only been messing with this for a couple of hours. I was seeing a single point, centered with the data ranges across X and Y. Tried connecting, the dots. No luck. I will try the SR. That may be the ticket. I need to see the 'knee' where the voltage rolls off at the specified current level.

I will give this a try and report back.

Thanks again!

Rigth click on the XY graph and go to Visible Item check the Plot Legend.

Then right click the plot legend that comes up. You get to choose whether it is a line graph, bar chart, etc.

I don't savvy SR.

You need to understand the data structure that it takes to run an XY graph. I cannot stress that enough. You can look at the example I sent you.

You can make an ordered pair by placing a cluster on the Front Panel (FP), then drop 2 numeric control into it.

To make a plot you put an array control on the FP and drop the previous cluster into it.

To make a multi plot put another empty cluster on the FP and drop the plot into it.

Then put an empty arrary on the FP and drop the clustered plot into the array.

Stated differently the XY Graph wants an array of clustered piars of numbers.

A multi plot XY Graph wants an array of clusters, in each claster is a plot (which is an array of clstered points).

The easy way to create the "prototype" of a data structure is to go to the XY graph indicator on the Block Diagram (BD), right click on the input terminal and pick out Create/Constant or Contro or indicator. You will get the correct data structure for any of those.

In my example that is how I created the constant that initializes the shift registers.

Do you understand shift registers? You will need to understand these to get your charting to work. All that is in the example I sent.

If you want to watch the example in highlight mode you will want to lower the delay for the loop which I set to 400ms. (The little metronome icon.)

I hope I am not offending you by assuming you just cracked LV for the first time. It is maybe faster to just go all the way click by click. I can't know what you DO know.

Mike

Link to comment
Assuming you feed the graph an X array and a Y array that define the points and if the ordering of the points within the X array is increasing then you should get a graph. You may need to adjust the line type property of the graph to "connect the dots" if all you are getting are the data points.

WMassey,

Can you do that in LV8? Feed it 2 arrays?

All the XY graphs I have used require arrayed[clustered( ordered pairs)]

Mike

Link to comment
WMassey,

Can you do that in LV8? Feed it 2 arrays?

All the XY graphs I have used require arrayed[clustered( ordered pairs)]

Mike

When I said "feed the graph" I didn't mean to be taken quite so literally.

I would assume** that the clustering of the arrays, like this:

post-2800-1134768671.png?width=400

is needed for LV8 just like it has always been. Sorry for any confusion.

** I say assume because I have not been masochistic brave foolish enough found any pressing need to install any one of the three copies of LV8 I have sitting on the floor of my office.

Link to comment
When I said "feed the graph" I didn't mean to be taken quite so literally.

I would assume** that the clustering of the arrays, like this:

post-2800-1134768671.png?width=400

is needed for LV8 just like it has always been. Sorry for any confusion.

** I say assume because I have not been masochistic brave foolish enough found any pressing need to install any one of the three copies of LV8 I have sitting on the floor of my office.

I am glad I asked. I didn't know there are 2 data structures that work to feed an XY graph. Attached image.

I have been doing it the hard way for some reason I can not recall.

Mike

post-48-1134772447.jpg?width=400

Link to comment
I have found the XY graph but I am trying to chart Voltage on the X axis and Current on the Y axis. The XY Graph just displays points but does not chart. Any ideas?

Thanks

There is a shipping example called XY chart which I believe does just what you want. I'm attaching a somewhat improved version of this. The main advantage of this over a chart is that the chart needs to have a constant multiplier whereas here you can have different gaps between data points and still have accurate timing.

Download File:post-1431-1134896705.llb

Link to comment
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.