QCustomPlot Discussion and Comments

Multiple points per xaxis tic?Return to overview

Is there a way to load multiple points per xaxis tic? I was trying something like this but I only see the y-axis value of 100 for each point:

    
for (int i=0; i<XAXIS_TICS; i++)
        for (int j=0; j<DATA_POINTS_PER_TIC; j++)
            m_plotQmap->insert(i*j,QCPData(i,j*100));

The easiest method to add data to a plot is QCPGraph::addData and setting (replacing) the data can be done with QCPGraph::setData.

If you want to modify a QCPDataMap yourself, make sure to do it properly. In your case, you set the map's key to "i*j" but the QCPData key to i. This causes undefined behaviour and I'm guessing this is your problem.

If you want multiple graphs ("multiple data points per tick"), use multiple QCPGraphs accordingly. If you want it as a parametric curve, use QCPCurve.