#ifndef _HLM_GRAPH_H_
#define _HLM_GRAPH_H_
#include <qcustomplot.h>
class hlm_temp_Graph : public QWidget
{
public:
explicit hlm_temp_Graph(QWidget *parent = 0);
~hlm_temp_Graph();
bool set_XY_Vector_value(QVector<double> &, QVector<double> &);
private:
QCustomPlot *customplot;
};
#endif // HLM_GRAPH_H
#include "hlm_graph.h"
#include <QPushButton>
hlm_temp_Graph::hlm_temp_Graph(QWidget *parent) : QWidget(parent)
{
customplot = new QCustomPlot(this);
this->resize(800, 480);
customplot->resize(350, 130);
customplot->move(440, 310);
}
bool hlm_temp_Graph::set_XY_Vector_value(QVector<double> &X_Vectorcount, QVector<double> &Y_Vectortemp)
{
QVector<double> Y_tempTickVertor(7); //y轴温度大刻度数组
for ( int i = 0; i < Y_tempTickVertor.size(); i++)
{
Y_tempTickVertor[i] = i * 5;
}
for ( int i = 0; i < X_Vectorcount.size(); i++ )
{
X_Vectorcount[i] = i + 1; //将来用来代表x轴上第几次采集温度的次数
}
QCPGraph *graph1 = customplot->addGraph();
graph1->setData(X_Vectorcount, Y