Re: logarithmic axis/grids



Roland Bock wrote:
Dear Brian,

thank you for the roses and sorry for letting you wait so long, but I
was in the middle of another project.

In principle, introducing logarithmic scales and grids should be fairly
easy to do: There is a struct called GtkDataboxCanvas which contains the
necessary information for positioning graph elements (dots, lines, etc)
on the screen. Up to now, the real calculation is done in the individual
graph classes, though. This calculation could be centralized (simple).
Then it would be easy to replace the linear transformation by a
logarithmic one.

Of course, similar actions are necessary for functions like
gtk_databox_value_from_coord and maybe (I haven't put too much thought
into that yet) also for scrollbars.

I am going to try to do this soon. There should be no implications for
anybody who wants to stick with the linear scales.


The rulers are different, though, because we are using the standard gtk
rulers and I don't think they can be switched to non-linear scales.
Maybe the nxpruler library suggested by Fabian can help here
(http://numexp.org)? I haven't looked into that.


Regards,

Roland





Yes, with the nxpruler library from gnumexp-0.11.0 (http://numexp.org/) you can create logarithmic scale rulers. My program cournol (http://cournol.k-2007.de/) uses a modified version of gtkdatabox which makes use of these nxprulers. The patch which adds nxpruler support to gtkdatabox is in the cournol sources under patches/gtkdatabox.diff.
The nxpruler library is also in the cournol sources under lib/nxpruler.
In cournol, the nxprulers are not set to logarithmic mode.
To get the logarithmic mode you would add the line "nxp_ruler_set_mode(NXP_RULER(ruler), NXP_RULER_LOG);" where it is appropriate.
Look at lib/nxpruler/test.c in gnumexp for examples!

Greets,
Fabian


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]