Summary: | Zero point value not aligned with major tick | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | Andrew Walker <arwalker> |
Component: | general | Assignee: | kst |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | kst plot of curve with value = 14, curve is above the 14 tick mark. |
Description
Andrew Walker
2004-11-19 01:28:23 UTC
This seems true with other integer values as well (I have not tried floating points). (kst 1.1.0_devel) 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).
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 |