Hi all,

I've got a line graph showing dates on the X-axis, but the labels and ticks are irregularly spaced. I have a hunch that this is because my data are also irregularly spaced, i.e. not daily.

Here's how I set up the plot:

// Graph style
    QPen drawPen;
    drawPen.setColor(Qt::black);
    drawPen.setStyle(Qt::PenStyle::SolidLine);
    drawPen.setWidth(2);

    QSharedPointer<QCPAxisTickerDateTime> dateTicker(new QCPAxisTickerDateTime);
    dateTicker->setDateTimeFormat("MMMM\nyyyy");
    dateTicker->setTickCount(5);
    dateTicker->setTickStepStrategy(QCPAxisTickerDateTime::tssMeetTickCount);
    abv_plot->xAxis->setTicker(dateTicker);
    abv_plot->addGraph();
    abv_plot->graph()->setPen(drawPen);
    abv_plot->graph(0)->data()->set(time_data);
    abv_plot->xAxis->setLabel("Date");
    abv_plot->yAxis->setLabel("Consumption");
    abv_plot->xAxis->setRange(min_year, max_year);
    abv_plot->yAxis->setRange(min_consumed, max_consumed);
    abv_plot->resize(parent->width(), parent->height() / 4);
    abv_plot->graph(0)->rescaleAxes();
    abv_plot->replot();

Where time_data is a QVector<QCPGraphData>.

Here's an example:
https://imgur.com/a/6QMGPPC

Is there anything that can be done to make this show, maybe, every three months? How could I properly account for labels when there are only 1-2 months worth of data?