1、導入QTCreator函數
將qcustomplot.c qcustomplot.h 文件導入項目文件夾ui
並在工程文件加入 QT += printsupportspa
在QT 設計師界面,在主窗口加入一個Widget組件,並右鍵選中,選中 提高爲...,添加QCustomPlot類設計
以後組建,編譯,便可出現默認的座標系。在主函數文件當中,能夠實驗ui->widget去訪問qcustomplot對象code
2、基本用法對象
2.1 設置座標系blog
1 mPlot->xAxis->setRange(-6.0, 6.0); 2 mPlot->yAxis->setRange(0, 12.0); 3 mPlot->addGraph(mPlot->yAxis, mPlot->xAxis);
2.2 設置畫筆get
QPen drawPen; drawPen.setColor(Qt::gray); drawPen.setWidth(1); drawPen.setStyle(Qt::DashLine); mPlot->graph(0)->setPen(drawPen);
3、進階用法編譯