[Kst] extragear/graphics/kst/kst
Andrew Walker
arwalker at sumusltd.com
Mon Nov 21 22:15:25 CET 2005
SVN commit 482126 by arwalker:
Correctly position the transformed x/y-axis labels. Previously they would appear inside the plot axes and be misaligned with respect to their opposite axis labels.
M +9 -8 kst2dplot.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #482125:482126
@@ -5518,20 +5518,20 @@
// if top axis is transformed, plot top axis numbers as well
// FIXME: inefficient. We keep reparsing and re-rendering tpx.oppLabels[.]
- if (_xTransformed && !_suppressTop)
- {
+ if (_xTransformed && !_suppressTop) {
+ double xTickPos;
int yTopTickPos = d2i(ytop_bdr_px);
if (xTicksOutPlot()) {
yTopTickPos -= d2i(2.0 * xtick_len_px);
}
for (i = tpx.iLo; i < tpx.iHi; i++) {
- double xTickPos = x_orig_px + (double)i * xtick_px;
+ xTickPos = x_orig_px + (double)i * xtick_px;
if (_xReversed) {
xTickPos = x_px - xright_bdr_px - (xTickPos - xleft_bdr_px);
}
_xTickLabel->setText(tpx.oppLabels[i - tpx.iLo]);
p.save();
- p.translate(d2i(xTickPos) - _xTickLabel->size().width(), yTopTickPos + _xTickLabel->size().height() / 2);
+ p.translate(d2i(xTickPos) - _xTickLabel->size().width() / 2, yTopTickPos - _xTickLabel->size().height());
_xTickLabel->paint(p);
p.restore();
}
@@ -5570,11 +5570,11 @@
_yTickLabel->paint(p);
p.restore();
} else if (_yTickLabel->rotation() < 0) {
- p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos)-_yTickLabel->lineSpacing()/2);
+ p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos) - _yTickLabel->lineSpacing()/2);
_yTickLabel->paint(p);
p.restore();
} else if (_yTickLabel->rotation() > 0) {
- p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos) - _yTickLabel->size().height()+_yTickLabel->lineSpacing()/2);
+ p.translate(xTickPos - _yTickLabel->size().width(), d2i(yTickPos) - _yTickLabel->size().height() + _yTickLabel->lineSpacing()/2);
_yTickLabel->paint(p);
p.restore();
}
@@ -5583,19 +5583,20 @@
// if right axis is transformed, plot right axis numbers as well
if (_yTransformed && !_suppressRight) {
+ double yTickPos;
int xTopTickPos = d2i(x_px - xright_bdr_px + _yTickLabel->lineSpacing()*0.15);
if (yTicksOutPlot()) {
xTopTickPos += d2i(2.0 * ytick_len_px);
}
// FIXME: inefficient. We keep reparsing and re-rendering tpy.oppLabels[.]
for (i = tpy.iLo; i < tpy.iHi; i++) {
- double yTickPos = y_orig_px - (double)i * ytick_px;
+ yTickPos = y_orig_px - (double)i * ytick_px;
if (_yReversed) {
yTickPos = y_px - ybot_bdr_px - (yTickPos - ytop_bdr_px);
}
_yTickLabel->setText(tpy.oppLabels[i - tpy.iLo]);
p.save();
- p.translate(xTopTickPos - _yTickLabel->size().width(), d2i(yTickPos) + _yTickLabel->size().height() / 2);
+ p.translate(xTopTickPos, d2i(yTickPos) - _yTickLabel->size().height() / 2);
_yTickLabel->paint(p);
p.restore();
}
More information about the Kst
mailing list