QCustomPlot Discussion and Comments

Setting Cooordinates Relative to AxisRectReturn to overview

Hi,
I have multiple Axisrects in one plotwindow and I want to draw lines / curves into a specific axisrect inside the plotwindow. However, the positions are always relative to the first / main axisrect, not relative to the axisrect I actually want to draw into. I tried to set the position elements to the correct axisrect like this:

        QCPItemStraightLine *infLine = new QCPItemStraightLine(info.pCstmPlt);
        infLine->point1->setAxisRect( axisRect ); // axisRect being a pointer to some axisrect
        infLine->point2->setAxisRect( axisRect );

However, this does not seem to have any effect. The positions are still measured relative to the main axis rect.

I need this also to work for curves where I tried to set the axisrect of the end / start / enddir and startdir positions, which also did not help. Any ideas?

Thank you so much!

Try this

    infLine->setClipAxisRect(axisRect );
    infLine->setClipToAxisRect(true);