Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QCustomPlot fixed grid and subGrid lines
Forum Updated to NodeBB v4.3 + New Features

QCustomPlot fixed grid and subGrid lines

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zgembo
    wrote on 12 Feb 2019, 13:37 last edited by Zgembo 2 Dec 2019, 13:38
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 12 Feb 2019, 13:42 last edited by
      #2

      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

      Z 1 Reply Last reply 13 Feb 2019, 09:28
      3
      • M mrjj
        12 Feb 2019, 13:42

        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

        Z Offline
        Z Offline
        Zgembo
        wrote on 13 Feb 2019, 09:28 last edited by
        #3

        @mrjj From the documentation I understand that I need to use QCPAxisTickerFixed class, but I do not understand how to determine tick step on order to have grid lines every 2mm and 10mm.

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          Zgembo
          wrote on 13 Feb 2019, 12:54 last edited by
          #4

          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 */
          
          1 Reply Last reply
          0
          • H Offline
            H Offline
            HeyBirdie
            wrote on 9 Aug 2021, 14:04 last edited by
            #5

            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

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved