1
votes

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:

Segmented bar chart

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.

1

1 Answers

0
votes

This is a MSChart ChartType.RangeBar.

enter image description here

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.