Hi,

I am trying to place the value each bar represents above the bar. The bars are all part of different bar groups.
It seems I am not getting a value from dataPixelPosition that makes sense for this.

The result from dataPixelPosition does seem to have some relationship to the position of the bar within the group but it is definitely not the correct relationship.

This picture illustrates the effect: http://svenssonjoel.github.io/images/qcustomplot_bargroup.png

The code I am using to position text above bars looks like this:

 for (auto tick : tickVal) {
            double y = newBars->dataMainValue(tick-1);   // label to place above bar

            QPointF pos = newBars->dataPixelPosition(tick-1);
            double x2 = ui->responseTimeGroupedPlot->xAxis->pixelToCoord(pos.x());
            double y2 = ui->responseTimeGroupedPlot->yAxis->pixelToCoord(pos.y() - 20);
            QCPItemText *textlabel = new QCPItemText(ui->responseTimeGroupedPlot);

            textlabel->setColor(c);
            textlabel->setText(QString::number(y));

            textlabel->position->setAxes(ui->responseTimeGroupedPlot->xAxis, ui->responseTimeGroupedPlot->yAxis);
            textlabel->position->setType(QCPItemPosition::ptPlotCoords);
            textlabel->position->setCoords(x2,y2);
        }

Any insights would be much appreciated! Thanks a lot and have a nice day!