QCustomPlot - show item on QCPAxisRect below customPlot

前端 未结 1 806
执笔经年
执笔经年 2021-02-13 23:59

In a project resembling the QCustomPlot financial demo I want to draw a QCPItemRect not only into the chart area, but also to the area below the chart.

Having

相关标签:
1条回答
  • 2021-02-14 01:01

    Found the answer (thanks to the author of QCustomPlot). The missing components were

    1. Settings the clipAxisRect of the rectangle (already contained in the last update of question)
    2. Settings the axes, which the rectangle obeys.

    Specifically,

     xRectItem->setClipAxisRect     ( xRect );
    

    and

     xRectItem->topLeft     ->setAxes( xRect->axis(QCPAxis::atBottom), xRect->axis(QCPAxis::atLeft) );
     xRectItem->bottomRight ->setAxes( xRect->axis(QCPAxis::atBottom), xRect->axis(QCPAxis::atLeft) );
    
    0 讨论(0)
提交回复
热议问题