X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=libctgraphics%2Fezplot.cpp;fp=libctgraphics%2Fezplot.cpp;h=ea29c766c4b33b90a94bcb2e610d593e95a2342d;hp=260d5badbc68b295c84a7f4b7bbc169526614bf4;hb=23f5654dacb1952c15bda92c2606fae3a55e48ad;hpb=9a334e5884e2e6d42afc43ac0d3d64d5fb340101 diff --git a/libctgraphics/ezplot.cpp b/libctgraphics/ezplot.cpp index 260d5ba..ea29c76 100644 --- a/libctgraphics/ezplot.cpp +++ b/libctgraphics/ezplot.cpp @@ -6,7 +6,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.cpp,v 1.27 2001/01/02 09:58:11 kevin Exp $ +** $Id: ezplot.cpp,v 1.28 2001/01/04 21:28:41 kevin Exp $ ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License (version 2) as @@ -723,18 +723,20 @@ EZPlot::plot (SGP* pSGP) if (o_yaxis == NOAXIS || o_ytlabel == FALSE) ytl_ofs = 0.0; else if (o_yticks == LEFT) { - double xExtent, yExtent; + double xExtentMin, xExtentMax, yExtent; char s[1024]; - snprintf (s, sizeof(s), y_numfmt, 0); - m_pSGP->getTextExtent (s, &xExtent, &yExtent); - ytl_ofs = -2.0 * charwidth - xExtent; + snprintf (s, sizeof(s), y_numfmt, ymin); + m_pSGP->getTextExtent (s, &xExtentMin, &yExtent); + snprintf (s, sizeof(s), y_numfmt, ymax); + m_pSGP->getTextExtent (s, &xExtentMax, &yExtent); + if (xExtentMin > xExtentMax) + xExtentMax = xExtentMin; + ytl_ofs = -xExtentMax; } else if (o_yticks == RIGHT) ytl_ofs = 1.5 * charwidth; xa_max -= 0.7 * x_fldwid * charwidth; // make room for last x tick label - - xt_min = xa_min; yt_min = ya_min; xt_max = xa_max; @@ -754,11 +756,11 @@ EZPlot::plot (SGP* pSGP) if (ytl_ofs != 0.0 && s_xcross == FALSE) { if (o_yticks == LEFT) { - xa_min += (2 + y_fldwid) * charwidth; + xa_min += 2*charwidth - ytl_ofs; // (2 + y_fldwid) * charwidth; xt_min = xa_min; } else if (o_yticks == RIGHT) { xa_min += 0.0; - xt_min = xa_min + ytl_ofs + y_fldwid * charwidth; + xt_min = xa_min + ytl_ofs; // + y_fldwid * charwidth; } } else xt_min = xa_min;