From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-24-2005 03:49 AM
I am historically trending production data over the working week between 7am – 3pm. If my graph displays the previous x number of days data (governed by numeric control), the plot is broken because the x-axis is on a continuous time scale which means it also shows weekday evenings and weekends. I would like to edit my code so the graph only shows shift times and excludes these ‘gaps’ in the data.
Does anyone know how to format the scale to show only the production shifts? I have attached my code to show how I’ve put this together.
Many thanks for the help
Stuart
11-24-2005 04:55 AM
Hi Stuart,
I'm pretty sure that there is no way that you can configure a graph scale to be broken/non-continuous.
If you want to reduce or eliminate the gaps in your data, you will probably have to manipulate the "time" element of the data, before plotting.
Mark
11-24-2005 06:43 AM
11-24-2005 07:07 AM
11-24-2005 07:15 AM
Hi Stuart,
I don't believe there's anything you can do in a LabVIEW graph to "break up" an axis' scale (which is what I thought you were hoping to do).
11-24-2005 08:12 AM
11-24-2005 09:29 AM
Stuart,
If you want to plot a running average simultaneously with your existing graph plotting, then you must calculate the running average within the same loop then take the existing plot data and the average plot data (with x-axis values), wrap each plot data aray as a cluster, then build the two clusters into an array of clusters (effectively an array of plots) and pass to the graph terminal.
If you must plot the trendline/average after the main data has been plotted (outside the loop) then you could use code similar to the VI I've attached. Keep in mind that the data type for my graph's plots is "array of plots" where each plot is a "clustered array of clusters of [x,y] coordinate points" which is slightly different to yours.
Hope there's something useful in there somewhere.
Mark.
05-23-2021 05:02 AM
>Thanks to both of you for helping out, i was unaware of the options available in the read traces vi. Mark, although i've managed to remove the breaks from the plot,
I'm wondering how to do that; that is to say, have the plot not show the span of weekends in the x-axis when the X-axis data exists for weekdays only.
05-24-2021 12:45 AM - edited 05-24-2021 12:51 AM
This is something which by definition can't be done automatically*. You give the XY graph an array of arbitrary X values and now you want the graph to somehow decide which arbitrary gaps should be compressed and which shouldn't. It wouldn't have any way of knowing how to do that without some guidance, so Mark's reply is still true after 15 years - you need to compress the time element yourself to remove the gaps, while keeping track of what goes where.
Once you do that, you will also need to hide the X scale and redraw it on your own, as now the values in the data no longer correspond directly to the values in the scale. You can use a picture control and the graph's Map XY to Coords method to decide where to place your text for each marker. You will also need to account for updates/scrolling/resizing/zooming, etc. You can also use the graph's plot picture properties to embed the picture in the graph, but that would require you to manage the Y scale as well.
* Yeah, you could say "my values have relatively fixed gaps when they exist, just use that to figure out the missing sections", which may or may not be your situation, but that's not a guarantee for every data set.
Side note - there is a Marker Values[] property for the scale, but as far as I know, it just controls which values are shown in the scale, and the gaps between the scale markers are still determined by the mapping (linear or logarithmic). I don't know of a way to set an arbitrary gap in the graph grid/scale.
05-24-2021 02:33 AM - edited 05-24-2021 02:34 AM
Thanks for your comment.
>Mark's reply is still true after 15 years - you need to compress the time element yourself to remove the gaps, while keeping track of what goes where.
I guess I don't understand what he did based on this thread.
I made progress another way by using dual X axis feature, where you put sequential numerical days for data that exist in the bottom X axis and timestamp in the second (upper X axis). I'll come back and post a code snippet in ~24 h. It looks promising, but there is still some adjustments to make to get it right. Advice of different sorts will be needed I expect.
>Side note - there is a Marker Values[] property for the scale,
Could be that this will come in useful.