QtChart vs QCustomplot



  • Hello guys,
    being QtChart rather new i was wondering how it is compared to QCustomplot in terms of features.
    I can't see a tracking line feature for example nor the possibility to code it yet (getNearestValue given a certain X,Y position is not available) without some troubles.

    Is this the solution for example?

    QPointF QChart::mapToPosition(const QPointF &value, QAbstractSeries *series)

    QPointF QChart::mapToValue(const QPointF &position, QAbstractSeries *series)

    QtChart looks nicely though in terms of themes.

    Anyone?



  • I can't see a tracking line feature

    Could you please elaborate by what you mean by tracking line

    getNearestValue given a certain X,Y position is not available

    This is just pythagorean theorem to calculate the distance for each point and a call to std::min_element to find the nearest. It can be coded in 5 minutes



  • @VRonin I meant to have a vertical cursor which is draggable around, it allows you to evaluate the sample (or the y value if it is a continuous function).

    Indeed you can code it but that was not the point, moreover if you factor in zoom and resize it could be a problem.

    Is there an easy way to do it with current the QChart implementation?



  • You mean something like this: http://doc.qt.io/qt-5/qtcharts-callout-example.html ?



  • @VRonin That's the example where i took the two functions mentioned in the first post, my question was if the library where ready to handle it.
    Assume you draw a vertical line, can it be make draggable?.
    If you have samples, can you make it stick to the sample upon mouse releasing for example?

    Can you suggest me a way to proceed?



  • You can use any of this signals to react to events on a series and do whatever


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.