Page 1 of 1

Using AddData in a bubble plot

Posted: Thu Aug 26, 2010 11:20 am
by Peter Simmonds
I have an application that draws a bubble plot in real time, ie single values are plotted as they are generated by the application using the following commands:

ret = DPlot_AddData(graph_number, %DATA_XYXY, 1, 1, x, y)
ret = DPlot_AddData(graph_number, %DATA_XYXY, 1, 2, x, z)

This works fine, except that it is incredibly slow. The reason seems to be that adding each new point forces the whole graph to be re-drawn (with a lot of flickering).

When setting up the graph, I made sure that it was manually scaled with the ret = DPlot_command(graph_number,"[ManualScale(..etc...)]" command. This presumably stays active during later data additions. I have also tried:

ret = DPlot_command(graph_number, "[MenuUpdates(0)]")

but no effect. Is there any way to stop the re-drawing process when adding data for this graph type, or am I doing something wrong?

Thanks

Peter

Posted: Thu Aug 26, 2010 12:00 pm
by DPlotAdmin
See the notes at the bottom of
http://www.dplot.com/lib/index.htm?dplot_adddata.htm

In particular, you'll want to turn off antialiasing ([GeneralOptions(32,0)]) and you might also want to use DeferMinMaxCheck.

If it is still slow then my best suggestion is to accumulate points and send 100 or so at a time.

Posted: Thu Aug 26, 2010 5:18 pm
by DPlotAdmin
PS: Whether using ManualScale or not, you shouldn't be seeing a lot of flickering. There should never be a blank screen between plot updates, unless you're using a fairly old version. It should appear that your symbols are being drawn directly on the existing plot, w/o erasing the display between updates. If that isn't what you're seeing, you likely need an update. If you are already using a recent version then I've overlooked something. In that case please let me know what version you're using and what development environment your program is using.

Posted: Fri Aug 27, 2010 4:59 am
by Peter Simmonds
I'm using version 2.2.9.3 of DPlot Jnr. I am calling the DLL from PowerBasic console compiler in Windows NT SP3.

The plotted points seem to disappear and re-appear every time a new point is added which looks as though they are all being replotted.

I've just written a subroutine to spool points into 100s or 1000s before plotting which completely solves the problem.

Just a note, the declaration of the DPlot_Disconnect function was missing in the Powerbasic INC file (and in the equivalent files for some of the other program languages. Easily fixed by adding:

Code: Select all

DECLARE FUNCTION DPlot_Disconnect LIB "dplotlib.dll" ALIAS "DPlot_Disconnect" ()
Thanks for your help

Peter

Posted: Fri Aug 27, 2010 9:36 am
by DPlotAdmin
Thanks for the PB information.

I'm glad you got this working to your satisfaction, but: the plot should not be redrawn at every call unless the plot extents are changed by the addition of a point. That's the most likely cause. Another is that you're calling ViewRedraw after every point, but I'd have thought you'd have noticed that.