07-17-2012 08:17 AM
I am new to Labview scripting and came across this problem when trying to script a vi containing a waveform chart. I want gain access to the chart History Data property through a reference to the chart when scripting it. For some reason it seems that Labview does not expose this property, although other chart properties are. I have attached a sample vi that I hope illustrates this. Any ideas?
07-17-2012 09:47 AM
Your VI has a property node with the History property. You can obviosly create such a node; so what's the problem?
07-17-2012 10:02 AM
The History property in this example is attached to the chart in the main form. I want to gain access to the History property for the chart in the scripted vi. The only purpose of including this one here is to illistrate what it is that I am after. If you try to create the History property for the scripted vi you will find that it is not listed.
07-17-2012
10:15 AM
- last edited on
03-28-2025
01:49 PM
by
Content Cleaner
LabVIEW Scripting is an NI Labs product and therefore not officially supported using this forum (See Technical Support in the link).
Quoted:
Technical Support
Because this is an NI Labs product, NI does not support LabVIEW VI Scripting. All technical issues should be posted on the API Community:
https://forums.ni.com/t5/LabVIEW-APIs/ct-p/7006
Disclaimer
The Scripting API is subject to change between LabVIEW versions. NI makes no guarantees that any feature or behavior associated with the Scripting API will either exist, migrate automatically, or have a functionally equivalent behavior in different versions of LabVIEW.
So i am sorry that this feature you are looking for does not exist. On the other hand, i am wondering why you want to have this feature at all....
You can try setting the default value of the indicator. It should do what you are looking for.
NOTE: Setting large arrays as default will result in huge VI files and long loading/saving times....
Norbert
07-17-2012 10:54 AM
Thank you for your response. What I really want to do is to be able to control the size of the History Data as well as set some other properties of the chart (such as Stacked?) dynamically. Seeing as how the size of the History Data buffer (for one thing) is set before the VI is loaded I was hoping I could control it by scripting the control and then dynamically loading this VI into a sub panel at run time. You mentioned "You can try setting the default value of the indicator". I'm not sure how this is possible, at least not for the History Buffer size. If you know of a technique please pass it along.
07-17-2012 10:57 AM
So you can create a History property node in one VI (the main on), but not in a newly created VI?
07-17-2012 11:12 AM - edited 07-17-2012 11:13 AM
The problem is that a newly created chart does not have a data type, so cannot show a History because it does not know what type to expose. This is indicated in the code by the fact that your newly created Chart is not a (strict) reference, but the reference from the front panel control is. You should be able to solve this issue by either creating the chart using a strict reference or wiring a DBL to it after creation. In either case, you will need a strict reference. The easiest way to get this is with a dummy chart on the front panel of your scripting code. Make sure you set the type of the dummy chart before use.
07-17-2012 11:54 AM
When I run his code, I get a chart with a data type of Double, and the History property is readily available. I really have no idea what his problem is.
07-17-2012 11:57 AM
Thanks, this helps a lot, I think I now understand why this property was not being exposed.
07-17-2012
12:01 PM
- last edited on
03-28-2025
01:49 PM
by
Content Cleaner
@Norbert_B wrote:
LabVIEW Scripting is an NI Labs product and therefore not officially supported using this forum (See Technical Support in the link).
I was under the impression (perhaps mistakenly) that since LV10 scripting is officially supported. Not that one should expect much from that support since it is a bit outside the mainstream, but official nonetheless.
DFGray's solution is a pretty good one, you can use 'Create Object From Reference' to get a copy of the Dummy chart in the New VI. Personally, I would probably create a .ctl file with the desired Chart and place it on the new VI. My usual scripting workflow is to drop as many pre-made 'chunks' (controls or segments of code) and then use scripting to make the connections. Trying to do too much from scratch is a quick way into a morass.