[En-Nut-Discussion] Web Charts? Use java?

0 views
Skip to first unread message

Tim Tait

unread,
Feb 20, 2006, 10:24:59 AM2/20/06
to Ethernut User Chat (English)

Has anbody done anything with serving dynamic data charts from ethernut?
I want to to display simple line graph of sensor readings over time. I
am thinking that a java applet is the way to go. Most of the applets out
there seem to big, one "tChart" seems reasonable at 17kb, put you have
to pay to get source. Is there another way?

Thanks-

Tim

_______________________________________________
En-Nut-Discussion mailing list
En-Nut-D...@egnite.de
http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

Edwin van den Oetelaar

unread,
Feb 20, 2006, 10:43:53 AM2/20/06
to Ethernut User Chat (English)
Things that come to my mind ...

1) Use flash (in client) let Ethernut serve XML data. (works for sure)
2) Use javascript in client to make nice graphic from XML (works for
sure) think AJAX ..
3) Let Ethernut generate page with data in JavaScript arrrays, let the
client make nice graphics from this data. (no xml parse on client)
4) Let Ethernut generate PNG or GIF file from data and serve that to
client (needs lots of work/memory on ethernut)
5) yes use java to build the graphic, but depends on VM on client which
is less common then flash on client

Good luck,
Edwin van den Oetelaar

Tim Tait

unread,
Feb 20, 2006, 11:38:18 AM2/20/06
to Ethernut User Chat (English)

Edwin-

Thanks for the quick reply.

Edwin van den Oetelaar wrote:

> Things that come to my mind ...
>
> 1) Use flash (in client) let Ethernut serve XML data. (works for sure)

I'm not a fan of flash, nor have I experience any with developing using
it. But the include flash on the httpd sample does not work in my
FireFox browser. How would flash compare in size?

> 2) Use javascript in client to make nice graphic from XML (works for
> sure) think AJAX ..

Interesting.

> 3) Let Ethernut generate page with data in JavaScript arrrays, let the
> client make nice graphics from this data. (no xml parse on client)

Sounds easy:) I found some nice shareware that does this using VML
<http://www.structura.info/XYGraph/XYGraphDemo.htm>, but it only seems
to only work under IE not Firefox:( Plus it's a bit big... I guess Java
byte code has an edge there.

> 4) Let Ethernut generate PNG or GIF file from data and serve that to
> client (needs lots of work/memory on ethernut)

I think client-side graphic generation is the way to go.

> 5) yes use java to build the graphic, but depends on VM on client
> which is less common then flash on client

Still sounds like the best option to me... Don't most people have a java
VM installed? Just need that java applet code:)

>
> Good luck,
> Edwin van den Oetelaar
>

Thanks again-

Tim

Tim Tait

unread,
Feb 20, 2006, 11:46:11 PM2/20/06
to Ethernut User Chat (English)

A followup to my own question, I was able to get a quick Java applet
graph working. I used the 2D Line chart applet from
<http://www.reconn.us/java.html> which has free binary for personal use.
After packing the .class into a jar, it only occupied 11K vs 22K for the
class. I guess urom does no compression?

Even managed to use ASP to fill in the graph parameter values. Cool stuff.

When I get farther into my project I think I'll write my own graph
applet, but for now I know it can be done using only 10% off the flash
space.

Thanks for the help Edwin.

Tim

José Vallet

unread,
Feb 21, 2006, 7:13:47 AM2/21/06
to Ethernut User Chat (English)
Hello Tim

That is exactly what I am doing.

What I have at the moment:

ETHERNUT SIDE: http server + web page with an applet inside

DESKTOP SIDE: web browser with Java.

I am reading ADC data from Ethernut and sending it to the applet through
a socket on real time. I use the library jchart2d for the charts
http://jchart2d.sourceforge.net/

I chose it because its simplicity compared to others and because it was
exactly what I wanted.

The resulting applet is packed in a .jar file with all the needed
classes, and after that optimized and obfuscated for optimal code size
using proguard (this step shrinks the applet size in about 30%!). That
has proved to be the best for me, although it took me a while to make it
work (I am a Java beginner).

As the size of the applet is growing, I use the serial memory for
storing it (xflash from Michael Fischer), and it works nicely for me.
That gives me up to 512 Kbytes for the GUI, which is a lot!!

Hope it helps. If you have any further question, don't hesitate asking!
I am not an expert but that is what I am doing.

If you want an example I could send you some code, although a bit messy
(but working).

Regards
José

Tim Tait

unread,
Feb 21, 2006, 10:26:37 AM2/21/06
to Ethernut User Chat (English)

José -

I am also a java newbie.

Real time data update via socket sounds cool, but that applet looks
pretty big. How small did you get it?

What I did was very simple - you have to refresh the page to get new
data, but it should do what I need.

Tim

José Vallet

unread,
Feb 21, 2006, 12:40:50 PM2/21/06
to Ethernut User Chat (English)
Tim Tait wrote:
>
> José -
>
> I am also a java newbie.
>
> Real time data update via socket sounds cool, but that applet looks
> pretty big. How small did you get it?

Do you mean the one shown at jchart2D web page?

I changed that one a bit and now it includes 2 charts (linear and
histogram like), 5 slider controls (with entry type and range checking),
1 button... but it will grow.

I managed to put it all in a 73Kb .jar (before optimization it was
137Kb) I use the entire flash for the web server, so in my opinion it
can still grow a lot more.

>
> What I did was very simple - you have to refresh the page to get new
> data, but it should do what I need.

I cannot do that because I need "real time" measurements and data
presentation. Refreshing the page seems slow, and adds unnecessary
overhead to the process (all the httpd stuff). On the other hand the
applet is downloaded only once in the whole process, and the data
presentation is really fast (is done by the computer). The only extra
thing to do at the Ethernut side is the socket communication and data
sending.

I was trying to post an example in the list (binaries), so you could
easily test it by yourself, but it was too big for posting it (172Kb the
.hex plus 117Kb the xflash.bin) (Sorry Harald for that, simply didn't
notice!)

The xflash.bin includes all the web files of the httpd example plus the
.html that has the applet inside (1 line of code). So the gui itself is
basically 73kb (you have 512Kb in the flash)

If you are interested let me know and I will send you personally the
binaries and instructions about how to run the example, so you can judge
by yourself.

Regards
José

Tim Tait

unread,
Feb 21, 2006, 1:12:50 PM2/21/06
to Ethernut User Chat (English)
José -

Thanks for the offer, I would be interested in trying it out. For my
current application I am displaying data from the past 24 hours, so
real-time updates are not needed. But in other applications it could be
very useful, kind of like an oscilloscope. Just be able to send data
from sockets to a java applet is very handy.

Tim

Reply all
Reply to author
Forward
0 new messages