#include "main.h"
#include <qwt_plot_curve.h>
#include <qwt_symbol.h>
#include <qwt_plot_layout.h>
#include <qwt_plot.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//MainWindow w;
//w.show();
QwtPlot *plot = new QwtPlot;
plot->setTitle("Title"); //グラフのタイトル
plot->setFooter("Footer");
plot->setCanvasBackground(QBrush(Qt::white));//キャンバスの背景 青
plot->setAxisTitle(0,"[kw]"); // y軸のタイトル
plot->setAxisTitle(2,"Time [Sec]");
plot->setAxisScale( QwtPlot::yLeft, 0.0, 10.0 );
plot->setAxisScale( QwtPlot::xBottom, 0.0, 5.0 );
QwtPlotCurve *curve = new QwtPlotCurve();
curve->setTitle( "Some Points" );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
QwtSymbol *symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setSymbol( symbol );
QPolygonF points;
points << QPointF( 0.0, 4.4 ) << QPointF( 1.0, 3.0 )
<< QPointF( 2.0, 4.5 ) << QPointF( 3.0, 6.8 )
<< QPointF( 4.0, 7.9 ) << QPointF( 5.0, 7.1 );
curve->setSamples( points );
curve->attach( plot );
QwtPlotLayout *qwtLayout = plot->plotLayout();
qwtLayout->setCanvasMargin(100,QwtPlot::yLeft);
//plot->setPlotLayout(qwtLayout);
//plot->replot();
plot->resize( 600, 400 );
plot->show();
return a.exec();
}
void MyMain::setValueToTheLabel(double value)
{
qDebug() << QString::number( value );
}
2013年12月5日木曜日
QwtPlot::setPlotLayout(..)
とりあえず使い方
登録:
コメントの投稿 (Atom)

0 件のコメント:
コメントを投稿