XPlot!
Mike Massonnet | Posted 3 months, 1 day ago on February 16, 2006
Do you remember of the OpenOffice.org2 post? The one I wroted to show how to query on MySQL.
I started to get annoyed with it because it is a really heavy application to launch. So I was looking for something LIGHT and I get sticked on xplot. All what he needs are some x-y values.
For example: echo "0 13\n8 27\n18 23\n28 27\n36 13" | xplot
.
So I wrote a little shell script which lets figure out the stats to take so it knows what values to grab from MySQL and to pass them to xplot.
#!/bin/sh case "$1" in 'xfce-dusk') ID=$1; ;; '911tabs') ID=$1; ;; 'e17-defaultcolor') ID=$1; ;; *) ID='txtview'; ;; esac VALUES=`mysql -e "SELECT value FROM stats WHERE id='$ID' GROUP BY value ORDER BY date DESC" test -s` X=0 for V in $VALUES; do XPLOT="$X $V\n$XPLOT" X=$[$X+1] done echo -e $XPLOT |xplot -v
Xplot was wrote in the late 1980 and still being useful ;)