Bug 93548 - Zero point value not aligned with major tick
Summary: Zero point value not aligned with major tick
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-19 01:28 UTC by Andrew Walker
Modified: 2004-12-09 21:30 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
kst plot of curve with value = 14, curve is above the 14 tick mark. (9.07 KB, image/png)
2004-12-09 18:26 UTC, Matthew Truch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2004-11-19 01:28:23 UTC
Version:           0.99(devel) (using KDE KDE 3.2.1)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:

When plotting a data set that starts with values of 0.0 the lines drawn for the curve does not
intersect the 0.0 major tick at the y-axis, but instead lies slightly above it.

STEPS TO REPRODUCE:

Open any data set that starts with several values of 0.0
Plot it against an INDEX value
Make sure the curve has lines enabled
Notice that the line lies slightly above the 0.0 major tick on the y-axis
Comment 1 Matthew Truch 2004-12-09 18:21:16 UTC
This seems true with other integer values as well (I have not tried floating points).  (kst 1.1.0_devel)
Comment 2 Matthew Truch 2004-12-09 18:26:01 UTC
Created attachment 8592 [details]
kst plot of curve with value = 14, curve is above the 14 tick mark.

Plot of curve with value = 14 exactly.	Note how curve is slightly higher than
the tick mark for 14. (kst 1.1.0_devel, datasource is indirect dirfile
streaming live).
Comment 3 Andrew Walker 2004-12-09 21:30:21 UTC
CVS commit by arwalker: 

Fix problem with zero point offset.

CCMAIL: 93548-done@bugs.kde.org


  M +10 -13    kst2dplot.cpp   1.305


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.304:1.305
@@ -2035,5 +2035,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
       d2i(x_px - xright_bdr_px - xleft_bdr_px + 1.0),
       d2i(y_px - ybot_bdr_px - ytop_bdr_px + 1.0));
-  QRect RelPlotAndAxisRegion(d2i(YLabel->lineSpacing(p) + 1),
+  QRect RelPlotAndAxisRegion(d2i(YLabel->lineSpacing(p) + 1.0),
                         d2i(ytop_bdr_px),
                         d2i(x_px - YLabel->lineSpacing(p) - xright_bdr_px),
@@ -2041,8 +2041,6 @@ void Kst2DPlot::draw(QPainter &p, KstPai
   QRect RelWinRegion(0, 0, d2i(x_px), d2i(y_px));
 
-  x_orig_px = (tpx.org - x_min) / (x_max - x_min) *
-    double(RelPlotRegion.width()) + xleft_bdr_px;
-  y_orig_px = (y_max - tpy.org) / (y_max-y_min) * double(RelPlotRegion.height())
-    + ytop_bdr_px;
+  x_orig_px = (tpx.org - x_min) / (x_max - x_min) * double(RelPlotRegion.width()) + xleft_bdr_px;
+  y_orig_px = (y_max - tpy.org) / (y_max - y_min) * double(RelPlotRegion.height()) + ytop_bdr_px;
   xtick_px = (tpx.tick / (x_max - x_min)) * double(RelPlotRegion.width());
   ytick_px = (tpy.tick / (y_max - y_min)) * double(RelPlotRegion.height());
@@ -2055,6 +2053,6 @@ void Kst2DPlot::draw(QPainter &p, KstPai
   // only attempt to draw if plot is big enough
   //
-  if (x_px - xright_bdr_px - xleft_bdr_px >= 10 &&
-      y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10) {
+  if (x_px - xright_bdr_px - xleft_bdr_px >= 10.0 &&
+      y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10.0) {
     Lx = RelPlotRegion.left();
     Hx = RelPlotRegion.right();
@@ -2064,5 +2062,5 @@ void Kst2DPlot::draw(QPainter &p, KstPai
     m_Y = -double(RelPlotRegion.height())/(y_max - y_min);
     b_X = Lx - m_X * x_min;
-    b_Y = Hy - m_Y * y_min;
+    b_Y = Ly - m_Y * y_max;
     if (type != P_PRINT && type != P_EXPORT) {
       _m_X = m_X;
@@ -5315,6 +5312,6 @@ void Kst2DPlot::plotCurves(QPainter& p,
         bool has_right = true;
         bool visible = true;
-        double drX, rX2=0.0;
-        int x0, y0, w, h;
+        double rX2 = 0.0;
+        double drX;
 
         if (c->barStyle() == 1) { // filled