We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Drawing with both static/dynamic elements
Page Index Toggle Pages: 1
Drawing with both static/dynamic elements (Read 954 times)
Drawing with both static/dynamic elements
Jul 18th, 2009, 9:38pm
 
Hi processing forums!  I have been working on a project for logging sensor data from an Arduino.  At first I thought that this would be a great language to use, I'm not entirely sure yet.

Anyway, I want to draw a graph that updates with the serial data from the arduino, & was going to use lines or dots to plot the value over time.  This would work best if I didn't upgrade the background(); every time I looped through the draw routine.

But I also wanted to display the text of the actual data as well...

My problem:
If I don't update the background(), then the text just overwrites itself into a blur.  If I do update the background, then the line/dots I draw are lost to the refreshing of the background.

Is there a way to do both?

Or maybe there is a better language to interface the serial data from the arduino?  I DO really like the fact that you can export directly to an applet, but the applet wouldn't run at first due to Java's security restrictions, & i had to edit a text file to disable all security... for lack of finding an easy way to just disable it for that one applet....

Anyway, ideas?  Also, are there any libraries that draw a graph?  I will write one myself, but would rather not reinvent the wheel.

Thanks!
Re: Drawing with both static/dynamic elements
Reply #1 - Jul 19th, 2009, 12:11am
 
Quote:
Is there a way to do both?
Just draw a rect() over the text. That's what background() does, but over the whole sketch surface.

Quote:
for lack of finding an easy way to just disable it for that one applet....
You have to sign your applet.
But well, unless people have the exact same hardware as you, there is little point to run from a Web browser, no?

Quote:
are there any libraries that draw a graph?
JFreeChart for example. Although I am not sure if it interfaces well with Processing.
Re: Drawing with both static/dynamic elements
Reply #2 - Jul 19th, 2009, 5:41pm
 
Thanks for the response Philho!

I'll try drawing the rect, I suppose that was simple wasnt it?  going to give that a try right now.

Thanks for the response Philho!

I'll try drawing the rect, I suppose that was simple wasnt it?  going to give that a try right now.

But well, unless people have the exact same hardware as you, there is little point to run from a Web browser, no?

I wasn't sure if it would work or not, my plan was to have a webserver at my house display this graph & the output of the arduino, for people to be able to view, maybe I'm not going about this the correct way.
Re: Drawing with both static/dynamic elements
Reply #3 - Jul 20th, 2009, 12:53am
 
crrimson. wrote on Jul 19th, 2009, 5:41pm:
my plan was to have a webserver at my house display this graph & the output of the arduino, for people to be able to view, maybe I'm not going about this the correct way.
Indeed. That would be the Web server which access to the hardware, no the client (the browser). You can write the server script in Java, PHP, whatever.
Page Index Toggle Pages: 1