I have the following csv file:
timestamp,unit,maximum,average
Thu Feb 05 14:54:00 GMT 2015,Percent,13.0,4.503333333333333
When I run the following bash script on it:
#!/bin/bash
graph_results() {
input=cpu-samples.csv
output=cpu-samples.png
gnuplot <<- eor
set terminal png
set output '${output}'
set style data linespoints
set xdata time
set timefmt '%b %d %H:%M:%S GMT %Y'
set format x '%b %d %Y %H:%M'
set datafile separator ","
set xlabel "timestamp"
set ylabel "percent"
set xtics rotate
plot '< tail -n +2 ${input} | cut -f 1 --complement -d" "' using 1:3 title 'Maximum', '' using 1:4 title 'Average'
eor
}
graph_results
I get the following error:
bash-4.1$ ./run_gnuplot
Could not find/open font when opening font "arial", using internal non-scalable font
Warning: empty x range [4.76463e+08:4.76463e+08], adjusting to [4.71699e+08:4.81228e+08]
And the resulting graph has the correct datapoint and timestamp on it, but the graph is filled out with incorrect date values for the x axis.
It works fine when the csv file has more than one value in it, but doesn't when there is only one value. I realize the error message is because with one value, the start and end range for the x axis is the same (as noted here http://gnuplot.10905.n7.nabble.com/empty-x-range-td1650.html).
I know I can set a range with the following:
set xrange
But unsure how I could use in in my case, since I'm using a custom date format, and I don't know what the start and end dates should be, since the data generated is dynamic?