I am looking for help in aligning text within HTML tables inside of DiagrammeR
nodes.
In this working example:
library(DiagrammeR)
grViz(
"digraph consort_diagram {
graph[splines = ortho]
node [fontname = Helvetica, shape = box]
mylabel [label = <
<table border='0' cellborder='0' cellspacing='0'>
<tr>
<td align = 'right'>12</td>
<td align = 'left'>This is some text that is very long indeed indeed.</td>
</tr>
<tr>
<td align = 'right'>5</td>
<td align = 'left'>This is short text.</td>
</tr>
</table>
>]
}"
)
I am able to get two lines of text within a node box. This works as intended, with the first column right aligned, and second column left aligned:
I run into problems when I include <br/>
in the long lines. I am hoping to wrap text inside the boxes, and using strwrap
with <br/>
seemed like a possible solution.
Unfortunately, when I add the line break, such as here:
<td align = 'left'>This is some text that is very<br/>long indeed indeed.</td>
The alignment assumes the default style for DiagrammeR nodes, with centering: Ideally, I want to keep the left alignment of the second column, and if possible, make the vertical text alignment "top".
I am very open to alternative approaches, am happy to edit the question to provide more information, and appreciate the assistance greatly.