QCustomPlot Discussion and Comments

showing custom tick labelsReturn to overview

I have 100 value for x-axis.

for(int i = 0; i < 100; i++)
{
    axisX[i] = i;
    labelX[i] = QString::number(i)+"a";
}

ui->plot->addGraph();
ui->plot->graph(0)->setData(eksenX, eksenY);

plot has 8 x-values (0-15-30-45-60-75-90-105);
then I add this

ui->plot->xAxis->setAutoTickLabels(false);
ui->plot->xAxis->setTickVectorLabels(labelX);

now x-values are: (0a-1a-2a-3a-4a-5a-6a-7a)

but I want that: (0a-15a-30a-45a-60a-75a-90a-105a)

How can I do that? (I use 1.2.0-beta)

You set the labels to be in steps of 1, so why should they show in steps of 15? To get steps of 15, you should rather change the loop to:

int tickPosition = 0;
int index = 0;
while (tickPosition < 105)
{
    axisX[index] = tickPosition;
    labelX[index] = QString::number(tickPosition)+"a";
    tickPosition += 15;
    ++index;
}