本文介绍了Winforms / DevExpress中的分段条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为人们制作位置和时间的分段条形图。

I'm trying to do a segmented bar chart of location and time for people.

X轴是时间。人们在Y轴上,每个人都有一个水平条。

The X-axis is time. The people are on the Y-axis, with a single horizontal bar for each person.

每个条都将细分为多个部分,每个部分都给出了该人的位置,由颜色和文字标签/注释指定。这是最终结果应该是什么样的粗略手绘示例:

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.

这是针对WinForms应用的。我有一个旧版的DevExpress,即12.1,但是到目前为止,我找不到任何可以满足我需要的东西。我不嫁给DevExpress。只要可以在WinForm中显示,任何免费软件/廉价工具都是可以接受的。

This is for a WinForms app. I have an old version of DevExpress, 12.1, but so far I'm not finding anything in there that does what I need. I'm not wedded to DevExpress. Any freeware/inexpensive tool would be acceptable, as long as it can be shown in a WinForm.

感谢任何指针。

推荐答案

这是 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;
}

也有 List< string>名称

请注意,仅使用一个 系列!另外,在 Bar 图表中,x轴和y轴已切换!

Note that only one Series is used! Also that in Bar charts the x- and y-axis are switched!

如果要使用它,并遇到有关样式的问题,随时问。

If you want to use it and run into questions about styling it, feel free to ask.

这篇关于Winforms / DevExpress中的分段条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 23:26