QCustomPlot Discussion and Comments

Use QCPBars to show intervalsReturn to overview

We are already using QCustomPlot for our In-House solutions and our customers as well.

We are often in need to display data of the following form:

Name Start Stop
Process1 2 4
Process2 4 7
Process1 7 8
Process3 1 2

For this kind of data we already some own interactive components, but which are not well suited to create high quality plots.
Actually, we have on the y-Axis the different kinds of Processes and on the x-Axis the values. Now, every process is displayed as
a horizontal bar in the respective row with its start and stop time.

Now I was wondering, if QCustomPlot already supports plotting of such interval diagrams by using QCPBars? How can I put my data
to QCPBars to achieve my desired result?

While QCPBars is not originally meant to do Gantt Charts as you require, It can surely be used as one in a simple way.

For every process you'd create a QCPBars plottable. Set its key axis to be the yAxis, and value axis the xAxis (so flipped from the usual x/y axis designation). This makes your bars go from left to right instead of bottom to top.
Set its setBaseValue to start. Now add a single data point with key equal to the coordinate you want to have the process appear at (vertical coordinate), and a value equal to the (stop-end) value.

It's a bit hacky. You could also consider using QCPItemRect with position topLeft/bottomRight anchored to plot coordinates accordingly.

FYI: A Gantt-Chart plottable is definitely on the list of upcoming plottables, together with polar charts.