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. Need to move -90 rotated x-axis away from the axis grid
Forum Updated to NodeBB v4.3 + New Features

Need to move -90 rotated x-axis away from the axis grid

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 104 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.
  • R Offline
    R Offline
    rhb327
    wrote on last edited by
    #1

    My chart and x-axis setup is below. I'm building this chart in memory and then do a grab and convert to a BMP for thermal printing. My issues is my x-axis -90 label is too close to the grid and overwrites for larger numbers. I've tried to change the label format (even adding a space!), setMargins() and setContentMargins() to adjust without much success. setMargins() seems to give me more space from chart border to start of the x-axis -90 label but not more space from the start of the x-axis -90 label to the axis grid line. I use setContentMargins() to zoom a smidge to get rid of the chart border before I grab it.

    Any ideas on this?

        chart.setDropShadowEnabled(false);
    
        // These are the ones where I think I add pad from edge of chart to x-axis label start but does
        // not appear to add distance from left of x-axis label start to x-axis grid
        chart.setMargins(QMargins(50, 3, 10, 50));
        chart.setContentsMargins(-10, -10, -10, 0);
    
        chart.setAutoFillBackground(true);
        chart.setBackgroundBrush(QBrush(Qt::white));
        chart.setBackgroundPen(QPen(Qt::black, 2, Qt::SolidLine));
        chart.setPlotAreaBackgroundBrush(QBrush(Qt::white));
        chart.setTitle("");
        chart.legend()->hide();
    
        axisX.setLabelFormat("0%5.1f ");
        axisX.setLabelsColor("#FFFFFF");
        axisX.setTitleVisible(false);
        axisX.setTitleText("");
        axisX.setLabelsBrush(QBrush(Qt::black));
        axisX.setTitleBrush(QBrush(Qt::black));
        axisX.setLinePen(QPen(Qt::black, 2, Qt::SolidLine));
        axisX.setGridLinePen(QPen(Qt::black, 2, Qt::DotLine));
        axisX.setLabelsFont(QFont("NotoSans", 9, QFont::Bold, false));
    
        chart.addAxis(&axisX, Qt::AlignBottom);
    
        axisX.applyNiceNumbers();
        axisX.setLabelsAngle(-90);
    
    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