简体   繁体   English

Winforms / DevExpress中的分段条形图

[英]Segmented bar chart in Winforms/DevExpress

I'm trying to do a segmented bar chart of location and time for people. 我正在尝试为人们绘制位置和时间的分段条形图。

The X-axis is time. X轴是时间。 The people are on the Y-axis, with a single horizontal bar for each person. 人在Y轴上,每个人都有一个单杠。

Each bar will be broken up into segments, with each segment giving the person's location, specified by color and by text label/annotation. 每个条形图都将细分为多个部分,每个部分均以颜色和文字标签/注释指定人的位置。 Here's a crude hand-drawn example of what the end result should resemble: 下面是一个粗略的手绘示例,说明最终结果应该是什么样的:

分段条形图

The set of segments for each bar is not the same, which seems to be the root cause of my trouble. 每个条形图的分段集都不相同,这似乎是造成我麻烦的根本原因。 Every example of segmented bar chart that I have found uses the same set of segments for each bar, and just varies the size of each segment within the bar. 我发现的每个分段条形图示例都为每个条形图使用相同的分段集,只是改变了条形图中每个分段的大小。 In my example, each bar is pretty much independent of the other bars. 在我的示例中,每个条几乎都独立于其他条。

I haven't even been able to determine the exact name for this type of chart, so that has severely limited the googling. 我什至无法确定此类图表的确切名称,因此严重限制了谷歌搜索。

This is for a WinForms app. 这是针对WinForms应用程序的。 I have an old version of DevExpress, 12.1, but so far I'm not finding anything in there that does what I need. 我有一个旧版本的DevExpress 12.1,但是到目前为止,我找不到任何可以满足我需要的东西。 I'm not wedded to DevExpress. 我不嫁给DevExpress。 Any freeware/inexpensive tool would be acceptable, as long as it can be shown in a WinForm. 只要可以在WinForm中显示,任何免费软件/廉价工具都是可以接受的。

Thanks in advance for any pointers. 在此先感谢您提供任何指导。

This is a MSChart ChartType.RangeBar . 这是一个MSChart ChartType.RangeBar

在此处输入图片说明

I used this function to add the data points: 我使用此函数添加了数据点:

void addTask(Series s,  int who, DateTime startTime, 
                                 DateTime endTime, Color color, string task)
{
    int pt = s.Points.AddXY(who, startTime, endTime);
    s.Points[pt].AxisLabel = names[who];
    s.Points[pt].Label = task;
    s.Points[pt].Color = color;
}

Also a List<string> names . 还有一个List<string> names

Note that only one Series is used! 请注意,仅使用一个 Series Also that in Bar charts the x- and y-axis are switched! 另外,在Bar ,x轴和y轴已切换!

If you want to use it and run into questions about styling it, feel free to ask. 如果您想使用它并遇到有关样式的问题,请随时提出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM