[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Fri Mar 4 03:34:22 CET 2005
CVS commit by arwalker:
Clean up the x-axis and y-axis labels. Should also prevent overlapping of labels on the x-axis.
97395_done at bugs.kde.org
M +10 -11 kst2dplot.cpp 1.365
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.364:1.365
@@ -1813,5 +1812,4 @@ void Kst2DPlot::setBorders(double& xleft
true, _isXAxisInterpreted, _xOffsetMode);
ybot_bdr_px = tpx.maxHeight;
- //ybot_bdr_px += 3*XLabel->lineSpacing(p)/2;
ybot_bdr_px += XLabel->lineSpacing(p);
@@ -1821,5 +1819,6 @@ void Kst2DPlot::setBorders(double& xleft
xleft_bdr_px = tpy.maxWidth;
- xleft_bdr_px += 3*YLabel->lineSpacing(p)/2;
+ xleft_bdr_px += YLabel->lineSpacing(p);
+ xleft_bdr_px += YTickLabel->lineSpacing(p) / 4;
// calculate the right border
@@ -1831,4 +1830,5 @@ void Kst2DPlot::setBorders(double& xleft
XFullTickLabel->setText(tpx.labels[0]);
YFullTickLabel->setText(tpy.labels[0]);
+
if (XFullTickLabel->width(p) + xleft_bdr_px + YFullTickLabel->lineSpacing(p) >= (x_px - XLabel->width(p))/2.0) {
ybot_bdr_px += XFullTickLabel->lineSpacing(p);
@@ -5899,6 +5898,4 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
double ytick_len_px, int y_px,
bool offsetX, bool offsetY) {
- Q_UNUSED(offsetX)
-
QString TmpStr, TmpStrOld;
double X1, Y1;
@@ -6032,5 +6029,9 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
if (tpx.delta && tpx.labels.count() > 0) {
XFullTickLabel->setText(tpx.labels[0]);
- XFullTickLabel->draw(p, d2i(xleft_bdr_px), y_px);
+ if (offsetX && !XLabel->text().isEmpty()) {
+ XFullTickLabel->draw(p, d2i(xleft_bdr_px), d2i(y_px) - XLabel->lineSpacing(p));
+ } else {
+ XFullTickLabel->draw(p, d2i(xleft_bdr_px), d2i(y_px));
+ }
tpx.labels.pop_front();
}
@@ -6051,9 +6052,7 @@ void Kst2DPlot::plotAxes(QPainter& p, QR
YFullTickLabel->setText(tpy.labels[0]);
if (offsetY && !YLabel->text().isEmpty()) {
- YFullTickLabel->draw(p, (YFullTickLabel->lineSpacing(p) - YFullTickLabel->ascent(p))/2 + YLabel->lineSpacing(p), d2i(y_px - ybot_bdr_px));
- } else if (YLabel->lineSpacing(p) > YFullTickLabel->lineSpacing(p)){
- YFullTickLabel->draw(p, (YLabel->lineSpacing(p) - YLabel->ascent(p))/2 + YLabel->ascent(p) - YFullTickLabel->ascent(p), d2i(y_px - ybot_bdr_px));
+ YFullTickLabel->draw(p, YLabel->lineSpacing(p), d2i(y_px - ybot_bdr_px));
} else {
- YFullTickLabel->draw(p, (YFullTickLabel->lineSpacing(p) - YFullTickLabel->ascent(p))/2, d2i(y_px - ybot_bdr_px));
+ YFullTickLabel->draw(p, 0, d2i(y_px - ybot_bdr_px));
}
tpy.labels.pop_front();
More information about the Kst
mailing list