# Dynamic diagram

**URL:** <https://www.ruby-forum.com/t/dynamic-diagram/67577>\
**Category:** Ruby\
**Created:** [September 5, 2006, 11:35am UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577 "2006-09-05T11:35:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [September 5, 2006, 11:35am UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577/1 "2006-09-05T11:35:50Z")

</div>

Hi,

I want to show a measurement value in a diagram.

The problem is that the diagram should be visible, when new values are  
added into the diagram. There is round about one value per minute.

Does anyone has some advice ?

Thanks  
Peter

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [September 5, 2006, 4:34pm UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577/2 "2006-09-05T16:34:54Z")

</div>

Peter M. wrote:

> I want to show a measurement value in a diagram.
> 
> The problem is that the diagram should be visible, when new values are  
> added into the diagram. There is round about one value per minute.

By “diagram” do you mean “chart”? If so, use BLT (which I think only  
binds  
with Python or something).

If you actually mean a diagram, like a graph, with circles and arrows,  
try  
this:

[http://wiki.rubygarden.org/Ruby/page/show/SvgCanvas](http://wiki.rubygarden.org/Ruby/page/show/SvgCanvas)

Updating it in real-time should only require a little work. I have  
bench-versions which do that, so if you actually need it ping me  
privately.

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [September 5, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577/3 "2006-09-05T17:27:04Z")

</div>

Phlip wrote:

> [http://wiki.rubygarden.org/Ruby/page/show/SvgCanvas](http://wiki.rubygarden.org/Ruby/page/show/SvgCanvas)
> 
> Updating it in real-time should only require a little work. I have  
> bench-versions which do that, so if you actually need it ping me privately.

Since SVG using progressive rendering and the “painters model”, you can  
actually start streaming an SVG file and just send new information when  
it’s available (if you can live with new content always drawing on top  
of old).

Alternatively, you can use AJAXian style JS communication to poll and  
receive new data, modifying the SVG DOM on the fly to add new data.

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [September 5, 2006, 6:14pm UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577/4 "2006-09-05T18:14:01Z")

</div>

Phrogz wrote:

> Alternatively, you can use AJAXian style JS communication to poll and  
> receive new data, modifying the SVG DOM on the fly to add new data.

SVG ain’t just for web pages. (I have barely researched how it’s used  
there!)

---

<div class="post-metadata">

**Author:** ![dracos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ea666f/32.png) [@dracos](https://www.ruby-forum.com/u/dracos)\
**Post date:** [September 11, 2006, 5:49am UTC](https://www.ruby-forum.com/t/dynamic-diagram/67577/5 "2006-09-11T05:49:09Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Peter M. wrote:

> I want to show a measurement value in a diagram.
> 
> The problem is that the diagram should be visible, when new values are  
> added into the diagram. There is round about one value per minute.

Try the gnuplot extension for Ruby. You can add new values to the  
plot and watch it appear in real-time.

I learned this from a friend who used it to easily visualize voltage  
readings from a microcontroller in real-time.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFFBNx9mV9O7RYnKMcRAkpDAJ9h86cexkCc8pJq9E4KFGWkMGRsfQCgrXH6  
IP89QyuzAwuSul9/VZeAf1Y=  
=2R3h  
-----END PGP SIGNATURE-----
