问题描述
我想根据特定条件为类图中的类上色,然后显示图例,该图例大致如下:
I want to color classes in my class diagram, based on a certain criteria, and then display a legend, that would look roughly like:
如果可以在PlantUML的legend
和endlegend
中添加HTML表,则可以通过更改单元格背景来实现.但是,添加HTML <table>
不起作用.我还尝试使用 PlantUML的salt
插入表格,但找不到任何方法为表格的单元格着色.
If I could add an HTML table within PlantUML's legend
and endlegend
, I could achieve this by changing the cell backgrounds. However, adding the HTML <table>
doesn't work. I also tried using PlantUML's salt
to insert a table, but I couldn't find any way to color the cells of the table.
有什么办法可以做到这一点?
Is there any way to achieve this?
推荐答案
这并不完美,但是您可以使用克里奥尔语表. (看 http://plantuml.sourceforge.net/creole.html )
This is not perfect, but you can use a creole table. (seehttp://plantuml.sourceforge.net/creole.html )
@startuml class foo
legend
|= |= Type |
|<back:#FF0000> </back>| Type A class |
|<back:#00FF00> </back>| Type B class |
|<back:blue> </back>| Type C class |
endlegend
@enduml
有一些绘图工件,但这是您所期望的吗?
There are some drawing artifacts, but is it what you are expecting ?
在plantuml论坛中.他们允许在此处复制此答案的地方.
From the plantuml forum. Where they allowed to copy this answer here.
http://plantuml.sourceforge.net/qa/?qa=3596/how-to-generate-a-legend-with-colors-in-plantuml
这篇关于如何在PlantUML中生成带有颜色的图例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!