当出节点出现异常时,整个坐标背景变成黄色,在打印区域打印数据字体同为黄色!
//设置坐标颜色/坐标名称颜色
ui->qCustomPlot->yAxis->setLabelColor(TextColor);
ui->qCustomPlot->xAxis->setTickLabelColor(TextColor);
ui->qCustomPlot->yAxis->setTickLabelColor(TextColor);
ui->qCustomPlot->xAxis->setBasePen(QPen(TextColor, TextWidth));
ui->qCustomPlot->yAxis->setBasePen(QPen(TextColor, TextWidth));
ui->qCustomPlot->xAxis->setTickPen(QPen(TextColor, TextWidth));
ui->qCustomPlot->yAxis->setTickPen(QPen(TextColor, TextWidth));
ui->qCustomPlot->xAxis->setSubTickPen(QPen(TextColor, TextWidth));
ui->qCustomPlot->yAxis->setSubTickPen(QPen(TextColor, TextWidth));
//设置画布背景色
QLinearGradient plotGradient;
plotGradient.setStart(0, 0);
plotGradient.setFinalStop(0, 350);
plotGradient.setColorAt(0, QColor(80, 80, 80));
plotGradient.setColorAt(1, QColor(50, 50, 50));
ui->qCustomPlot->setBackground(plotGradient);
//设置坐标背景色
QLinearGradient axisRectGradient;
axisRectGradient.setStart(0, 0);
axisRectGradient.setFinalStop(0, 350);
axisRectGradient.setColorAt(0, QColor(80, 80, 80));
axisRectGradient.setColorAt(1, QColor(30, 30, 30));
ui->qCustomPlot->axisRect()->setBackground(axisRectGradient);
//设置图例提示位置及背景色
ui->qCustomPlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignTop | Qt::AlignRight);
ui->qCustomPlot->legend->setBrush(QColor(255, 255, 255, 200));
ui->qCustomPlot->replot();