#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_curve_fitter.h>
#include <qwt_symbol.h>
int main(int argc, char **argv)
{
const QColor color
(35,
70,
106);
plot.setCanvasBackground(Qt::white);
plot.resize(600,400);
plot.show();
const double x[] = { 0, 1, 2, 4, 5, 8 };
const double y[] = { 17, 16.5, 8, 3, 12, 14.5 };
// Insert new curves
symbol.setSize(10, 10);
symbol.setBrush(color);
curve->setSymbol(symbol);
fitter->setSplineSize(100);
curve->setCurveFitter(fitter);
curve
->setPen
(QPen(color,
3));
curve->setData(x, y, 6);
curve->attach(&plot);
return a.exec();
}
#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_curve_fitter.h>
#include <qwt_symbol.h>
int main(int argc, char **argv)
{
const QColor color(35, 70, 106);
QApplication a(argc, argv);
QwtPlot plot;
plot.setCanvasBackground(Qt::white);
plot.resize(600,400);
plot.show();
const double x[] = { 0, 1, 2, 4, 5, 8 };
const double y[] = { 17, 16.5, 8, 3, 12, 14.5 };
// Insert new curves
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setStyle(QwtPlotCurve::Lines);
curve->setCurveAttribute(QwtPlotCurve::Fitted, true);
QwtSymbol symbol;
symbol.setStyle(QwtSymbol::Rect);
symbol.setSize(10, 10);
symbol.setBrush(color);
curve->setSymbol(symbol);
QwtSplineCurveFitter *fitter = new QwtSplineCurveFitter();
fitter->setFitMode(QwtSplineCurveFitter::ParametricSpline);
fitter->setSplineSize(100);
curve->setCurveFitter(fitter);
curve->setRenderHint(QwtPlotItem::RenderAntialiased);
curve->setPen(QPen(color, 3));
curve->setData(x, y, 6);
curve->attach(&plot);
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks