[Solved]More qwt plot questions

  • In the documentation of QWT plot there is a code like this

    @#include "../include/qwt_plot.h>

    QwtPlot *myPlot;
    long curve1, curve2; // keys
    double x[100], y1[100], y2[100]; // x and y values

    myPlot = new QwtPlot("Two Graphs", parent, name);

    // add curves
    curve1 = myPlot->insertCurve("Graph 1");
    curve2 = myPlot->insertCurve("Graph 2");

    getSomeValues(x, y1, y2);

    // copy the data into the curves
    myPlot->setCurveData(curve1, x, y1, 100);
    myPlot->setCurveData(curve2, x, y2, 100);

    // finally, refresh the plot

    But when I try to use this methods setCurveData and insertCurve the compiler says
    error: ‘class QwtPlot’ has no member named ‘insertCurve’ etc.

    And the documentation is upto date I think.

    The other QWT widgets works and got there members but not this.

    is it a old doc on the net or;

  • Moderators

    I have downloaded qwt-6.0.1 as a zip file less than a week ago. It is fairly small (<4MB). It contains in the doc directory an html documentation. The files have been generated on August 1, 2011. I assume that this the most recent documentation available. At least it refers to the compatibility of qwt 6.x on the main page.

  • Moderators

    This seems to be the same documentation on the "web ":http://qwt.sourceforge.net/index.html

  • Did you look in Qwt's headers files for setCurveData and insertCurve?

  • Well, QwtPlot neither has a setCurveData or a insertCurve member nor does its documentation have an example like the one you've listed above. You're most probably mixing 5.x libraries with 6.x documentation and vice versa. They are not compatible.

  • There was never such methods. Try something like this:
    QwtPlot *myPlot = new QwtPlot("Two Graphs");
    QwtPlotCurve *curve1 = new QwtPlotCurve("Graph 1");
    QwtPlotCurve *curve2 = new QwtPlotCurve("Graph 2");

    //set curve color
    curve1->setPen(QPen(Qt::green, 2));
    curve1->setPen(QPen(Qt::red, 2));

    // add curves

    const int MAX_VALUES = 100;
    double x[MAX_VALUES], y1[MAX_VALUES], y2[MAX_VALUES];// x and y values
    getSomeValues(x, y1, y2);

    // copy the data into the curves
    curve1->setRawSamples(x, y1, MAX_VALUES);
    curve1->setRawSamples(x, y2, MAX_VALUES);

    // finally, refresh the plot
    it's untestet...
    And of course take a look at very well examples in the qwt source.

  • Yes this looks like my old function.
    Thank you

Log in to reply

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