LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

chart not scaling correctly

Hi,  I have attached a VI that I'm having trouble with.

 

I have three cases which run DAQs, they then process the data and plot it on a chart.  At the moment I am only trying to get the 'Daily Check' case to work.

The program runs and handles the data correctly, but the chart doesn't scale the x axis correctly.

Can anyone give me some pointers please?

0 Kudos
Message 1 of 10
(3,304 Views)

You forgot to include the subVIs needed from the user.lib which is likely some kind of toolkit I'm unaware of.  You also have alot of code that doesn't look needed, or serving any purpose.  It's hard to understand what you want it to do because of this.

 

How is the X axis not scaled correctly?  You can define your own scale for graphs and charts with property nodes but I can't say that this is really want you want because I don't understand what you want.

 

Only looking at the Daily Check, you create an array with size zero.  Then you replace a single element of this array (which is empty remember) with a single data point.  Thid data point looks like it was a double, but for some reason you turned it into an array of doubes, then added all the elements to that array (which was only 1 item) then divide by 100.  The index you replace at is your timestamp converted to a 64 which will be some very large number, but it doesn't matter because your array is empty.  Then you take that empty array and convert it into a 2 by 2 array and graph that.

0 Kudos
Message 2 of 10
(3,281 Views)

"but the chart doesn't scale the x axis correctly"

 

0 Kudos
Message 3 of 10
(3,280 Views)

@RavensFan wrote:

"but the chart doesn't scale the x axis correctly"

 


Oh thanks I missed that part.

0 Kudos
Message 4 of 10
(3,278 Views)

I actually had more in my message then that, which I was actually typing before I ever saw your message.  There was a hiccup in the post, I backed up, resubmitted, and for some reason only the first line came through.

 

The rest of my post was basically:

 

There is no information in that sentence for us to be able to help you.  There are thousands of ways something can work incorrectly, and only a few where it can work correctly.  You will need to tell us some more about how it is not working write before we can even guess what is wrong.

0 Kudos
Message 5 of 10
(3,264 Views)

Yeah a lot of the arrays probably aren't needed, they are left overs from trying to figure this out.  The one that is just adding a time stamp is left over from a previous attempt.

 

 

The insert into array and then reshape array is the only way I hav found of getting the chart to work.  In the other two cases I will be supplying the chart with 2 or 3 datasets to display.

 

The issue that I'm seeing in the daily check case is that the x axis doesn't appear to scale correctly.  So when I run the VI the numbers on the scale are correct.

I set a test time of 10m32s, and the scale correctly shows that, but when the program has been running for 10m32s and stops the data points on the graph only go upto about 8.

 

I think it's something todo with the time delay that I'm using actually, don't know why I didn't look at that before.

 

Anyway the basic premise is for the DAQ to capture some data and take an average of those points, then add it to an array (which will be exported to a csv later).

 

I have attached the other VI's that are part of the project.

Download All
0 Kudos
Message 6 of 10
(3,249 Views)

Your chart does not receive any timing information, just a plain 2D array. Thus dx is set as 1s, no matter what the actual loop time, and thus the update rate is. Your update rate seems to be variable. sometimes  ~0.85 seconds and sometimes infinite, if the code is trapped inside the inner timed loop.

 

Your code needs major cleanup to be useful. Did you notice that is uses 100% cpu(one core) if doing nothing? Calibration does not work if the code is trapped inside the inner loop. Exit does not work unless stop is pressed first. Why do you think you need to rewrite the same background color as fast as the computer allows?

0 Kudos
Message 7 of 10
(3,243 Views)

Thanks, I hadn't noticed the CPU usage, or thought about the background colour updating constantly.  I've not even tried to get the calibration VI working yet.  Anyway they are now outside the loop.

Thanks for your explanation of the chart, your description is how I thought it should be working.  I don't like the way that I'm using a time delay to try and control the timing, but I've not managed to get a timed loop to work yet.

0 Kudos
Message 8 of 10
(3,239 Views)

Oh, and we'll call the exit button functionality a happy accident.  Again I've not tried using it, I just stop the execution with the IDE, but it's beneficial that exit doesn't work unless stop is pressed first.

0 Kudos
Message 9 of 10
(3,235 Views)

Do not make it a habbit of using the red stop button.  That should not be seen when the program is running.

0 Kudos
Message 10 of 10
(3,232 Views)