WPF - 动态重新排列控制层次结构

发布于 2024-10-09 15:16:35 字数 149 浏览 0 评论 0原文

如何动态填充容器?假设用小圆圈递归地填充大圆圈。只要填满空间就可以了。

我想用它来显示数据层次结构。

为了明确起见:

alt text

How is it possible to dynamically fill a container? Let's say to fill a big circle with small circles, recursively. Just fill the space fine.

I would like to use it for data hierarchy display.

To make it clear:

alt text

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

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

发布评论

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

评论(1

ㄟ。诗瑗 2024-10-16 15:16:35

如果您想要现成的东西,请查看 Graph#

http://graphsharp.codeplex.com/

视频在这里:

它具有动态图形布局并且相当易于使用。有多种布局算法可供选择[请参阅示例应用程序],每种算法都是可配置的。

然而,填充直到一个区域“满”并不是开箱即用的。例如,尽管您可以创建一个图表,将其布局并显示出来。然后测量顶点大小与整个图大小之间的比率,然后添加或删除顶点,直到达到所需的密度。我敢说你可以通过反复试验很快地在要填充的画布大小和要填充的画布大小之间找到一个快速而肮脏的公式。您应该添加的顶点数。

请注意,您可以轻松地将顶点模板自定义为任何类型的数据 [这是标准 wpf,但 Graph# 特定示例可以在 http://graphsharp.codeplex.com/discussions ]

如果您想编写自己的布局代码,您可能想看看 Graph# 使用的一些技术...例如动态缩放组件的源代码可在此处找到: http://wpfextensions.codeplex.com/

希望有所帮助

If you want something off the shelf, have a look at Graph#

http://graphsharp.codeplex.com/

videos here:

It does dynamic graph layout and is fairly easy to use. There are a choice of layout algorithms [see sample app] each of which are configurable.

however filling until an area is "full" is not something that'll work out of the box. Although you could for example create a graph, lay it out & then measure the ratio between the size of a vertex and the size of the whole graph, then add or remove vertexes until you hit upon your desired density. I would hazard you could pretty quickly by trial and error come up with a quick and dirty forumula between the size of canvas to fill & the number of vertexes you should add.

Note that you can customise the vertex templates pretty easily to be any kind of data [this is standard wpf but Graph# specific examples can be found on http://graphsharp.codeplex.com/discussions ]

if you wanted to code your own layout you might like to have a look at some of the techniques Graph# use... for example a dynamic zoom component the source for which is available here: http://wpfextensions.codeplex.com/

hope that helps a little

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