QCustomPlot Discussion and Comments

Display values above QCPBarsReturn to overview

Is it possible to display values above bars using QCPBars?
Like here: https://dl.dropboxusercontent.com/u/73455782/bars.png

You can use the QCPItemText class and put an item above the bars:
http://www.qcustomplot.com/index.php/tutorials/items

An example:

    QCPBars *myBars = new QCPBars(customPlot->xAxis, customPlot->yAxis);
    customPlot->addPlottable(myBars);
    myBars->setName("Bars Series with Labels");
    double spacing = 0.25;
    for(int x=1; x < 11; x++){
        double y = x+2;
        myBars->addData(QCPBarData::QCPBarData(x,y));
        //Creating and configuring an item
        QCPItemText *textLabel = new QCPItemText(customPlot);
        customPlot->addItem(textLabel);
        textLabel->setClipToAxisRect(false);
        textLabel->position->setAxes(customPlot->xAxis,customPlot->yAxis);
        textLabel->position->setType(QCPItemPosition::ptPlotCoords);
        //placing the item over the bar with a spacing of 0.25
        textLabel->position->setCoords(x,y+spacing);
        //Customizing the item
        textLabel->setText(QString::number(y));
        textLabel->setFont(QFont(font().family(), 9));
        textLabel->setPen(QPen(Qt::black));
    }
    customPlot->rescaleAxes();
    customPlot->replot();

Looks like addItem is not available, as of the time of writing. My customPlot object is created as
customPlot= new QCustomPlot; What we do in this case?

Nevermind my previous question. Looks we simply omit the addItem thing altogether. Thanks for your guys' help though, it works perfect.