[rrd-developers] Re: Legend being in the wrong order

alex at ergens.op.Het.Net alex at ergens.op.Het.Net
Tue May 30 00:50:04 MEST 2000


> *> Most of us will be aware of the problem as indicated on the subject line.
> *> 
> *> I'm not so fluent in C so I may have misunderstood it but I think that
> *> currently a linked list is made containing each element to graph.  New
> *> elements are appended to the end.  For normal lines and areas this is
> *> not a problem however for stacked lines and areas this is a problem.
> *> 
> *> With a few more pointers this problem can be solved.  We need
> *> 
> *> 1 - pointer towards the end of the list (already there)
> *> 2 - pointer to the end of the last complete (together with gprints) line
> *>     or area
> *> 3 - pointer to the end of the current inserted item

> the problem is more on the logical side than at the implementation
> side ... 

Perhaps yes. OTOH computers are there to make our job easy, not harder.
If it is hard for a human to read the graph, the implementation might
be wrong.

> People expect their comments and labels to go into the label area
> in a left->right top->bottom order ... in the graphs where we STACK
> stuff on top of each other it is the other way round ... so there
> is a fundamental problem ... Now we could alter the whole legend
> area so that it gets filled up from bottom to top (right -> left,
> bottom -> top) but I am afraid this will be even wors for people to
> understand ... 

This is not what I proposed.  Don't write chinese :)
For each line of text following the corresponding line/area/stack,
the order should be top->bottom.  In all cases it should be left->right.

(note: algoritm included further below)

What I proposed is sort of an "insert before last" way of handling
the legend.  That way the area (or line) is on the last line of the
legend and the stacked area (line) is inserted before this line.
It won't really be "insert before last" since the text entries that
come with the area/stack need to be inserted after the corresponding
entry.  In essence, we would not only stack the graph elements but
also the labels... makes sense to me.

For an area(green) and a stacked area(red) the legend should look like:

(r) max. 123.45mbps  min.  1.23kbps
(g) max. 234.56mbps  min.  1.23kbps

If I understand the source completely, the following items are placed
on a list:

(1)green box
(2)text "max %6.2lfbps",maximum
(3)text "min %6.2lfbps",minimum
(4)red box
(5)text "max %6.2lfbps",maximum
(6)text "min %6.2lfbps",minimum

If number 4 is not appended to the list but inserted just before number 1,
and numbers 5(6) are inserted after number 4(5), the legend will match the
graph.  To be able to find number 1, a pointer should be kept that points
to the last area or line.  If this line or area is followed by another line
or area: no problem, just move the pointer to this next element.  If OTOH
the line/area is followed by stack, this new pointer is not changed and the
update of the list occurs in a more logical place.
The order of above list would be 4,5,6,1,2,3 and not 6,5,4,3,2,1.



A generic subroutine "insert to list" could be used.
Let's assume an end-of-list record, and three pointers:  P1, P2 and P3.

P1 points to the last line or area element
P2 points after the last line,area or gprint element
P3 points to the end of the list.

All three pointers start with pointing to the end-of-list record
(this is the only record on the list at that moment).

The insert command will add a new element to the list at the indicated
position, before the record where the pointer is pointing to.

Just in case my english doesn't make sense:
   A->B->C->D->E->end
   Px points to C, insert F at Px results in:
   A->B->F->C->D->E->end

stack is inserted in the list at P1.  P2 then needs to be modified.
gprint is inserted in the list at P2.  P2 needs to be modified.
line or area is inserted in the list at P3.  P1 and P2 need to be modified.

P3 does never need to be modified as it will always point to the last
record.

insert "area" to the list (position P3):
P1 points to the "area" element. P2 points one element thereafter.
insert "gprint" to the list (position P2 which points to the end):
P1 doesn't change, P2 points one element after the gprint (the end)
insert "stack" to the list at P1 (before "area")
P2 changes and points just after the stack (so it points to "area")
insert "gprint" to the list at P2 (just before area)
P2 changes again and points to "area" again.
insert "line" to the list at P3.  P1 and P2 are modified and point to
the end again. 

Resulting list: stack-gprint-area-gprint-line-end

> Another option would be to rotate STACK groups on display ... so
> that things get stacked from top to bottom so to saz and leave the
> legend area alone ... maybe this might help ... will look into this

That may also do it.  To me it looks more complicated than fiddling
with the legend but then again, see line #3 in this mail :)

There are two problems with this:
1) currently available scripts are built with the current order in mind
2) some users may get confused when they have to understand that a stack
   is built top down. 

regards,
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers



More information about the rrd-developers mailing list