QCustomPlot fixed grid and subGrid lines
-
Hi,
I am working on a project where I need to replicate ECG lines with fixed grid and subgrid lines. Something like this https://ecglibrary.com/ecgs/norm_2x.png
I am working with QCustomPlot library as stated in topic description.
I need to have doted lines every 2mm (converted to resolution) and fixed lines every 10mm.Does anyone have suggestions?
-
Hi
See https://www.qcustomplot.com/index.php/tutorials/basicplotting
section "...of the grid lines"
and the grid class
https://www.qcustomplot.com/documentation/classQCPGrid.html -
I have managed to setup tick and subtick grid lines with this code. But I am not sure how to determine distance between these lines.
/* X Axis: Style /
ui->printPlot->xAxis->grid()->setPen(QPen(QColor(170, 170, 170, 255), 1, Qt::SolidLine));
ui->printPlot->xAxis->grid()->setSubGridPen(QPen(QColor(170, 170, 170, 255), 1, Qt::DotLine));
ui->printPlot->xAxis->grid()->setVisible(true);
ui->printPlot->xAxis->grid()->setSubGridVisible(true);
ui->printPlot->xAxis->setBasePen(QPen(QColor(170, 170, 170, 255)));
ui->printPlot->xAxis->setTickPen(QPen(QColor(170, 170, 170, 255)));
ui->printPlot->xAxis->setSubTickPen(QPen(QColor(170, 170, 170, 255)));
ui->printPlot->xAxis->setUpperEnding(QCPLineEnding::esSpikeArrow);
ui->printPlot->xAxis->setTickLabelColor(QColor(170, 170, 170, 255));
//ui->printPlot->xAxis->setTickLabelFont(font);
/ Range *//* Y Axis */ ui->printPlot->yAxis->grid()->setPen(QPen(QColor(170, 170, 170, 255), 1, Qt::SolidLine)); ui->printPlot->yAxis->grid()->setSubGridPen(QPen(QColor(170, 170, 170, 255), 1, Qt::DotLine)); ui->printPlot->yAxis->grid()->setVisible(true); ui->printPlot->yAxis->grid()->setSubGridVisible(true); ui->printPlot->yAxis->setBasePen(QPen(QColor(170, 170, 170, 255))); ui->printPlot->yAxis->setTickPen(QPen(QColor(170, 170, 170, 255))); ui->printPlot->yAxis->setSubTickPen(QPen(QColor(170, 170, 170, 255))); ui->printPlot->yAxis->setUpperEnding(QCPLineEnding::esSpikeArrow); ui->printPlot->yAxis->setTickLabelColor(QColor(170, 170, 170, 255)); //ui->printPlot->yAxis->setTickLabelFont(font); /* Range */
-
Hi All, I haven't been able to figure out this either so far. There seems to be no option to reach the exact required value - the documentation states only 2 options which don't allow doing that, see: enum QCPAxisTicker::TickStepStrategy in :
https://www.qcustomplot.com/documentation/classQCPAxisTicker.html
Cheers,
Jan