From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save the plot parameters of the waveform chart?

Solved!
Go to solution

Hi

 

I have a waveform chart with multiple channels, and it is possible to change the plot format(such as point size, line witdth,...) in the run-time.

I'd like to reserve the plot parameters so that I can use directly without set them again.

Do I have to record all the properties of the plots and save them as the config file?

Is there another better way to implement it?

20150717002.PNG

 

Long time ago, I wonder if there is a way to construct a control, say chart.ctl, and then I just assign the chart in the front panel to the chart.ctrl, or make them identical. Next time I just load the chart.ctrl, and assign it to the element in the front panel. But it seemed no such things...

I stil want to know how to set and get the controls configuration in the front panel in more efficient way.

Message 1 of 7
(3,615 Views)
Solution
Accepted by topic author William1225

Hi William,

 

Do I have to record all the properties of the plots and save them as the config file?

Yes. When the user can edit all this you will need to save it in a file and load&set it at program start…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,594 Views)

Hi GerdW,

 

Thanks to your cruel answer, my tears are flying now...

Am I the only one who has such a problem???

If the configuration can be represented as a control(UI) form instead of ini file, and if there is a function to assign or copy all the property(though LabVIEW passes value) to another control element, it is very convenient(for me???).

Perhaps there are some techinical problems or program design criteria that I've not consider well.Smiley Mad

0 Kudos
Message 3 of 7
(3,501 Views)

I never saw it as a problem, it's an opportunity!

 

You have two choices:

The properties are saved when you SAVE the VI.  the next time you run, you will use those saved properties.  you can change them, but when you close and open up again, they will go back to the way the VI was saved.

 

Or if you want to let the user adjust things and save it the way they left it, then simply use a DataLog file.

 

At shutdown time, read all the properties into a cluster, then CREATE/REPLACE DATALOG FILE (type = MyCluster), WRITE DATALOG FILE (MyCluster), CLOSE FILE.

That's it - three steps, four if you count the BUNDLE operation.

 

Then do similar things on startup: OPEN DATALOG FILE (type = MyCluster), READ DATALOG FILE, CLOSE FILE.  Check for errors and if it's OK, then unbundle the cluster you get and set all the properties the way they were.

 

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 4 of 7
(3,464 Views)

Hi CoastalMaineBird,

 

Sorry for my late response.

There are still some questions.

I will build an application for the VI so that I could not use the save VI option, is it true?

In fact, I do not know the difference between the datalog file and the config file.

It seemed whatever I use, it is inevitably write all the plot properties into the datalog/config file, is that right?

0 Kudos
Message 5 of 7
(3,273 Views)

Hi William,

 

in an EXE you cannot save any VIs…

 

The difference between DATALOG and CONFIG files is the file format.

No matter which format you choose: you need to save the plot properties you are interested in!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(3,261 Views)

We may be talkiung two different things - there is no "inevitably" about it.

 

When you SAVE a VI file, the properties of all the front panel controls are saved along with the code.

That's only available in the LabVIEW Development system.  You can't do that in an EXE.

 

In an EXE, you have to operate the file yourself.

 

1... Make a cluster called "My Config Stuff" 

2... In it, put a DBL called "Plot MAX"

 

On Startup:

3... Open DATALOG file "My Config.cfg"  (whatever you want to call it).  Use the cluster as the FILE TYPE.

4... Read the file

5... Close the file

6... IF there was NO ERROR, use the cluster you read to set the PLOT MAX of your chart.

 

On ShutDown:

7... Read the PLOT MAX from your chart, and put it into a My CONFIG STUFF cluster.

8... Replace or create the file "My Config.cfg", using the MY CONFIG STUFF as the FILE TYPE.

9... Write the MY CONFIG STUFF to the file.

10... Close the file.

 

Now whatever is in the MY CONFIG STUFF will be saved and restored.

 

Change the cluster to include whatever you need.

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 7 of 7
(3,240 Views)