Bug 95020 - invisible curves when width != 0 or type != solid
Summary: invisible curves when width != 0 or type != solid
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-12 22:16 UTC by Nicolas Brisset
Modified: 2004-12-14 06:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
testcase for a non-steady curve (27.36 KB, text/plain)
2004-12-12 22:18 UTC, Nicolas Brisset
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Brisset 2004-12-12 22:16:42 UTC
Version:           1.1.0_devel (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
OS:                Linux (i686) release 2.6.3-7mdk

When you draw curves with a width > 0 or a type different from the default solid line they are not always visible !

To reproduce:
1. Create a text file containing 50 lines with a '0' in each
2. Plot the 1st column against INDEX with the data wizard: it works
3. Edit curve attributes (contextual menu) and set width to 1
4. Notice the curve has disappeared. If you zoom in with the mouse, chances are you'll see it, but not with key accelerators (Shift+Down). Intriguing, isn't it ? 

Notes:
- it is apparently not linked with grid lines
- in some cases where values are not steady, parts of the curve are also missing. It is hopefully all the same bug. To check, use the data file I'll append to the bug report (width set to 1 gives a strange curve).
Comment 1 Nicolas Brisset 2004-12-12 22:18:00 UTC
Created attachment 8642 [details]
testcase for a non-steady curve
Comment 2 Andrew Walker 2004-12-13 02:30:54 UTC
It seems that after changing the curve properties the curve is not updated. 
If you resize the window the plot is in then the curve correctly updates and
all appears well.
Comment 3 Nicolas Brisset 2004-12-14 00:04:29 UTC
Resizing does not change anything here on those curves where the problem happens. By the way, it seems to always happen when variations are small or null (i.e. in those parts corresponding to more or less steady values). I hope that's a hint ?
Comment 4 Netterfield 2004-12-14 06:16:41 UTC
CVS commit by netterfield: 

BUG: 95020
when more than one data point lies in a pixel, a vertical line is drawn
in that pixel, from the min to max point in the pixel.  If ymin==ymax,
then the line is of zero length.  With linewidth!=0, a 0 length line draws
nothing.  Hence, no line.

This adds linewidth to the length of the vertical line - so something always
gets drawn.


  M +8 -3      kst2dplot.cpp   1.319


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.318:1.319
@@ -5093,7 +5093,10 @@ void Kst2DPlot::plotCurves(QPainter& p,
         int index = 0;
         int i0Start = i0;
+        double lw;
+
+        lw = (c->lineWidth() < penWidth ? penWidth : c->lineWidth());
 
         p.setPen(QPen(c->color(),
-                    (c->lineWidth() < penWidth ? penWidth : c->lineWidth()),
+                      int(lw),
                     style));
 
@@ -5183,4 +5186,6 @@ void Kst2DPlot::plotCurves(QPainter& p,
                     if (maxY <= Hy && minY >= Ly) {
                       if (style == Qt::SolidLine) {
+                        minY-=lw/1.99999;
+                        maxY+=lw/1.99999;
                         p.drawLine(d2i(X2), d2i(minY), d2i(X2), d2i(maxY));
                       } else {