Reputation: 1
I have written a program that takes data sent into the server via TCP and puts the data into a .csv file with a time stamp on it. I then want to graph this with something like highcharts to show how the data is changing over time.
The data looks like this in the .csv file
14:12 22.5
14:14 21.5
14:16 22.3
Its basicly recording the temperature with time and I now want to graph it.
Hope someone can help!
Upvotes: 0
Views: 311
Reputation: 4776
You can definitely do with highcharts
here is a line chart example for the same http://jsfiddle.net/kolliparavamsikrishna/jFj5w/
`data: [
[Date.UTC(2010, 0, 1), 29.9],
[Date.UTC(2010, 0, 2), 71.5],
[Date.UTC(2010, 0, 3), 106.4],
[Date.UTC(2010, 0, 6), 129.2],
[Date.UTC(2010, 0, 7), 144.0],
[Date.UTC(2010, 0, 8), 176.0]
]`
here you have to keep the timestamp or the UTC date and the second number will be your temperature recording
Upvotes: 1
Reputation: 37578
Highcharts uses a timestamps, so you need to convert your time into it, ie. by Date.UTC().
Upvotes: 1
Reputation: 207345
Maybe try gnuplot
which is free and easy. Downloadable from here.
gnuplot < plotcommands
File: plotcommands
set title 'Plotted with Gnuplot'
set ylabel 'y-axis'
set xlabel 'time'
set timefmt "%H:%M"
set xdata time
set format x "%H:%M"
set xrange ["14:00":"14:30"]
plot 'points.txt' using 1:2
set terminal postscript color landscape dashed enhanced 'Times-Roman'
set output 'file.eps'
set size 1,0.5
replot
This assumes your points are in the file points.txt
.
Upvotes: 0