lua3
data={}
maxh=property.getNumber("max")
minh=property.getNumber("min")
w,h=0,0
function onTick()
local i
if w~=0 then
table.insert(data,input.getNumber(1))
if #data>w then
table.remove(data,1)
end
end
end
function onDraw()
local i,number2pixel
w=screen.getWidth()
h=screen.getHeight()
number2pixel=h/(maxh-minh)
if #data>0 then
screen.drawText(0,0,data[#data])
end
if #data>=2 then
for i=2,#data do
screen.drawLine(i-1,h-(data[i-1]-minh)*number2pixel,i,h-(data[i]-minh)*number2pixel)
end
end
end