C# 中的 ZedGraph 具有多个点的堆叠条形图
我拥有的是一个如下所示的配置文件:
Item|Size|Directory|Data
A|12|D_01|11/28/10
C|13|D_01|11/28/10
B|12|D_01|11/28/10
Back|122|D_02|11/28/10
Body|112|D_02|11/28/10
A|12|D_01|11/29/10
C|13|D_01|11/29/10
B|12|D_01|11/29/10
Back|122|D_01|11/29/10
Body|112|D_01|11/29/10
Arm|20|D_01|11/29/10
我的 x 轴是日期,我对此没有问题,如果我只有静态数量的实例来组成我的 YI 就可以了,但是我如何创建一个单独的堆叠条形图,可以自动为每个目录的每个项目点点?
因此,堆叠条 1 将是 ABC、身体、背部、手臂,示例显示在 29 上我添加了一个手臂项目。因此,28 号的第 1 条有 5 点,29 号的堆叠条 2 显示 6 点。
我希望这是有道理的.. 除了如何正确显示条形图之外,我不需要任何帮助。
What I have is a configuration file that looks like this:
Item|Size|Directory|Data
A|12|D_01|11/28/10
C|13|D_01|11/28/10
B|12|D_01|11/28/10
Back|122|D_02|11/28/10
Body|112|D_02|11/28/10
A|12|D_01|11/29/10
C|13|D_01|11/29/10
B|12|D_01|11/29/10
Back|122|D_01|11/29/10
Body|112|D_01|11/29/10
Arm|20|D_01|11/29/10
My x-axis is date, which I have no problem with, and if I only have a static number of instances to make up my Y I would be fine, but how do I create a single stacked bar graph that automatically make points for each item for each directory?
So stacked bar 1 would be A.B.C, Body, Back, Arm and the example shows on 29 I added an Arm item. So bar 1 on the 28th has 5 points, the stacked bar 2 on the 29th shows 6 points.
I hope that makes sense..
I don't need help with anything but how to display the bars appropriately.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题中不清楚目录将如何影响数据的显示,因此假设只有两个栏需要(2 个日期各 1 个),这是一个示例。有两种方法可以格式化日期轴并处理空数据: 1 使用 AxisType.Date= DateAsOrdinal 并为数据为 null 的日期添加零值,或使用 AxisType.Date=Date 添加 [2] 值,并且不为数据为 null 的日期添加值。如果存在空数据,DateAsOrdinal 似乎会将数据应用到错误的日期 - 这似乎是一个错误或至少不直观。该示例使用 AxisType.Date=Date 方法,该方法需要对日期轴进行额外的格式化。
It wasn't clear in the question how the directories would affect the display of data so, assuming that only two bars are needed (1 for each of 2 dates), here's an example. There are two ways to format the date axis and handle the null data: 1 using AxisType.Date=DateAsOrdinal and add values of zero for dates where data is null or [2] using AxisType.Date=Date and don't add values for dates where data is null. DateAsOrdinal seems to apply data to the wrong date if there is null data - which seems to be a bug or at least unintuitive. The example uses the AxisType.Date=Date approach which required extra formatting of the date axis.