JUNG2:如何在每条边上显示多个边标签?
我正在尝试显示网络拓扑。 一切工作正常,除了我不知道如何在每个边缘显示两个或三个标签,一个在边缘的两端,一个(可选)一个在中间。我已经尝试了一些方法,但我还没有发现任何不涉及丑陋黑客的东西...
这里是它应该是什么样子(带有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看包 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);