[rrd-users] logarithmic scale question

Karl Fischer rrd-users at ficos.de
Wed Jul 23 20:50:40 CEST 2008


Hi Tobi,

cool that you like the aproach, however, right now I just don't have the
time to create a patch because that would require that I understand the
entire code concept and I haven't even looked at the sources of rrdtool
so far ...

So I'll add it to my list of things to do, in addition to the still
wanted integer-rrd ...

Otoh I wouldn't mind if you can patch it in there in the meantime ;-)

Cheers
- Karl



Tobias Oetiker wrote:
> Hi Karl,
> 
> this sounds like a sensible aproach ... except that the * thing
> will probably not be portable ...
> 
> if you create a patch it must be for 1.3.x and the feature should
> only be active if units-exponent is set.
> 
> cheers
> tobi
> 
> 
> 
> 
>> Tobias Oetiker wrote:
>>> Hi Karl,
>>>
>>> if you cann make a suggetion as to where you would expect to find
>>> this information I will be glad to add it.
>> Hi Tobi,
>>
>> I would expect a hint to be near the explanation of --logarithmic
>> and especially near --units-exponent
>> (e.g. "doesn't work in combination with --logarithmic")
>>
>> similar to some or the rpn-explanations ( ... doesn't work with VDEF )
>>
>>
>> However, what I really would like is to make it work :-)
>>
>> I mean, it's no more than a printf "%f" vs printf "%e", isn't it?
>>
>> Attached is a little example numprint() that would format the numbers
>> without exponent as long as they fit into units-length and use exponential
>> display beyond that ... wouldn't that be a way to do it?
>>
>>
>> Cheers
>>
>> - Karl
>>
>>
>>> Today Karl Fischer wrote:
>>>
>>>> Tobias Oetiker wrote:
>>>>> Yesterday Karl Fischer wrote:
>>>>>
>>>>>> But rrdgraph seems to ignore the --units-exponent=0 directive completely.
>>>>>>
>>>>>> using Version 1.2.23
>>>>>>
>>>>>> What am I doing wrong?
>>>>> nothing ... log graphs are labled with exponential y axis ticks ...
>>>>>
>>>>> cheers
>>>>> tobi
>>>> thanks tobi.
>>>> ... might be worth a word in the documentation though ...
>>>>
>>>> - Karl
>>
>> test.c
>>
>> #define _GNU_SOURCE
>> #include <stdio.h>
>> #include <math.h>
>>
>> int units_length = 8;
>>
>> void numprint(double num) {
>>     int dist;
>>     int length = units_length-1;
>>     int decimals;
>>
>>     dist = floor(log10(fabs(num)));
>>     decimals = dist > 0 ? 0 : abs(dist);
>>
>>     if (dist >  length ||
>>         dist <= (length * -1) ) {
>>         printf ("%.*le", length - 5, num);
>>     } else {
>>         printf ("%*.*lf", units_length , decimals, num);
>>     }
>> }
>>
>> int main() {
>>     double number;
>>     for (number = pow10(units_length + 1); number > pow10(units_length * -1);  number /= 10 ) {
>>         printf ("%.0le:  ", number);
>>         numprint(number);
>>         printf ("\n");
>>     }
>> }
>>
>>
>>
>>
>> will output something like:
>>
>> 1e+09:  1.00e+09
>> 1e+08:  1.00e+08
>> 1e+07:  10000000
>> 1e+06:   1000000
>> 1e+05:    100000
>> 1e+04:     10000
>> 1e+03:      1000
>> 1e+02:       100
>> 1e+01:        10
>> 1e+00:         1
>> 1e-01:       0.1
>> 1e-02:      0.01
>> 1e-03:     0.001
>> 1e-04:    0.0001
>> 1e-05:   0.00001
>> 1e-06:  0.000001
>> 1e-07:  1.00e-07
>> 1e-08:  1.00e-08



More information about the rrd-users mailing list