Need to move -90 rotated x-axis away from the axis grid
-
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);