Index: src/backend/worksheet/plots/cartesian/XYCurve.cpp =================================================================== --- src/backend/worksheet/plots/cartesian/XYCurve.cpp +++ src/backend/worksheet/plots/cartesian/XYCurve.cpp @@ -860,6 +860,7 @@ bool oldValue = isVisible(); setVisible(on); emit q->visibilityChanged(on); + retransform(); return oldValue; } @@ -868,6 +869,10 @@ Triggers the update of lines, drop lines, symbols etc. */ void XYCurvePrivate::retransform() { + + if (!isVisible()) + return; + DEBUG("\nXYCurvePrivate::retransform() name = " << name().toStdString() << ", m_suppressRetransform = " << m_suppressRetransform); DEBUG(" plot = " << plot); if (m_suppressRetransform || !plot) @@ -902,50 +907,70 @@ QApplication::processEvents(QEventLoop::AllEvents, 0); } - QPointF tempPoint; + //take over only valid and non masked points. + // remove points if they are on the same scene coord + { + #if PERFTRACE_CURVES == 1 + PERFTRACE(name().toLatin1() + ", XYCurvePrivate::retransform(), remove points"); + #endif + + AbstractColumn::ColumnMode xColMode = xColumn->columnMode(); + AbstractColumn::ColumnMode yColMode = yColumn->columnMode(); + if (xColumn->rowCount() > 0 && + (xColMode == AbstractColumn::ColumnMode::Numeric || + xColMode == AbstractColumn::ColumnMode::Integer || + xColMode == AbstractColumn::ColumnMode::DateTime) && + (yColMode == AbstractColumn::ColumnMode::Numeric || + yColMode == AbstractColumn::ColumnMode::Integer || + yColMode == AbstractColumn::ColumnMode::DateTime)) { + + QPointF p1= cSystem->mapSceneToLogical(QPointF(1,1)); + QPointF p2= cSystem->mapSceneToLogical(QPointF(0,0)); + double dxMinLogical = abs(p1.x()-p2.x()); + double dyMinLogical = abs(p1.y()-p2.y()); + + double xValue; + double yValue; + if (xColMode == AbstractColumn::DateTime) + xValue = xColumn->dateTimeAt(0).toMSecsSinceEpoch(); + else + xValue = xColumn->valueAt(0); + + if (yColMode == AbstractColumn::DateTime) + yValue = yColumn->dateTimeAt(0).toMSecsSinceEpoch(); + else + yValue = yColumn->valueAt(0); + + symbolPointsLogical.append(QPointF(xValue, yValue)); + connectedPointsLogical.push_back(true); + + for (int row = 1; row < xColumn->rowCount(); row++) { + if ( xColumn->isValid(row) && yColumn->isValid(row) + && (!xColumn->isMasked(row)) && (!yColumn->isMasked(row)) ) { + + if (xColMode == AbstractColumn::DateTime) + xValue = xColumn->dateTimeAt(row).toMSecsSinceEpoch(); + else + xValue = xColumn->valueAt(row); - AbstractColumn::ColumnMode xColMode = xColumn->columnMode(); - AbstractColumn::ColumnMode yColMode = yColumn->columnMode(); + if (yColMode == AbstractColumn::DateTime) + yValue = yColumn->dateTimeAt(row).toMSecsSinceEpoch(); + else + yValue = yColumn->valueAt(row); - //take over only valid and non masked points. - for (int row = 0; row < xColumn->rowCount(); row++) { - if ( xColumn->isValid(row) && yColumn->isValid(row) - && (!xColumn->isMasked(row)) && (!yColumn->isMasked(row)) ) { - switch (xColMode) { - case AbstractColumn::Numeric: - case AbstractColumn::Integer: - tempPoint.setX(xColumn->valueAt(row)); - break; - case AbstractColumn::Text: - break; - case AbstractColumn::DateTime: - tempPoint.setX(xColumn->dateTimeAt(row).toMSecsSinceEpoch()); - break; - case AbstractColumn::Month: - case AbstractColumn::Day: - break; - } + if (abs(symbolPointsLogical.last().x() - xValue) < dxMinLogical && abs(symbolPointsLogical.last().y()-yValue)< dyMinLogical) + continue; - switch (yColMode) { - case AbstractColumn::Numeric: - case AbstractColumn::Integer: - tempPoint.setY(yColumn->valueAt(row)); - break; - case AbstractColumn::Text: - break; - case AbstractColumn::DateTime: - tempPoint.setY(yColumn->dateTimeAt(row).toMSecsSinceEpoch()); - break; - case AbstractColumn::Month: - case AbstractColumn::Day: - break; + symbolPointsLogical.append(QPointF(xValue, yValue)); + connectedPointsLogical.push_back(true); + + } else { + if (!connectedPointsLogical.empty()) + connectedPointsLogical[connectedPointsLogical.size()-1] = false; } - symbolPointsLogical.append(tempPoint); - connectedPointsLogical.push_back(true); - } else { - if (!connectedPointsLogical.empty()) - connectedPointsLogical[connectedPointsLogical.size()-1] = false; } + + } } //calculate the scene coordinates