JUNG2:如何在每条边上显示多个边标签?

发布于 2024-10-09 22:36:09 字数 241 浏览 0 评论 0原文

我正在尝试显示网络拓扑。 一切工作正常,除了我不知道如何在每个边缘显示两个或三个标签,一个在边缘的两端,一个(可选)一个在中间。我已经尝试了一些方法,但我还没有发现任何不涉及丑陋黑客的东西...

这里是它应该是什么样子(带有 GIMP-ed 标签)

这可能吗?

谢谢拉库达夫

I'm trying to display a network-topology.
Everything works fine, except I can't figure out how to display two or three labels per edge, one at either end of the edge and (optionally) one in the middle. I've tried a few things, but I haven't found anything that does not involve ugly hacks...

Here's what it should look like (with the labels GIMP-ed in)

Is this even possible?

Thanks

rakudave

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心奴独伤 2024-10-16 22:36:09

查看包 edu.uci.ics 中的 JUNG2 API 文档 .jung.可视化.渲染器。大多数工作都是由此包中定义的 DefaultEdgeLabelRenderer 完成的,但您必须创建自己的自定义边缘标签渲染器。

该文档不是很全面,因此您需要浏览 并找到 DefaultEdgeLabelRenderer 类,然后基于该类创建您自己的类来执行您想要的操作。然后,您可以通过调用以下方法将此类设置为 EdgeLabelRenderer:

vv.getRenderContext().setEdgeLabelRenderer(yourEdgeLabelRendererHere);

Look at the JUNG2 API docs in the package edu.uci.ics.jung.visualization.renderers. Most work gets done by the DefaultEdgeLabelRenderer defined in this package, but you'll have to create your own custom edge label renderer.

The documentation isn't very comprehensive, so you'll need to go through the sources and find the DefaultEdgeLabelRenderer class, and create your own class based on this one that does what you want. You can then set this class as your EdgeLabelRenderer by a call to:

vv.getRenderContext().setEdgeLabelRenderer(yourEdgeLabelRendererHere);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文