LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot data to chart with real time axis

Hi,

 

I want to plot some data from rs232 to a chart with a time based axis. I made something like the example "Variable-time Chart XY" but im getting an error : "connect 1-D array cluster of 1 element to sink cluster of 2 elements".

 

What shoud i do to fix this?

 

Thanks in advance

0 Kudos
Message 1 of 23
(5,222 Views)

You have two different types wired to the same waveform graph.

 

 

 

You have a cluster of DBL/SGL/SGL/SGL/DBL and an array of clusters[SGL/DBL].

 

Question:  Why is your code so complicated?  What are you really trying to do?  I'm sure there is a much simpler way of doing it.

 

R

 

Message Edited by Ray.R on 12-09-2009 01:12 PM
Message 2 of 23
(5,215 Views)

 

I want to plot data to chart with time axis,

 

chartplot.PNG

 

I made this and its ok, but now i want to show time on X axis.

0 Kudos
Message 3 of 23
(5,203 Views)

Problems:

 

You have a race condition.  Two sets of values being written to the same graph in parallel. I realize that you want to send the X-axis seperately, but to what values are you associating those values to (on the y-axis)?

 

What does the data from the serial port look like?  And why do you use a byte array?  Is the data all binary?

 

If so, maybe the first step is to determine the start & end of a byte array and convert it into numeric.   You read it in 12 bytes, why do you do that?  Can you ensure that it is the full / proper data frame?  Are there any delimiters or patterns to indicate start / end of data?

 

Why do you add zero to the strange timestamp?  0 does not change the value.  You're adding the strange timestamp to the data going to the graph... That's going to make things ugly..  Not only in the esthetics sense 😉

 

You should bundle the timestamp with the data in a waveform.  I would suggest a smaller number for the timestamp, but that might be a requirement that you are trying to meet.  

 

You need to describe what you want to do before getting help with this.

 

R

 

 

EDIT:  I type too slow, you've made some improvements while I was typing...  😉

Message Edited by Ray.R on 12-09-2009 01:30 PM
Message 4 of 23
(5,201 Views)

rty wrote:

 

chartplot.PNG

 

I made this and its ok, but now i want to show time on X axis.


You mean to tellme that the above code works and you are getting the desired plot? 

Maybe I am missing something, but you are probably getting to points and maybe a straight line between them.  Is this correct?

 

All you want to do is add a timestamp to those two points?  Is that correct?

Message 5 of 23
(5,196 Views)

ok, forget about the time problem and lets focus on rest first.

 

I have this:

 

Im sending many types of data to rs232 (XY acelerometer values, temperature, and others). in the chart example, i send from hardware something like "x%0.2fy%0.2f" where 0.2f is the value and the x/y is a tag that help me to know what kind of data is that.

 

So when i receive, firstly convert the string to an array and then i serach if the first position of array is an "x", if so then i know that string has data that i want to plot on chart. It enters on a case structure and then i split the array to "x%0.2f" and "y%0.2f, i remove the "x" and "y"and convert the data to decimal string to plot on chart.

 

This is working fine, i belive there are many easiers ways to do this but im begginer with labview:smileyhappy:!

 

Ok, now i have 2 plots on the same chart and i want to set the X axis as current system time (HH:MM:SS,xx).

 

Thanks for your help and forgive me my bad english Smiley Sad

 

 ---------------------------------

EDIT:

 

Yes, as far as i know it's working 🙂 

 

Sem título.PNG

Message Edited by rty on 12-09-2009 01:03 PM
Message Edited by rty on 12-09-2009 01:05 PM
0 Kudos
Message 6 of 23
(5,184 Views)

You can use an XY graph and get what you are looking for. See blow

 

Example.png

Tim
GHSP
Message 7 of 23
(5,177 Views)
and how i get the time ? with the get data/time string of timing palette?
0 Kudos
Message 8 of 23
(5,164 Views)
That would work.
Tim
GHSP
0 Kudos
Message 9 of 23
(5,156 Views)

u mean this ?

 

error.PNG

 

 

0 Kudos
Message 10 of 23
(5,150 Views)