如何在PlantUML中生成带有颜色的图例? [英] How to generate a legend with colors in PlantUML?

查看:1697
本文介绍了如何在PlantUML中生成带有颜色的图例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据特定条件为类图中的类上色,然后显示图例,该图例大致如下:

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的legendendlegend中添加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. (see http://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.

是的,请复制/粘贴我们对StackOverflow的答案:确实有帮助

Yes, please copy/paste our answer to StackOverflow : it would indeed by helpful

http://plantuml.sourceforge.net/qa/?qa=3596/how-to-generate-a-legend-with-colors-in-plantuml

这篇关于如何在PlantUML中生成带有颜色的图例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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