chandra mohan
chandra mohan

Reputation: 277

How can I programmatically draw graph of continously coming data set from a file?

I have memorylog.csv file which is keep filling up with data in every 1 second. Now, what I want is to keep drawing timeline gui graph from memorylog.csv in parallel. How can I achieve that? I want to do it programmatically using gnuplot (or other utility). The graph should be keep updating as new data in file is keep coming.

Sample data set:

Fri Aug  2 04:46:59 IST 2013,14576,28823,24128,2050
Fri Aug  2 04:47:00 IST 2013,14580,28823,24187,1992
Fri Aug  2 04:47:01 IST 2013,14584,28823,24245,1933
Fri Aug  2 04:47:03 IST 2013,14604,28823,24303,1875
Fri Aug  2 04:47:04 IST 2013,14636,28823,24361,1817
Fri Aug  2 04:47:05 IST 2013,14668,28823,24421,1757
Fri Aug  2 04:47:06 IST 2013,14708,28823,24479,1699

I want timestamp values to be in x-axis and rest four values in y axis.

Upvotes: 2

Views: 1637

Answers (1)

Dan Stahlke
Dan Stahlke

Reputation: 1469

Put something like this into a script continuous.gp:

plot '<tail -n 100 data'
pause 1
reread

and run it like gnuplot continuous.gp. This will replot, every second, the last 100 entries. Unfortunately, this will cause the plot window to rise to the foreground of your display each time, which may or may not be what you want. Also, you need to figure out how to get gnuplot to interpret the timestamps. I think you need to format them in a way that consists of numbers only (although it can display them in any format).

Another possibility to consider is rrdtool. You feed data values to this tool and it will keep running summaries (min, max, avg) for the last minute, last hour, last day, and so on. These are visualized as graphs on a web page. Basically, it does exactly what you are asking for.

Upvotes: 3

Related Questions