[Glade-users] GtkDrawingArea

Joaquin Cuenca Abela e98cuenc@free.fr
Sun, 30 Mar 2003 15:48:23 +0200


Alphonso wrote:
> 
> Glade Users
> 
>      I'm trying to use the GtkDrawingArea to graph sine 
> waves, but GTK+ 
> doesn't seem
> to offer a way to graph points as floating point coordinates onto the 
> GtkDrawingArea. I'm trying to think of way to map sin(x) 
> values onto the 
> DrawingArea using integer values in someway. If anyone knows 
> of another 

It's just a matter of scaling the values that you want to draw from
-1, 1 to 0, height

Something as y = (1.0 - sin(x)) * height / 2; would do it.
With a little more of math you should be able to plot with an offset, of
scale.

Cheers,