void MainWindow
::View_tank_Details(QString local
) {
for (refIndx=0; refIndx<16; refIndx++)
{
if (cardinalP[refIndx].contains(local))
{
//ui->Tanque1Level->display((fuelvalues[refIndx]*FUELTANKCAP)/1023);
TankIndex = refIndx;
ui->Tanque1Level->display(rand() % 30000);
ui->GraphTitle->setText(local);
}
}
myPlot
= new QwtPlot(ui
->GraphPlot
);
myPlot->setGeometry( 5, 70, 590, 325 );
myPlot->setStyleSheet("background-color:black; color:rgb(255,255,255);border: 0px;");
//myPlot->setTitle(title);
myPlot
->setAxisTitle
(QwtPlot::xBottom,
"Horas");
myPlot
->setAxisTitle
(QwtPlot::yLeft,
"Litros");
myPlot
->setAxisScale
(QwtPlot::xBottom,
0,
96);
//48); myPlot
->setAxisMaxMajor
(QwtPlot::xBottom,
12);
//24); myPlot
->setAxisMaxMinor
(QwtPlot::xBottom,
0);
myPlot
->setAxisScale
(QwtPlot::yLeft,
0,
30000);
// grid
grid->enableXMin(true);
grid
->setMajPen
(QPen(Qt
::white,
0, Qt
::DotLine));
grid
->setMinPen
(QPen(Qt
::white,
0 , Qt
::DotLine));
grid->attach(myPlot);
for (int i = 0; i < 97; i++)//49; i++)
{
xplot[i] = i;
//yplot[i] = (rand() % 30000);//i * (rand() % 30000) * cos(i / M_PI);
yplot[i] = (i * (rand() % 300) * cos(i / M_PI));
//yplot[i] = testcnt;
}
//m_curve->setPen(QColor(Qt::yellow));
m_curve
->setPen
(QPen(QColor::fromRgb(0,
0,
255),
1));
m_curve->setRawSamples(xplot, yplot, 97);//49);
m_curve->setTitle("Curva do nivel de combustivel");
m_curve->attach(myPlot);
myPlot->canvas());
d_picker
->setRubberBandPen
(QColor(Qt
::green));
d_picker
->setRubberBand
(QwtPicker::CrossRubberBand);
d_picker
->setTrackerPen
(QColor(Qt
::yellow));
myPlot->show();
}
void MainWindow::View_tank_Details(QString local)
{
QwtPlot *myPlot = new QwtPlot;
QwtPlotCurve *m_curve = new QwtPlotCurve;
for (refIndx=0; refIndx<16; refIndx++)
{
if (cardinalP[refIndx].contains(local))
{
//ui->Tanque1Level->display((fuelvalues[refIndx]*FUELTANKCAP)/1023);
TankIndex = refIndx;
ui->Tanque1Level->display(rand() % 30000);
ui->GraphTitle->setText(local);
}
}
myPlot = new QwtPlot(ui->GraphPlot );
myPlot->setGeometry( 5, 70, 590, 325 );
myPlot->setStyleSheet("background-color:black; color:rgb(255,255,255);border: 0px;");
//myPlot->setTitle(title);
myPlot->setAxisTitle(QwtPlot::xBottom, "Horas");
myPlot->setAxisTitle(QwtPlot::yLeft, "Litros");
myPlot->setAxisScale(QwtPlot::xBottom, 0, 96);//48);
myPlot->setAxisMaxMajor(QwtPlot::xBottom, 12);//24);
myPlot->setAxisMaxMinor(QwtPlot::xBottom, 0);
myPlot->setAxisScale(QwtPlot::yLeft, 0, 30000);
// grid
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::white, 0 , Qt::DotLine));
grid->attach(myPlot);
for (int i = 0; i < 97; i++)//49; i++)
{
xplot[i] = i;
//yplot[i] = (rand() % 30000);//i * (rand() % 30000) * cos(i / M_PI);
yplot[i] = (i * (rand() % 300) * cos(i / M_PI));
//yplot[i] = testcnt;
}
m_curve= new QwtPlotCurve();
m_curve->setSymbol(new QwtSymbol(QwtSymbol::Cross, Qt::NoBrush, QPen(Qt::white), QSize(5, 5) ) );
//m_curve->setPen(QColor(Qt::yellow));
m_curve->setCurveAttribute(QwtPlotCurve::Fitted);
m_curve->setLegendAttribute(QwtPlotCurve::LegendShowLine);
m_curve->setPen(QPen(QColor::fromRgb(0, 0, 255), 1));
m_curve->setRawSamples(xplot, yplot, 97);//49);
m_curve->setTitle("Curva do nivel de combustivel");
m_curve->attach(myPlot);
QwtPlotPicker *d_picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
myPlot->canvas());
d_picker->setRubberBandPen(QColor(Qt::green));
d_picker->setRubberBand(QwtPicker::CrossRubberBand);
d_picker->setTrackerPen(QColor(Qt::yellow));
myPlot->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks