summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrián Medraño Calvo <adrian@medranocalvo.com>2017-07-20 10:23:32 (GMT)
committerAdrián Medraño Calvo <adrian@medranocalvo.com>2017-07-20 10:23:32 (GMT)
commit1a9e6fbab4255c85ceee5891b705a31feccc4413 (patch)
tree9643684c3ff56c6d068f1cd4e96c3291527ab491
parent71312d1e172edf9c37e7a16ab881980523d5babd (diff)
downloadblt-1a9e6fbab4255c85ceee5891b705a31feccc4413.zip
blt-1a9e6fbab4255c85ceee5891b705a31feccc4413.tar.gz
blt-1a9e6fbab4255c85ceee5891b705a31feccc4413.tar.bz2
Place axes within their area when using multiple axis in a single margin
-rw-r--r--generic/tkbltGrAxis.C102
1 files changed, 51 insertions, 51 deletions
diff --git a/generic/tkbltGrAxis.C b/generic/tkbltGrAxis.C
index 2d8dbfb..49d4850 100644
--- a/generic/tkbltGrAxis.C
+++ b/generic/tkbltGrAxis.C
@@ -1268,7 +1268,17 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
switch (margin) {
case MARGIN_TOP:
{
- axisLine = graphPtr_->top_;
+ int mark = graphPtr_->top_ - offset - pad;
+ tickAnchor_ = TK_ANCHOR_S;
+ left_ = screenMin_ - inset - 2;
+ right_ = screenMin_ + screenRange_ + inset - 1;
+ if (gops->stackAxes)
+ top_ = mark - marginPtr->axesOffset;
+ else
+ top_ = mark - height_;
+ bottom_ = mark;
+
+ axisLine = bottom_;
if (ops->exterior) {
axisLine -= gops->plotBW + axisPad + ops->lineWidth / 2;
tickLabel = axisLine - 2;
@@ -1283,16 +1293,6 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
tickLabel = graphPtr_->top_ - gops->plotBW - 2;
}
- int mark = graphPtr_->top_ - offset - pad;
- tickAnchor_ = TK_ANCHOR_S;
- left_ = screenMin_ - inset - 2;
- right_ = screenMin_ + screenRange_ + inset - 1;
- if (gops->stackAxes)
- top_ = mark - marginPtr->axesOffset;
- else
- top_ = mark - height_;
- bottom_ = mark;
-
int x, y;
if (ops->titleAlternate) {
x = graphPtr_->right_ + AXIS_PAD_TITLE;
@@ -1328,23 +1328,8 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
* tick
* title
*/
- axisLine = graphPtr_->bottom_;
- if (gops->plotRelief == TK_RELIEF_SOLID)
- axisLine++;
-
- if (ops->exterior) {
- axisLine += gops->plotBW + axisPad + ops->lineWidth / 2;
- tickLabel = axisLine + 2;
- if (ops->lineWidth > 0)
- tickLabel += ops->tickLength;
- }
- else {
- axisLine -= axisPad + ops->lineWidth / 2;
- tickLabel = graphPtr_->bottom_ + gops->plotBW + 2;
- }
-
int mark = graphPtr_->bottom_ + offset;
- float fangle = fmod(ops->tickAngle, 90.0);
+ double fangle = fmod(ops->tickAngle, 90.0);
if (fangle == 0.0)
tickAnchor_ = TK_ANCHOR_N;
else {
@@ -1357,12 +1342,27 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
left_ = screenMin_ - inset - 2;
right_ = screenMin_ + screenRange_ + inset - 1;
- top_ = graphPtr_->bottom_ + labelOffset - t1;
+ top_ = mark + labelOffset - t1;
if (gops->stackAxes)
bottom_ = mark + marginPtr->axesOffset - 1;
else
bottom_ = mark + height_ - 1;
+ axisLine = top_;
+ if (gops->plotRelief == TK_RELIEF_SOLID)
+ axisLine++;
+
+ if (ops->exterior) {
+ axisLine += gops->plotBW + axisPad + ops->lineWidth / 2;
+ tickLabel = axisLine + 2;
+ if (ops->lineWidth > 0)
+ tickLabel += ops->tickLength;
+ }
+ else {
+ axisLine -= axisPad + ops->lineWidth / 2;
+ tickLabel = graphPtr_->bottom_ + gops->plotBW + 2;
+ }
+
int x, y;
if (ops->titleAlternate) {
x = graphPtr_->right_ + AXIS_PAD_TITLE;
@@ -1421,7 +1421,17 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
* G = graph border width
* H = highlight thickness
*/
- axisLine = graphPtr_->left_;
+ int mark = graphPtr_->left_ - offset;
+ tickAnchor_ = TK_ANCHOR_E;
+ if (gops->stackAxes)
+ left_ = mark - marginPtr->axesOffset;
+ else
+ left_ = mark - width_;
+ right_ = mark - 3;
+ top_ = screenMin_ - inset - 2;
+ bottom_ = screenMin_ + screenRange_ + inset - 1;
+
+ axisLine = right_;
if (ops->exterior) {
axisLine -= gops->plotBW + axisPad + ops->lineWidth / 2;
tickLabel = axisLine - 2;
@@ -1435,16 +1445,6 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
tickLabel = graphPtr_->left_ - gops->plotBW - 2;
}
- int mark = graphPtr_->left_ - offset;
- tickAnchor_ = TK_ANCHOR_E;
- if (gops->stackAxes)
- left_ = mark - marginPtr->axesOffset;
- else
- left_ = mark - width_;
- right_ = mark - 3;
- top_ = screenMin_ - inset - 2;
- bottom_ = screenMin_ + screenRange_ + inset - 1;
-
int x, y;
if (ops->titleAlternate) {
x = mark - (width_ / 2);
@@ -1466,7 +1466,18 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
case MARGIN_RIGHT:
{
- axisLine = graphPtr_->right_;
+ int mark = graphPtr_->right_ + offset + pad;
+ tickAnchor_ = TK_ANCHOR_W;
+ left_ = mark;
+ if (gops->stackAxes)
+ right_ = mark + marginPtr->axesOffset - 1;
+ else
+ right_ = mark + width_ - 1;
+
+ top_ = screenMin_ - inset - 2;
+ bottom_ = screenMin_ + screenRange_ + inset -1;
+
+ axisLine = left_;
if (gops->plotRelief == TK_RELIEF_SOLID)
axisLine++;
@@ -1481,17 +1492,6 @@ void Axis::offsets(int margin, int offset, AxisInfo *infoPtr)
tickLabel = graphPtr_->right_ + gops->plotBW + 2;
}
- int mark = graphPtr_->right_ + offset + pad;
- tickAnchor_ = TK_ANCHOR_W;
- left_ = mark;
- if (gops->stackAxes)
- right_ = mark + marginPtr->axesOffset - 1;
- else
- right_ = mark + width_ - 1;
-
- top_ = screenMin_ - inset - 2;
- bottom_ = screenMin_ + screenRange_ + inset -1;
-
int x, y;
if (ops->titleAlternate) {
x = mark + (width_ / 2);