[Kst] plotting data in realtime: tips and tricks?

Timo Juhani Lindfors timo.lindfors at iki.fi
Fri Jun 11 00:42:48 CEST 2010


Hi,

I'd like to plot data from an AD converter in realtime (10000 16-bit
samples per second, four channels). Using

read-data | kst -y 1 -y 2 -y 3 -y 4 stdin

works but configuring ranges for X axis seems to be tricky: I would
like kst always show me the data that has been received during the
last five seconds and not more.  I tried set range to "expression" and
then used from range [P1/XMax] - 50000 and "to" range [P1/XMax].

When I hit apply I see five seconds worth of data. However, when more
data comes in kst does adjust the axis range. Should Kst evalute range
expressions again when new data arrives? "X Axis/Auto" setting does
change the range when new data arrives so I kind of expected the
Expression option to change it too.

Currently I'm using

while true; do
  echo 'Kst.windows[0].plots[0].xAxis.scaleRange(Kst.vectors[1].length-20000, Kst.vectors[1].length+40000)' | kstcmd
  sleep 4
done

to emulate this behavior.

best regards,
Timo Lindfors


More information about the Kst mailing list