ページ

2013年11月28日木曜日

配列のデータでグラフを描く


#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QwtPlot(parent),
    ui(new Ui::MainWindow)
{
    //ui->setupUi(this);

    double xval[5]={10,20,30,40,50};
    double yval[5]={1,2.2,3,4,5};

    setTitle( "Plot Demo" );//グラフのタイトル
    setTitle("first_plot");
    setAxisTitle(QwtPlot::xBottom, " System time [h:m:s]");
    setAxisScale(QwtPlot::xBottom, 0,60 );
    setAxisTitle(QwtPlot::yLeft, "Degree");
    setAxisScale(QwtPlot::yLeft, -60,60 );

    curve = new QwtPlotCurve();
    curve->setPen(QPen(Qt::blue));
    curve->setSamples(xval,yval,5);
    curve->attach(this);

    resize( 600, 400 );
}

MainWindow::~MainWindow()
{
    delete ui;
}



0 件のコメント:

コメントを投稿