05-12-2012 11:52 AM
Hello,
I am taking through CANBus 100 samples per second and i would like to present those data in a realtime graph.I want to see all the 100 samples and the graph refresh every 1 sec,i am using a waveform chart.
I would like my chart to be updated with new data every one second(1 SEC 100 samples,2 sec 200 samples etc) and be able to see in the graph all the 100 samples we take in real time.My question is this possible?I think some how i have to alter the x scale of the graph?I have done a small code in which i change the x scale of the graph and put real time but in the graph is shown only one sample from 100 samples i am taking every second,can you please suggest a code solution for this?
Solved! Go to Solution.
05-12-2012 12:15 PM
Instead of a chart, you want to use a waveform graph. A chart keeps track of its history and will start to scroll while a graph will simply refresh.
05-12-2012 12:36 PM
and by using a waveform graph by problem would be solved?are you sure?I am not taking an array just reading simple values,ok i can build an array with those values.How can i have real time in x scale in a waveform graph?
05-12-2012 12:43 PM
If you are not taking an array, then you are not taking 100 samples per second. Your code is meaningless since you do not show the actual acquisition. You are, in fact, only writing a single sample to the chart.
If you really are using a chart and if you really are taking a single sample at a time, you can simply look at the shipping example called Real-Time Chart. If you are really taking 100 samples per second, then use the same property nodes to add the timing information or create a waveform data type from the array.
05-14-2012 12:18 PM
05-14-2012 12:20 PM
The image of my graph in which i am seeing only 1 sample per second instead of 100 per second
05-14-2012 12:37 PM
You are NOT doing anything to scale the x axis. Where do you think the scaling information is going to come from if you do not provide it? Did you even bother to look at the example I mentioned?
05-14-2012 01:27 PM
I just found the example you mention and try to understand how it works,this vi you mention take a point every ms.Ok probably is something i want and as you see in the picture i post i doing something like that.How can i refresh the chart every 2 sec to read my samples.I would like to have a graph startin from o sec till 1 sec to see 100 samples in my graph from 1-2 sec to see 200 samples in my graph,can you please post a code example to help me.
05-14-2012 01:41 PM
If you want to refresh every x number of seconds to show all of your samples, then you need to build an array of samples and display them in a graph. That is not at all what you are doing now. So you could put your acqisition VI inside a for loop and wire the data out with autoindexing enabled) and to the graph. That still will not fix your problem of reflecting real time on the x axis.
Your last statements are confusing. If you display 0-1 sec, you would see 100 samples and if you displayed 1-2 sec, you would also see 100 samples.
05-14-2012 02:01 PM
Ok i understand this part you are saying (If you want to refresh every x number of seconds to show all of your samples, then you need to build an array of samples and display them in a graph) in my program i am reading my data in a while loop and there is a delay of 10ms in each iteration of the loop and each iteration i am able to take 100 samples with tha sampling time.Let me also post a vi according to what you suggest if understand correct.As you said the question for the x axis remains.
The laste sentence i made a mistake sory i mention 0-1 sec 100 samples 1-2 sec 200 samples etc