[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Mon Nov 24 07:28:18 CET 2003
CVS commit by staikos:
Interpolate y axis manually in data mode
CCMAIL: 68040-done at bugs.kde.org
M +9 -1 kstview.cpp 1.57
--- kdeextragear-2/kst/kst/kstview.cpp #1.56:1.57
@@ -405,5 +405,13 @@ void KstView::updateMouse() {
for (KstBaseCurveList::Iterator i = pPlot->Curves.begin(); i != pPlot->Curves.end(); ++i) {
double xpt = 0.0, ypt = 0.0;
- (*i)->getPoint((*i)->sampleCount() * xpos / ((*i)->maxX() - (*i)->minX()), xpt, ypt);
+ double pt = (*i)->sampleCount() * xpos / ((*i)->maxX() - (*i)->minX());
+ (*i)->getPoint(pt, xpt, ypt);
+
+ // We have to get the previous point and interpolate y here, otherwise
+ // datamode y coordinates don't look right.
+ double xpt2 = 0.0, ypt2 = 0.0;
+ (*i)->getPoint(pt + 1, xpt2, ypt2);
+ ypt += (pt - xpt) * (ypt2 - ypt) / (xpt2 - xpt);
+
if (fabs(ypos - ypt) < delta) {
delta = fabs(ypos - ypt);
More information about the Kst
mailing list