You are a guest. Restricted access. Read more.
SCaVis manual

Showing real-time data

All canvas can be used to show data updated in real time. As example, we show how to display a random points, updating the data every 100 ms. Note that we use the method “clearData()”, which reloads data container but does not change its graphical attributes. A slower method is “clearAll()” which reloads graphical attributes of the canvas.

Code example

  Download for this example is disabled for non-members
 1: from java.util import Random
 2: from jhplot  import *
 4: c1 = HPlot("Test")
 5: c1.visible()
 6: c1.setRange(-2,2,-2,2)
 7: c1.setNameX('Time')
 8: c1.setNameY('Data')
 9: c1.setLegend(0)
11: r = Random()
12: import time
13: p=P1D("test")
14: for i in range(1000):
15:    c1.clearData()
16:    p.clear()
17:    x=r.nextGaussian()
18:    y=r.nextGaussian()
19:    p.add(x,y)
20:    c1.draw(p)
21:    time.sleep(0.1)

The method “clearData()” may produce some memory leak if labels for X or Y are should be drawn. It is advised to call “clearLabels()” method, in addition to “clearData()” to avoid a memory leak related to the font creation/destruction of labels. Read this this forum for details.

You can also use a lighter canvas, “SPlot”, which is much simpler and requires less resources.

SCaVis has a special canvas called jhplot.HPlotRT which is designed to show data in real time and fast dynamic rendering.

Unregistered users have a limited access to this section. You can unlock advanced pages after becoming a full member. You can also request to edit this manual and insert comments.

man/visual/realtime.txt · Last modified: 2014/02/16 15:04 by admin
CC Attribution-Share Alike 3.0 Unported
Powered by PHP Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0 Valid HTML5