#41 QwtPlotCurve discontinuity


This patch adds the possibility to manage discontinuity (or gaps) in QwtPlotCurve.
For this, it just needed to add two virtual members to QwtSeriesData :
-nDiscontinuities() which returns the number of discontinuities
-discontinuity(size_t i) which returns the data index for the ith discontinuity
Obviously, the default implementation of nDiscontinuities returns zero, so all existing code are compatible with this patch

Currently it just works for lines, but it would be a very easy thing to add this feature to Steps, or whatever kind of QwtPlotCurve.
The advantage over existing patch (like http://www.qtcentre.org/threads/21756-How-to-create-QWT-plot-curve-with-gaps) is that it does not imply to have a special data value for discontinuities, and it does not add any data reading loop, so there is nearly no impact on performances.
I'm completely open remarks, and ready to improve this feature, so that it can make its way inside qwt

1 Attachments


  • Uwe Rathmann

    Uwe Rathmann - 2014-01-17

    I would prefer a solution like it has been proposed in feature request #47. Guess it is a good idea to do, what has been established in other plotting software.

    My plan is to add a flag to QwtSeriesData where checks for NaN can be enabled/disabled to avoid any performance regression, when such a feature is not needed.

    A patch in this direction would have excellent chances to become part of Qwt.

  • Eric Lemanissier

    In my case (maybe I am not alone), I need to handle discontinuities in plots but it is very important that this feature do not add an iteration through the data (each curve can have more than 100000 data, and there are at least 4 of these curves on screen).
    Would that be suitable if the check for NaN and infs happens in the existing data iteration in qwt_plot_mapper.cpp (qwtToPoints, qwtToPolylineFiltered and qwtToPointsFiltered).
    I may be mistaking, but it seems like QPainter::drawPolyline does not handle NaN and infs values. This would imply that the functions QwtPointMapper::toPointsF and QwtPointMapper::toPolygonF return a QVector<QPolygonF> instead of QPolygonF, and similar changes in QwtPlotCurve::draw*
    Would such a solution be acceptable ?

  • Uwe Rathmann

    Uwe Rathmann - 2014-02-04

    For design discussions like this one - please continue on the Qwt mailing list.



Cancel  Add attachments