06-14-2017 10:05 PM
Hey guys!
I'm trying to create a new data set, and plot a curve with it.
The new data set I want to create is "File number vs. The maximum value it holds"
The final shape I want it to be in attached in the "NewDataSet.png" image.
So the x-axis being the file numbers and the y-axis being the correlating file's maximum value.
My initial thought was to use the
Data.Root.ChannelGroups(1) Data.Root.ChannelGroups(1).Channels("Raw").Maximum
codes with loops, but I have no idea on how to group this information to create a plot.
Is there a way of creating a channel with
Data.Root.ChannelGroups(1), Data.Root.ChannelGroups(2), Data.Root.ChannelGroups(3), ... (x-axis)
Data.Root.ChannelGroups(1).Channels("Raw")Maximum, Data.Root.ChannelGroups(2).Channels("Raw")Maximum, ... (y-axis)
I think creating the plot itself would be easy, but I can't figure out a way of grouping the information I need in channels.
Excuse my wording, if something is unclear please ask me about it!
Thank you in advance!
Solved! Go to Solution.
06-14-2017 10:42 PM
Thanks will be in Kudos!
06-16-2017 02:27 AM
There are two ways.
Datafinder:
Search for your channel named "raw" ordered by date or whatever and display the property "maximum" in result display. Afterwards you can clkick on the "maximum" column and see your graph in the preview window.
Right klick on the column will allow you to load it.
Use a script:
This script will loop over all groups and store the maximum in a new channel in a new group.
Display the channel over index or create asecond channel to store the index.
option explicit const chName = "raw" if data.Root.ChannelGroups.Count > 0 then dim targetCh : set targetCh = data.Root.ChannelGroups.Add("target").Channels.Add("max",DataTypeFloat64) dim i : for i = 1 to data.Root.ChannelGroups.Count - 1 dim grpO : set grpO = data.Root.ChannelGroups(i) if grpO.Channels.Exists(chName) then targetCh.Values(targetCh.size + 1) = grpO.Channels(chName).Properties("maximum").value end if Next end if