graph data from postgresql using gnuplot
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Oct 2020 16:46:31 +0000 (18:46 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Oct 2020 16:46:31 +0000 (18:46 +0200)
gnuplot/Makefile [new file with mode: 0644]
gnuplot/axes.gnuplot [new file with mode: 0644]
gnuplot/axes.sql [new file with mode: 0644]

diff --git a/gnuplot/Makefile b/gnuplot/Makefile
new file mode 100644 (file)
index 0000000..f857771
--- /dev/null
@@ -0,0 +1,2 @@
+all:
+       psql -A -F "," -t zc < axes.sql | tee axes.txt
diff --git a/gnuplot/axes.gnuplot b/gnuplot/axes.gnuplot
new file mode 100644 (file)
index 0000000..a8fb8d9
--- /dev/null
@@ -0,0 +1,27 @@
+set terminal pngcairo color size 800,600
+#set output 'axes.png'
+set output
+
+set xdata time
+set timefmt "%Y-%m-%d %H:%M:%S"
+
+set datafile separator ","
+
+#unset border
+#set key outside
+#set key top left horizontal
+
+set grid
+set key left
+
+set format x "%H:%M"
+
+set multiplot
+set size 1,0.5
+set origin 0, 0.5
+
+plot "axes.txt" using 1:2 with lines title "X angle"
+
+
+set origin 0, 0
+plot "axes.txt" using 1:3 with lines title "Y angle"
diff --git a/gnuplot/axes.sql b/gnuplot/axes.sql
new file mode 100644 (file)
index 0000000..11522de
--- /dev/null
@@ -0,0 +1,2 @@
+select to_char(time, 'YYYY-MM-DD HH24:MI:SS'), x_axis_angle, y_axis_angle from zc where time > now() - interval '6 hours' order by time asc 
+