如何创建相等数量,相等大小的网格列和行? [英] How to create equal number, equal size grid columns and rows?
问题描述
大家好,
我有一个特殊的挑战。也许,实现起来非常棘手。
我必须可视化这样的数据:https://drive.google.com/file/d/0B9nOduJIKxoeQWI5Z0g0aDhzSk0/view ?usp =分享
这是一个平方的Treemap图表。好吧,我必须构建一个WPF应用程序,使用这个平方树形图表可视化某些数据。不幸的是,我没有开源库像api一样使用以上述方式可视化。
因此,我提出了一个想法。
想法就是这样,
1.创建网格。
2.如果我有n个数据项。然后,创建一个'n'个框(将网格划分为行和列)。
3.然后循环行和列并更改每个单元格的属性。
然而,我发现难以根据'n'数字来划分网格逻辑。
在上面pic我有150台机器,其中一些是km型,有些是pu型机器。因此,为了可视化150台机器的数据,我需要在网格内有150个盒子。现在,我的问题是这个的逻辑是什么。
$ 150 $ b 150台机器我需要150个侧箱网格。这150是一个变量,它的值是动态给出的,网格中的单元格应该动态创建。
如果,任何人都有这个逻辑的想法可以与我分享。或者,如果您知道/有任何开源库在wpf中使用sqaured treemap图表,请帮助我。
非常感谢。
Hi everyone,
I have a peculiar challenge. Perhaps, it is very tricky to achieve.
I have to visualize data like this : https://drive.google.com/file/d/0B9nOduJIKxoeQWI5Z0g0aDhzSk0/view?usp=sharing
This a squared Treemap chart. Well I have to build a WPF application which visualize certain data using this squared treemap chart. Unfortunately, I dont have open source library to use like an api to visualize in the above way.
Hence, I came up with an idea.
Idea is this,
1. create a grid.
2. If i have "n" number of data items. Then, create a 'n' number of boxes ( divide grid into rows and columns ).
3. And then loop the rows and columns and change the properites of each cell.
However, I am finding difficulty in arriving a logic to divide the grid based on 'n' number.
In above pic, I have 150 machines, out of which some are km type and some are pu type machines. hence, in order to visualise the data of 150 machines i need 150 boxes inside grid. Now, my question is what is the logic for this.
for 150 machines i need 150 boxes in side grid. and this 150 is a variable its value is given dynamically and the cells inside grid should be created dynamically.
If, anyone has an idea for this logic can share with me. Or if u know/have any opensource library to use sqaured treemap chart in wpf please help me with it.
Thank you very much.
推荐答案
选项1
如果您的网格高度和宽度是固定的。然后使用
自定义gridview类实现gridview
并覆盖onrowcreating方法,你可以设置行的高度和宽度。\
Optio 2:假设U有一个gridview,它位于主网格中,根据屏幕大小得到实际的宽度和高度,然后划分行和列,并为每个设置高度和宽度。
有关键字 sharedsizegroup
这篇关于如何创建相等数量,相等大小的网格列和行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!