1、添加一条曲线
ui->customPlot->addGraph();
QVector<double> x(2510), y0(2510);
for (int i=0; i<2500; ++i)
{
x[i] = i;
y0[i] = qExp(-i/1500.0)*qCos(i/100.0);
}
ui->customPlot->graph(0)->setData(x, y0);
2、坐标轴自适应曲线
ui->customPlot->graph(0)->rescaleAxes();
3、改变曲线的颜色
ui->customPlot->graph(0)->setPen(QPen(Qt::red));
4、添加图例
ui->customPlot->legend->setVisible(true);
5、设置图例字体
ui->customPlot->legend->setFont(QFont("Helvetica",14));
5、设置图例图标大小
ui->customPlot->legend->setIconSize(100, 20);
6、设置曲线名
ui->customPlot->graph(0)->setName("test");
7、设置背景色
ui->customPlot->setBackground(QBrush(QColor(0, 248, 0)));
8、设置渐变背景色
QLinearGradient gradient(0, 0, 0, 400);
gradient.setColorAt(0, QColor