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. last category is truncated in a qcategory axis
Forum Update on Monday, May 27th 2025

last category is truncated in a qcategory axis

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 238 Views
  • 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.
  • S Offline
    S Offline
    sachinrd
    wrote on last edited by
    #1

    Hello,
    I have a widget application and have plotted a chart . horizontal axis is a QCategory axis but the last category is being truncated as shown in the attachment. pls suggest a solution. thanks.

    Screenshot 2021-05-19 at 7.18.15 PM.png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Qt ?
      On which OS ?
      Can you provide a minimal compilable example that shows this behaviour ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sachinrd
        wrote on last edited by
        #3

        Hi, Thanks for the reply.
        Using QT ver-- 5.15.2
        Seeing the issue in MAC OSX .
        here is a simple code to reproduce the issue:

           QLineSeries *series = new QLineSeries();
            series->append(0, 6);
            series->append(2, 4);
            series->append(3, 8);
            series->append(7, 4);
            series->append(10, 5);
            *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
        
            QValueAxis *axisY = new QValueAxis();
            axisY->setTickCount(6);
            axisY->setRange(1, 8);
            QFont font;
            font.setPointSize(10);
            axisY->setTitleFont(font);
        
            QCategoryAxis *axisX = new QCategoryAxis;
            axisX->setMin(0);
            axisX->setMax(20);
            axisX->setLabelsPosition(QCategoryAxis::AxisLabelsPositionOnValue);
            axisX->append("test1",0);
            axisX->append("test2",7);
            axisX->append("tes looong string",20);
        
            QChart *chart = new QChart();
            chart->legend()->hide();
            chart->addSeries(series);
            chart->addAxis(axisY, Qt::AlignLeft);
            chart->addAxis(axisX, Qt::AlignBottom);
            chart->setTitle("Simple line chart example");
        
            QChartView *chartView = new QChartView(chart);
            chartView->setRenderHint(QPainter::Antialiasing);
        
            QMainWindow window;
            window.setCentralWidget(chartView);
            window.resize(400, 300);
            window.show();
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Please next time add the main part as well as include.

          From the looks of it the last category is not properly elided.

          You should check the bug report system to see if it's something known.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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