当前位置:网站首页>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
边栏推荐
- 猜谜语啦(10)
- MySQL之MHA高可用集群
- 猜谜语啦(2)
- Example 003: a complete square is an integer. It is a complete square after adding 100, and it is a complete square after adding 168. What is the number?
- go依赖注入--google开源库wire
- STM32 --- serial port communication
- How to write cover letter?
- STM32---IIC
- 实例010:给人看的时间
- Arduino burning program and Arduino burning bootloader
猜你喜欢

剑指 Offer 06. 从尾到头打印链表
![[three tier architecture and JDBC summary]](/img/e0/13d48f2e59b445b9e28e38d45f492d.png)
[three tier architecture and JDBC summary]

Simple design description of MIC circuit of ECM mobile phone

Matlab tips (28) fuzzy comprehensive evaluation

Example 007: copy data from one list to another list.

猜谜语啦(10)

Xrosstools tool installation for X-Series

Bluebridge cup internet of things basic graphic tutorial - GPIO input key control LD5 on and off

STM32 --- serial port communication

Business modeling of software model | stakeholders
随机推荐
实例004:这天第几天 输入某年某月某日,判断这一天是这一年的第几天?
Example 005: three numbers sorting input three integers x, y, Z, please output these three numbers from small to large.
Problem solving: interpreter error: no file or directory
实例008:九九乘法表
Use indent to format code
STM32 single chip microcomputer - bit band operation
[three tier architecture and JDBC summary]
Negative pressure generation of buck-boost circuit
猜谜语啦(10)
STM32---ADC
[NAS1](2021CVPR)AttentiveNAS: Improving Neural Architecture Search via Attentive Sampling (未完)
Several problems to be considered and solved in the design of multi tenant architecture
List of linked lists
Weidongshan Internet of things learning lesson 1
How can fresh students write resumes to attract HR and interviewers
Daily question - input a date and output the day of the year
Run菜单解析
Go dependency injection -- Google open source library wire
Several implementation schemes of anti reverse connection protection of positive and negative poles of power supply!
QEMU STM32 vscode debugging environment configuration