Skip to content
  • 0 Votes
    13 Posts
    518 Views
    E

    @JonB Thanks for your awesome reply. I think you are right. It only causes a problem (in the original example) if in on_pushButton_2_clicked the code calls setRange first and then call setTickInterval because (apparently) only setRange calls calcuilateLayout as you determined.

    I have submitted a bug report to Qt (QTBUG-124158). For now, I will mark this forum topic as 'solved' and then after the QTBUG is resolved I will come back to this forum topic and update it.

  • 0 Votes
    1 Posts
    103 Views
    No one has replied
  • 0 Votes
    5 Posts
    1k Views
    S

    Hi @J-Hilk,

    thanks for your reply and your suggestions. I was looking the Qwt myself yesterday and I used it, as you suggested, to create the charts as I wanted. Next following the function InitializeCharts() at my first comment but with the Qwt module/library now

    #include <QwtPlot> #include <QwtPlotScaleItem> void InitializeCharts() { // pan ui->gimbalPositionPanQwtPlot->setTitle("Pan Position"); ui->gimbalPositionPanQwtPlot->enableAxis(QwtAxis::YLeft, false); ui->gimbalPositionPanQwtPlot->enableAxis(QwtAxis::XBottom, false); ui->gimbalPositionPanQwtPlot->enableAxis(QwtAxis::YLeft, false); ui->gimbalPositionPanQwtPlot->enableAxis(QwtAxis::XBottom, false); ui->gimbalPositionPanQwtPlot->setAxisScale(QwtAxis::YLeft, -90.0, 90.0); ui->gimbalPositionPanQwtPlot->setAxisScale(QwtAxis::XBottom, -90.0, 90.0); QwtPlotScaleItem *panVerticalAxisScale = new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0); panVerticalAxisScale->attach(ui->gimbalPositionPanQwtPlot); QwtPlotScaleItem *panHorizontalAxisScale = new QwtPlotScaleItem(QwtScaleDraw::BottomScale, 0.0); panHorizontalAxisScale->attach(ui->gimbalPositionPanQwtPlot); // tilt ui->gimbalPositionTiltQwtPlot->setTitle("Tilt Position"); ui->gimbalPositionTiltQwtPlot->enableAxis(QwtAxis::YLeft, false); ui->gimbalPositionTiltQwtPlot->enableAxis(QwtAxis::XBottom, false); ui->gimbalPositionTiltQwtPlot->enableAxis(QwtAxis::YLeft, false); ui->gimbalPositionTiltQwtPlot->enableAxis(QwtAxis::XBottom, false); ui->gimbalPositionTiltQwtPlot->setAxisScale(QwtAxis::YLeft, -90.0, 90.0); ui->gimbalPositionTiltQwtPlot->setAxisScale(QwtAxis::XBottom, 0.0, 90.0); QwtPlotScaleItem *tiltVerticalAxisScale = new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0); tiltVerticalAxisScale->attach(ui->gimbalPositionTiltQwtPlot); QwtPlotScaleItem *tiltHorizontalAxisScale = new QwtPlotScaleItem(QwtScaleDraw::BottomScale, 0.0); tiltHorizontalAxisScale->attach(ui->gimbalPositionTiltQwtPlot); }

    The output would look like the following

    0936b8d6-3d0d-49ec-8f58-ed1cbd7b9653-image.png

    which is close enough for me of what I wanted to achieve.

    Thanks again @J-Hilk for your time replying to my issue.

    Kind regards,

    Stavros

  • 1 Votes
    4 Posts
    3k Views
    AlexB89A

    I'm not sure how this happened to the previous two question askers, but for me the solution was quite simple. Qt works just fine at displaying the plot axis data so long as you:

    Have enough space to do so Don't mess with the default settings

    In my case, I had the axis tick count set pretty high which was causing the labels to squish together. If you leave the tick counts at their default, or let Qt decide, it should work just fine.

  • 0 Votes
    1 Posts
    645 Views
    No one has replied