Graphviz点:如何更改多记录形状中一个记录的颜色 [英] Graphviz dot: How to change the colour of one record in multi-record shape

查看:62
本文介绍了Graphviz点:如何更改多记录形状中一个记录的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下点样.我想给每个记录的第一部分(表名)提供不同的背景和前景色.我找不到任何记录方法的示例.基本上,我希望SQL查询架构图中的表名突出.有人可以帮忙吗?

I have the following dot sample. I would like to give the first section in each record (the table name) a different background and foreground colour. I can't find any examples of how to do this for a record. Basically I want the table name in the sql query schema diagram to stand out. Can anyone help?

digraph G {
   rankdir=LR;
   node [shape=record];
   corpus_language [label="corpus_language|<id> id\len\l|<name> name\lEnglist\l|<sentence_count> sentence_count\l1027686\l"];
   corpus_sentence [label="corpus_sentence|<id> id\l1241798\l|<text> text\lBaseball is a sport\l|<creator_id> creator_id\l10859\l|<created_on> created_on\l2006-11-14 17:58:09.303128\l|<language_id> language_id\len\l|<activity_id> activity_id\l11\l|<score> score\l124\l"];   
   corpus_language:id -> corpus_sentence:language_id [arrowhead=normal label=language_id];   
}

推荐答案

我很确定这是不可能的.相反,您应该使用HTML样式的标签,这是记录节点的一种更发达的形式.您可以使用<table>标签定义节点,并使用bgcolor="your_color"设置颜色.可用颜色的列表在此处提供: http://www.graphviz.org/doc/info/colors.html (您也可以使用RGBA方式,如此处所述:

I'm pretty sure that it's not possible. Instead you should use HTML-style labels, that are a more developped form of record nodes. You can define your node using the <table> tag, and set the color using bgcolor="your_color". A list of available colors is available here: http://www.graphviz.org/doc/info/colors.html (you also have a RGBA way of doing it, as described here: http://www.graphviz.org/doc/info/attrs.html#k:color)

使用HTML标签,您的示例如下:

With HTML labels, your example becomes as follows:

digraph G
{
    rankdir = LR;
    node1
    [
        shape = none
        label = <<table border="0" cellspacing="0">
                    <tr><td port="port1" border="1" bgcolor="red">corpus_language</td></tr>
                    <tr><td port="port2" border="1">id: en</td></tr>
                    <tr><td port="port3" border="1">name: Englist</td></tr>
                    <tr><td port="port4" border="1">sentence_count: 1027686</td></tr>
                </table>>
    ]
    node2
    [
        shape = none
        label = <<table border="0" cellspacing="0">
                    <tr><td port="port1" border="1" bgcolor="blue">corpus_sentence</td></tr>
                    <tr><td port="port2" border="1">id: 1241798</td></tr>
                    <tr><td port="port3" border="1">text: Baseball is a sport</td></tr>
                    <tr><td port="port4" border="1">creator_id: 10859</td></tr>
                    <tr><td port="port5" border="1">created_on: 2006-11-14 17:58:09.303128</td></tr>
                    <tr><td port="port6" border="1">language_id: en</td></tr>
                    <tr><td port="port7" border="1">activity_id: 11</td></tr>
                    <tr><td port="port8" border="1">score: 124</td></tr>
                </table>>
    ]
    node1:port2 -> node2:port6 [label="language_id"]
}

这是结果:

这篇关于Graphviz点:如何更改多记录形状中一个记录的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆