简体   繁体   中英

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. 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.

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.

Thanks in advance for any pointers.

This is a 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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