Snippet: "query" the chart history length programmatically

Would have posted to this thread, but was concerned that the misspelled subject might keep it from being found by future searches.
I have a brute force, inelegant, very mildliy tested workaround for programmatically determining the history length of a waveform chart.  In my app, I have a single chart on my gui that is meant to display history from any one of several duplicate test stations.  To help accomplish this, I wanted each station to have its own lossy queue whose size is equal to the chart history length.  Then, whenever the user chooses to look at a different station's data, I can simply copy the entire contents of the lossy queue over to the chart.  
Here's how I "query" the chart history length programmatically:
Note: Some of this feels a little dubious, but it has seemed to give correct results so far.  Specifically, several of the XScale properties seem to refer to the graphical rendering of the scale rather than an index # to the history data.   Can't guarantee this'll work for all combos of other properties -- I tested with a fairly generic, nearly straight from the box waveform chart.
-Kevin P

Intaris wrote:
Hmm, any reason why you can't just do this?
If you don't modify the Array, it's just copying a pointer, right?  Or does this operation automatically make a copy of the data and induce horrendous performance problems?
That doesn't actually do what I need.  The "History" data array size works its way up from 0 to History Length as the app runs and data is written.  It *is* bounded, but until I fill the chart all the way up, this method won't reveal what that bound is.  I need to size up those lossy queues at the beginning of the program, before any data has been written to the chart.
As to the other comments so far:
- I chose charts over graphs to get some of the built-in features of charts for real time monitoring rather than having to manage them myself.  Things like zooming the X range, horizontal scrolling to show different segments of the history, that kind of thing.
- just absorbed the followup comment about writing a dummy oversized array to the chart before running the quoted snippet above.  Yeah, that oughta work.  I just don't like the general case of not knowing how big a pre-write I need to do.  I guess it wouldn't be too bad to loop while writing the same big-but-not-crazy-big array until the History size is smaller than the # of samples written.  
  The main hitch I see in that approach is that I'd like this to be  a reusable utility vi, but a subvi that works by filling up the History would need prior knowledge of the chart datatype.  (Just thinking out loud here, overall it does kinda feel cleaner than the stuff I was doing with the scale properties.)
FWIW, a little more testing led me to modify and simplify my snippet b/c the previous one might leave the X scale looking different on exit than it appeared originally.  Seems like a side effect of the way those properties are kinda more about the display of scale information than about actual index #'s.   Anyhow, here's v2, but hopefully someone else has a better generic v3 they can offer:
-Kevin P

Similar Messages

  • Programmatically changing chart history length

    I'm creating a VI where the user can choose the data sample rate via the wait(ms) used in a while loop. However changing the sample rate effects the time length being displayed on the chart. This is dependent on the chart history length, originally I thought I could just change this programmatically, but the history length doesn't appear on the property node.
    I've had a look at the advice in the ni support section:
    http://digital.ni.com/public.nsf/allkb/E9784F413A2269E086256F3A0064C8BB
    This method seems a bit messy (especially when I'll be doing this for a number of charts), although I couldn't open the example as its v7.1 and I have v7.0.
    Is there anything I can do?
    Help would be appreciated (deadlines approaching)

    The entire point of using a chart is that you update only the last value, so there is no point in writing the history data every loop. For that you can use a graph, which will allow you to do this without using a property node.
    The history length is not supposed to control how much data is currently displayed on the screen, but how many points are kept in the buffer, so you can scroll back and see them. When you change the length of the history data array, the chart doesn't seem to like it. It starts acting a bit crazy. Also, keep in mind that there is no point in displaying 1000 points if your chart is 600 pixels wide.
    There are problems with what you want to do, like if you add points, where do the extra points come from, or since a chart uses a constant multiplier, what happens to the old data when you change it and so on.
    I've modified your example slightly, so that it doesn't write to the property every time and so it handles the enlarging the history buffer case, but it's still buggy and needs more work.
    The main problem is that the History property doesn't change the chart length. If I understood you correctly, and you want to constantly display the last X seconds, I still think your only viable option is using a graph. The transition should be fairly simple and if you use a shift register it can handle it.
    Try to take over the world!
    Attachments:
    chart.vi ‏63 KB

  • Chart History Length

    Is there a way to programmatically change the Chart History Length of a Chart Graph Indicator?

    Hi Dude,
    no.
    Option:
    Use graphs and maintain your own buffer...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Why do i get crashes when setting chart history length

    I am trying to figure out how to get my chart to eat up less memory. At the moment it is capturing from 4 channels at 44100 samples/sec. It is a continuous capture and after a few minutes, the computer just runs out of memory and can no longer keep up with the capture, at which point the Vi quits. Opening up task manager, I noticed that as I capture, the memory gets chewed up really quickly, but when I stop my VI the used memory is not reclaimed. Even if I set the chart history to an empty array when the VI stops. I tried setting the chart history to a smaller number but whenever I set it below 512 the whole computer crashes.

    I have seen similar problems. I created a simple VI to test this and am continously getting LabView crashes when I try and write an intensity chart history to an array.
    First frame of the vi sequence generates a 100 random number array for the intensity chart display. The next frame in the sequence has the property node for chart history (of the intensity chart)set to read mode and it is wired to a two deminsional array.
    So, I generate psuedo chart data and then try to recover the history into an array. It crashes every time. No matter where I set the chart history length. I attempted to do as you had previously suggested and store the data to a file. Same response.... Crashes LabView. Local and online help have not been very hel
    pful. Will search the hardcopy literature now.
    thanx
    WLS
    Attached VI
    Attachments:
    history_grabber.vi ‏22 KB

  • How do I programmat​ically set chart history length?

    How do I programmatically set chart history length?

    Hi, u could try instead of using a chart, u could use an xy graph with a chart buffer and with the chart buffer defining the length/amount points needed. And this also mimics what happens in a chart.
    Stuart
    Attachments:
    XY_Chart_Buffer.vi ‏54 KB

  • Set up history length programmatically

    Hi,
    I have a waveform chart and I would like if it is possible to change the history length programmatically. Is it possible?
    Thanks,
    ToNi.

    Hi,
    I have a waveform chart with a history length of 28800 points visible and I take a sample with a frequency of 1 second and I plot it. (I acquire data with and acquisition card). Then, I would like the user can choose the number of hours (1 to 24 hours) to visualize in the waveform chart from a configuration window and also he can modify the frequency to take the sample (1 to 60 seconds). Then each time he modify these parameters, the number of houres (1 to 24) and the frequency to take samples (1 to 60 seconds), I set up the history length from them doing the following operation:
    (60 seconds/frequency to take sample) * 60 minutes * number of hours = history length. (number of points taken during the hours you set up)
    where:
    (60 seconds/frequency to take sample)  : is the number of samples took during a minute
    (60 seconds/frequency to take sample) * 60 : is the number of samples took during an hour
    (60 seconds/frequency to take sample) * 60 minutes * number of hours: is the number of samples taken during the number of hours you set up
    So I only have the number of points in the history length necessary and not more.
    Thanks,
    ToNi.

  • Graph & chart history length

    I was wondering why "chart" has got a "chart history length" property for the length of the displayed data, 
    but "graph" doesn't have such a "history length" property. 
    Why!?
    Solved!
    Go to Solution.

    Hi Cashany,
    you have to make your own buffers then.
    Well, there are examples coming with LabVIEW. There ARE examples showing how to use charts and graphs!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How do I change the calendar history length

    I want to be able to view lots of past event but only a month is available?

    I suffer from the same problem. I have tried many approaches to solve it, including that suggested by dommer14, all to no avail. On my iPhone 5 I have selected Sync All Events in Calendars Settings, but calendar events past about 30 days old do not appear on my iPhone even though they do appear in my iCloud calendars as far back as I have been using it. I have tried restarting the Calendar app, restarting the iPhone, changing and restoring the Calendars Sync selection - nothing works. This is very frustrating because having visibility on my phone to old appointments, etc. is important to me and is supposed to be supported by this configuration. Any help would be very much appreciated.

  • Clearing Charts and Graphs Programmat​ically

    I must be overlooking something simple because it seems that clearing charts
    programmatically would be such a common thing, but where then is the
    attribute to do this?

    Simple indeed. Thanks Greg.
    "Greg McKaskle" wrote in message
    news:[email protected]..
    > > I must be overlooking something simple because it seems that clearing
    charts
    > > programmatically would be such a common thing, but where then is the
    > > attribute to do this?
    >
    > To clear a graph, write and empty plot (empty array) to its terminal or
    > a local
    > variable. To clear a chart, write it to the charts History attribute.
    >
    > Greg McKaskle

  • Chart history explanation?

    Greetings,
    Perhaps I am thinking too much on this, or perhaps too little, but I am trying to figure out what chart history length is actually doing.
    For example.  I'm developing an app right now where I am monitoring 32 channels on a system at 10 Hz.  I'm charting up to 10 of any of these channels (user selectable) at any time.  This system can expect to be run for several hours for a test and I have been doing long runs to test stability.  I've tweaked the time axis on the chart to be hours wide, 10 minutes wide, etc.
    So, when I have my chart displaying 2 hours worth of 7 channel data on the screen, I'm getting lost as to what factor a chart history length of 1024 means to me?  I'm able to have several hours of data plotted though a history length of 1024 implies I should only be able to see only 1.71 minutes.  Can I only recall the last 1.71 minutes of data out of the chart?
    Someone shine the light in the darkness for me eh?
    Cheers,
    Greg Cole
    “It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”

    Hola,
    You are correct, I am using waveform data.  I'm attaching a screenshot.  Apologies for the undocumented VI's.  One sets up the daq task, the 2nd adds a channel to the front which is the sum of three other channels, and the last extracts the channels the user has selected to plot.  I have about 2 1/2 hrs up on the chart right now. (started a log after my first post)
    um... crap.  I must make a correction.  My history length is actually 180000 (I forgot I had been experimenting on it yesterday).  Man, I'm glad it's Friday.  However, I still do not understand the math.
    180000 / (5 waveforms @ 10 Hz) = 180000/50 pts. = 3600 second chart length, = 1 hr.   Yet I'm at 2.5 hrs.
    Apologies for the bad data on the first post.
    Cheers,
    Greg Cole
    “It is not the ship so much as the skillful sailing that ensures the prosperous voyage.”
    Attachments:
    daqloop.jpg ‏53 KB

  • Chart history lenght control

    Dear all,
    I use Labview 8.5 and the device NI USB6210. Following my configuration of my application and to optimize it, I need to change the Chart History lenght by program. Is it possible?
    When the chart is running, I can see that the chart can display more data than the number of data in the history. Can I have more explanation about the working?? Have you any links about it?
    Thank in advance, Daniel. 

    No, I'm afraid you can't.
    There's a property called HISTORY DATA that you could manipulate to fake it, but that is a compile-time option only.
    You can have it display any amount you want less than the history by manipulating the Xmin and Xmax, but that's just a small window on a big room.
    I can see that the chart can display more data than the number of data in the history. 
    I don't think that's true.  If you set the HISTORY LENGTH to 100 and feed it an array of 200 numbers, you see a plot with 100 numbers in it (100-199).  The first part is forgotten.
    Message Edited by CoastalMaineBird on 06-19-2009 07:53 AM
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How do I mark a "not measurable" event on a chart history?

    I have an application which is working very well and takes measurements - continuously plotting a result on a chart. The chart history is typically a 100 or so measurements. I plot on the chart both an upper and lower tolerance limit, hence the measurment plot should hopefully stay between the two (straight lines) limits.
    Occasionally a sample is "missing" and when this happens a "measurement" of zero is given. This is currently displayed on the chart as a sudden drop to zero. The users like this as it shows them clearly that the sample was missing. All OK so far, however...
    On rare occasions a sample is present and is measured but for reasons I will not go into we know (and the software can determine) that the measurement result is actually invalid. This situation I call "not measurable" in that although a sample is present it actually cannot be properly measured. The question is this; how do I show this on my chart history?The chart history plot is by far the most looked at display of data for the users. I realise that I could show a message box saying "not measurable" (and intend to do so) but this would only last for that measurement cycle. How do I "mark" the chart to show that there was a sample but that it was not measurable.
    I don't particularly want to use a zero value because that is being used quite nicely for the "no sample" situation. Also I don't want to simply not plot anything because the fact that the sample was "not measurable" is potentially very important indeed. Ideally what I would like is to put a marker, say a thick vertical line at the position where the invalid measurment is, in order to both block it out to show that it is wrong and also show there actually was a sample there in the first place.
    Any ideas as to how I can do this? Sorry this is a bit wordy!
    Regards
    Kevin

    Hi
    I have come up with a quick fix for using a chart which might give you a few ideas. This is just a quick fix and isn’t very nice at all. The green dots are meant to represent the immeasurable data, I have just triggered them by a set of limits. You would be better of using an XY plot and an array which you constantly up date. Using an XY graph will give you a lot more options such as using cursors to mark certain points.
    I have attached my quick fix and an example of using text on an XY graph
    Hope this at least gives you some ideas
    Tim
    AE NI UK and Ireland
    Attachments:
    quick fix.vi ‏17 KB
    Text_by_Points_on_XY_Graph[1].vi ‏32 KB

  • How do you clear the chart in an AI Waveform Scan VI upon program start?

    I am using a waveform scan vi in a program. The output of the vi is set to "Waveform". What I want to do is have the program automaticly clear the waveform chart each time the program starts. Currently I must start the program, right click on the chart and select clear. I have attempted to use the chart history property node, which I assumed is the correct path to take but so far my attempts have been unsuccessful.

    Ahhh, waveforms... These got better in LV 7 I hear.
    Will this do it?
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    Problem_example.vi ‏41 KB

  • Reset chart history using chart reference

    I want to clear all the data from a chart using its reference, but this property is unavailable. So far the only way to do this seems to be by using a static property node (the one you create by right clicking the chart and selecting the desired property). Is there any other way?
    Solved!
    Go to Solution.

    You must be doing something wrong. The chart history is available if you use a reference for the property node.
    Can you attach a simplified version of your code that shows the problem?
    Message Edited by altenbach on 01-11-2009 03:49 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ClearChartWithReference.png ‏5 KB

  • Setting Chart History

    Is there a way where I can set the chart history to a user defined value while my program is running? Example, when the program starts running, the graph history is set to 200, so the max range for the x-axis is 200, once it gets to 200 the window will start shifting. I want the user to have control over this property. If the user wants the chart history to be 500, then I want to be able to set that property of the graph to 500 through my program. How would I be able to do this?

    I'm not sure what you're looking for. The graph has a ChartLength property that will allow you to specify how many points the graph stores while charting. If you would like to make this customizable in your application, you could provide a way to do this in the interface of your application. For example, you could create a dialog that has a text box or a numeric edit, then bring this dialog up from a menu and set the ChartLength property according to what they enter in the dialog. Is there something else that you were looking for from the graph for this?
    - Elton

Maybe you are looking for

  • Parking not possible during batch input

    Hello, Iu2019m facing a problem for creating a parked vendor invoice in background (Tcode FB60 / FV60) thru BDC or BAPI. I looked for a BAPI and I just found "BAPI_ACC_INVOICE_RECEIPT_POST", for posting FI invoice : it doesnu2019t correspond to our r

  • Limit no of records in a page

    By default, a report tries to display 1000 records in a page in a report. Is it possible to restrict this to 50 or 100 records? If so, where can we change the configuration? I came across a setting for altering the no. of records viewed in an ADC, in

  • Workstation Clients through a Firewall

    Does anyone out there know if there are any issues with workstation clients going through a firewall? Thanks! mervin

  • Where do I find my iphone simcard pin

    I just got my iphone 4S and it asked me for a simcard pin.  Where do I get that from?

  • Still no AP2 Upgrade Key available in Germany!!!

    Hi All, after 2 weeks since my first order, today I got the information that I've to wait addt'l 2 or 3 weeks for my key. That is the poorest job apple ever made!! I'm still NOT able to convert my old library. I can't use my new equipment with the ol