Number: 1970
Title: Support labelangle also for nodes
Submitter: Pander
Date: Fri Jun 4 15:46:30 2010
Subsys: Twopi
Version: 2.26.0 (20091210.2329)
System: *-*-*
Severity: minor
Support labelangle also for nodes. Currently only edge labels can be rotated. By means of orientation, a node's shape can be rotated, but the label cannot be rotated at this moment. Please fix this.

Fixing this bug will provide consistent rotation functionality on both edge labels and node labels. Also, it would allow users to rotate node's shape and label at the same time.

digraph G {
    b [shape="box" label="Bbb" orientation="20" labelangle="20" ]
Also it would ease fixing the following bug:

[erg] Unfortunately, the labelangle attribute has no relation to the angle text makes with the horizontal. It, along with labedistance, provides a way by which the user can control where a headlabel or taillabel is placed. I believe this is largely a hack because Graphviz doesn't provide a more general-purpose label placement algorithm. With labelangle and labeldistance, you can avoid having the label on top of the head or tail node.

Rotating text is a totally different problem and, in a sense, easier, assuming one can rely on the pango library, which should support right-to-left text, top-to-bottom text, boldface, underlining, etc. as well as text rotation. It's just a matter of someone having the time and expertise to hook these features into the Graphviz model. :)


I have dug up the following information on rotating in pango and in pango with cairo:

If there is a bounty/donation system for Graphviz, I would certainly support implementation of these and some other bugs/features.
Code from splines.c can be used. See the following function:

void place_portlabel(edge_t * e, boolean head_p)

and especially the end:

    angle = atan2(pf.y - pe.y, pf.x - pe.x) +
	RADIANS(late_double(e, E_labelangle, PORT_LABEL_ANGLE, -180.0));
    dist = PORT_LABEL_DISTANCE * late_double(e, E_labeldistance, 1.0, 0.0);
    l->pos.x = pe.x + dist * cos(angle);
    l->pos.y = pe.y + dist * sin(angle);

This can be used for node easily.
Owner: *
Status: Request