QCustomPlot Discussion and Comments

Change to display values for an axisReturn to overview

Hey,

is there an easy way to change to display values for an axis?

My data for the graph x-axis is in milliseconds,
but I want to display only seconds on the x-axis, eg. instead of 3300 -> I want 3,3
(Changing the input data from milliseconds to seconds is no option)

I tried with customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime),
but this cannot work because as numbers representing the seconds (as Doc says)

I think with xAxis->setNumberFormat(...) I cannot see how it could work either

Any suggestions?

Hi,
I should have looked closer in the documentation or the very good examples, it can easily be done by:

  customPlot->xAxis->setAutoTicks(false);
  customPlot->xAxis->setAutoTickLabels(false);
  customPlot->xAxis->setTickVector(QVector<double>() << 1 << 2 << 3);
  customPlot->xAxis->setTickVectorLabels(QVector<QString>() << "1" << "2" << "3");

Cheers