当前位置:网站首页>Wheel 1:qcustomplot initialization template
Wheel 1:qcustomplot initialization template
2022-07-05 08:34:00 【Lao Zhao's blog】
void mainWindow::initTable(QCustomPlot *customPot, QString strX, QString strY)
{
QLinearGradient plotGradient;
plotGradient.setStart(0, 0);
plotGradient.setFinalStop(0, 350);
plotGradient.setColorAt(0, QColor(37, 40, 45));
plotGradient.setColorAt(1, QColor(37, 40, 45));
customPot->setBackground(plotGradient); // Set the background color
QLinearGradient axisRectGradient;
axisRectGradient.setStart(0, 0);
axisRectGradient.setFinalStop(0, 350);
axisRectGradient.setColorAt(0, QColor(37, 40, 45));
axisRectGradient.setColorAt(1, QColor(37, 40, 45));
customPot->axisRect()->setBackground(axisRectGradient); // Set up QCPAxisRect The background color
//x
customPot->xAxis->setTicks(true);
customPot->xAxis->setBasePen(QPen(Qt::white, 1)); // The brush of the axis
customPot->xAxis->setTickPen(QPen(Qt::white, 1)); // Brush of axis scale line
customPot->xAxis->setSubTickPen(QPen(Qt::white, 1)); // The brush of the axis graduation line
customPot->xAxis->setTickLabelColor(Qt::white); // Axis scale text color
customPot->xAxis->setLabel(strX); // Only set the label , The color of the axis label will be displayed
customPot->xAxis->setLabelColor(Qt::white); // Shaft label color
customPot->xAxis->setTickLengthIn(3); // The length of the scale in the axis
customPot->xAxis->setTickLengthOut(5); // The length of the scale outside the axis
customPot->xAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);
//y
customPot->yAxis->setTicks(true);
customPot->yAxis->setBasePen(QPen(Qt::white, 1)); // The brush of the axis
customPot->yAxis->setTickPen(QPen(Qt::white, 1)); // Brush of axis scale line
customPot->yAxis->setSubTickPen(QPen(Qt::white, 1)); // The brush of the axis graduation line
customPot->yAxis->setTickLabelColor(Qt::white); // Axis scale text color
customPot->yAxis->setLabel(strY); // Only set the label , The color of the axis label will be displayed
customPot->yAxis->setLabelColor(Qt::white); // Shaft label color
customPot->yAxis->setTickLengthIn(3); // The length of the scale in the axis
customPot->yAxis->setTickLengthOut(5); // The length of the scale outside the axis
customPot->yAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);
// Set up x Number of shaft scales
customPot->xAxis->ticker()->setTickCount(10);//10 A major scale
customPot->xAxis->ticker()->setTickStepStrategy(QCPAxisTicker::tssReadability);// Readability is better than setting
// Each grid corresponds to a scale
customPot->xAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine)); // Gridlines ( Corresponding scale ) paint brush
customPot->yAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine));
customPot->xAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine)); // Sub grid lines ( Corresponding sub scale ) paint brush
customPot->yAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine));
customPot->xAxis->grid()->setSubGridVisible(true); // Show sub gridlines
customPot->yAxis->grid()->setSubGridVisible(true);
customPot->xAxis->grid()->setZeroLinePen(Qt::NoPen);
customPot->yAxis->grid()->setZeroLinePen(Qt::NoPen);
// Allow mouse drag and scroll wheel zoom
customPot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
customPot->yAxis->setSubTicks(false);
}
The first wheel , Make a note of , Can be used directly , Convenient for reuse in the future
边栏推荐
- How to write cover letter?
- STM32 lights up the 1.8-inch screen under Arduino IDE
- Take you to understand the working principle of lithium battery protection board
- 关于线性稳压器的五个设计细节
- 剑指 Offer 06. 从尾到头打印链表
- Various types of questions judged by prime numbers within 100 (C language)
- QEMU demo makefile analysis
- 287. 寻找重复数-快慢指针
- Old Wang's esp8266 and old Wu's ws2818 light strip
- 每日一题——输入一个日期,输出它是该年的第几天
猜你喜欢
猜谜语啦(9)
[paper reading] the latest transfer ability in deep learning: a survey in 2022
An enterprise information integration system
Talk about the circuit use of TVs tube
MHA High available Cluster for MySQL
OC and OD gate circuit
如何写Cover Letter?
How to copy formatted notepad++ text?
Several important parameters of LDO circuit design and type selection
DCDC circuit - function of bootstrap capacitor
随机推荐
Is the security account given by Yixue school safe? Where can I open an account
实例003:完全平方数 一个整数,它加上100后是一个完全平方数,再加上168又是一个完全平方数,请问该数是多少?
Example 008: 99 multiplication table
Summary of SIM card circuit knowledge
猜谜语啦(6)
STM32 outputs 1PPS with adjustable phase
Business modeling of software model | stakeholders
Negative pressure generation of buck-boost circuit
Stablq of linked list
Talk about the circuit use of TVs tube
关于线性稳压器的五个设计细节
STM32 single chip microcomputer - bit band operation
【三层架构及JDBC总结】
Arrangement of some library files
猜谜语啦(9)
Stm32--- systick timer
Xrosstools tool installation for X-Series
剑指 Offer 09. 用两个栈实现队列
Sword finger offer 06 Print linked list from end to end
Classic application of MOS transistor circuit design (1) -iic bidirectional level shift