customplot 图例

   //将图例设置成横排显示

ui->customplot->legend->addElement(0,1,ui->customplot->legend->item(1));
    ui->customplot->legend->addElement(0,2,ui->customplot->legend->item(2));
//图例置于底部
    ui->customplot->legend->setMargins(QMargins(320,1,1,1));
        int count = ui->customplot->plotLayout()->rowCount();
        ui->customplot->plotLayout()->addElement(count,0, ui->customplot->legend);

        ui->customplot->plotLayout()->setRowStretchFactor(count, 0.0001);  //设置行的伸展因子

         ui->customplot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignRight|Qt::AlignTop);
posted @ 2021-10-25 16:34  Azuki_op  阅读(438)  评论(0)    收藏  举报