I have setup 12 charts in my App and had activated the Interaction Mode as follows:
for(int i=0; i<12; ++i) { customPlot[i]->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes); ... }
When clicking the X axis on the 1st graph the selected axis will be highlighted in blue, which is good. When clicking the X axis on the 2nd graph now both X axes (1st and 2nd graph) are highlighted in blue. How do I overwrite this behavior so that only the last clicked axis is being highlighted (the 1st x axis should be deselected automatically). I had tried to find the current selected axis as follows but I end up getting both graphs.
QCustomPlot *selectedPlot; for (int i=0; i<12; ++i) { if (customPlot[i]->xAxis->selectedParts().testFlag(QCPAxis::spAxis) ) { customPlot[i]->xAxis->setSelectedParts(QCPAxis::spAxis); selectedPlot = customPlot[i]; ... } }
Until then I found QCPAxis::getPartAt(QPointF &pos) from the API but I have no idea how to use it to solve this problem. Please help.