QCustomPlot Discussion and Comments

axis tick, showing min and max valueReturn to overview

Hi everyone,

I have a bar plot such that i set tick count for y axis to 3. In some cases, max value or start value of bar does not seen on y axis ticks. Ticks show intermediate values. (For ex: my bar starts from 40, ends at 170. my tick values are 50 100 150, but i want to see 40 and 170 in y-axis ticks.)

In summary, I need to see min and max value on y axis ticks. Is there a short way of doing this. ?
regards

It seems like QCustomPlot automactically plotting the ticks. If you want to set your own tick label, you can make an array of numeric value(for specific yaxis tick value) and an array of QString(for text label). Finally, the code would be like:

QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText);
for(int i = 0; i < N; i++) {
        counts.push_back(Y[i]);
        labels.push_back(YLabel[i]);
 }
textTicker->addTicks(counts, labels);
yAxis->setTicker(textTicker);