LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding cycle count to a labview chart programatically

Solved!
Go to solution
Solution
Accepted by Simon-lee

And following some further consideration, if a graph is not completely unusable, then you can make use of Annotations to get probably what you want (assuming I haven't completely misunderstood):

Top level.png

Note this is a snippet and so can be downloaded and dragged into a block diagram to copy the code.


GCentral
Message 11 of 16
(1,419 Views)

Hi cbutcher,

Wow, that looks like it may do the trick- so I would say your interpretation is spot on.

I’ve not had a chance to fully understand and digest your solution and I wont get the chance to tomorrow.

One minor snag is my machine doesn’t like the snippet; it may be because I only have LV2017 installed. That’s not a great problem because I can replicate it for the details you have supplied.

Anyway, as soon as I have had a serious play I shall report back

 

Regards

Si

0 Kudos
Message 12 of 16
(1,391 Views)

Peculiar - I used the Code Capture Tool and the image says 2015, but I also got a message about the version being 2019 when I tried to drag it into 2017. Obviously I messed something up...

 

Attached is the code for 2017 (I checked it would open correctly this time!). I also cleared the annotations before the loop, otherwise they hang around awkwardly in the wrong places! (Just wire an empty array to the AnnotationsList property).

Apologies for the boring name...

 

Edit: It may be that setting the "Style" of the annotation to 2 will give you a vertical line, in which case you can probably get rid of the +-Infinity plot, and just ensure that the positioning is correct... (and set the Plot to 0, or leave that bundle out, because the default is 0...)


GCentral
Message 13 of 16
(1,376 Views)

Hi cbutcher,

 

I’ve downloaded your example and it runs happily on my LV17 machine.

The graph annotation isn’t something I’ve seen before; I can see a lot of future uses, especially event marking.   

One problem for me is it only works on graphs, not charts. So, I’m looking to see if I can make a graph behave like a chart.  Plus from my limited knowledge I will need to limit the array size if I’m looking at extended running times. (¼ million cycles).

 

My first attempt was to replace the ‘build array’ function with an ‘insert into array’ at index zero. Followed by a ‘delete from array’ at index 200. This gives me a buffer of constant size and does give me a graph where the cycles process across the screen. The downside is the scale and annotations don’t work as hoped.

I have tried using property nodes to read the xscale maximum, deduct 200 and write this to the xscale minimum. This lead to some odd behaviour and the screen jerking excessively.

I will have another attempt tomorrow but any suggestions would be welcome

 

Regards

 

Si

0 Kudos
Message 14 of 16
(1,352 Views)

You likely want to add more than one point at a time, so the Data Queue PtByPt VI is mostly useful as an example rather than the actual solution, but essentially what you want is a "circular buffer" - a search for which should produce some results.

 

A combination of Initialize Array and Replace Array Subset, together with something like a shift register holding an index or the "Quotient and Remainder" function should get you most of the way there. An XY Graph might be easier to make use of for this (rather than a waveform graph?)

 

You may have some luck manipulating the XScale.Minimum and Maximum properties, but it's likely to involve a fair amount of work. Depending on the refresh rate it will be more or less "jerky". Of course, reducing the refresh time will increase CPU usage, and at some point will be problematic. I confess to not having used annotations whilst manipulating this collection of properties, but believe it should work with an XY Graph (and perhaps not with a Waveform Graph).


GCentral
Message 15 of 16
(1,341 Views)

Hi cbutcher,

I’ve had the chance to experiment with your suggestions and as always, they are spot on. The Data Queue PtByPt is new to me and should make the VI layout a lot neater.

I took on board your suggestion with the XY graph and by using the XScale max/min I now have a nice scrolling graph. when I add in the annotations I still suffer a proportion of graph jerkiness so I’ve began exploring the “defer panel update” property’s and it looks like that may solve that problem.

In conclusion, I’m more than happy that your graph annotation solution solves my question with the added bonus on two extra Labview features I was previously unaware of.

Thank you and Kudos

 

Si

0 Kudos
Message 16 of 16
(1,318 Views)