added racelistgenerator + changed title of windows with drivers and car statistics

This commit is contained in:
2018-12-11 14:59:00 +01:00
parent ddb632c4fd
commit 5d31497f1c
7 changed files with 284 additions and 13 deletions

View File

@@ -33,8 +33,6 @@ Result::Result(DataBase * db, int rennid, QWidget * parent)
// this->rennid = 39;
this->rennid = rennid;
this->drawPlots(rennid);
// test data
header.push_back("Spalte 1");
header.push_back("Spalte 2");
@@ -58,7 +56,7 @@ Result::Result(DataBase * db, int rennid, QWidget * parent)
<< boost::lexical_cast<string>(rennid);
try {
QString renndatum = this->db->getData2(statement.str(), 1).at(0).at(0);
this->renndatum = this->db->getData2(statement.str(), 1).at(0).at(0);
this->setWindowTitle(renndatum);
} catch (std::exception & e) {
Q_UNUSED(e);
@@ -295,6 +293,8 @@ Result::Result(DataBase * db, int rennid, QWidget * parent)
}
this->ui->tWResult->resizeColumnsToContents();
this->ui->tWResult->horizontalHeader()->setStretchLastSection(true);
this->drawPlots(rennid);
}
void Result::drawPlots(int rennid) {
@@ -623,16 +623,18 @@ void Result::plotCars(vector<string> carNames, vector<struct Times> times) {
string strMinRange = boost::str(boost::format("%.2f") % minRange);
string strMaxRange = boost::str(boost::format("%.2f") % maxRange);
double distance = (maxRange - minRange) / 35;
cout << "renndatum: " << this->renndatum.toStdString() << endl;
gp << "set yrange [" << strMinRange << ":" << strMaxRange << "]\n";
gp << "set term wxt title '" << this->renndatum.toStdString() << "'\n";
gp << "set boxwidth 0.3\nset style fill solid\n";
gp << "set title 'Vergleich der Autos'\n";
gp << "set ylabel 'Zeit in Sekunden'\n";
gp << "set xlabel 'Autos'\n";
gp << "show grid\nset grid ytics lc rgb '#bbbbbb' lw 1 lt 0\n";
gp << "plot" << gp.file1d(xy_pts)
<< "with boxes title 'Shell' lt rgb '#FF0000', '' u 1:($2 + "
"0.05):($2) with labels notitle"
<< std::endl;
<< "with boxes title 'Shell' lt rgb '#FF0000', '' u 1:($2 + " << distance
<< "):($2) with labels notitle" << std::endl;
xy_pts.clear();
for (size_t i = 0; i < carNames.size(); i++) {
@@ -641,7 +643,8 @@ void Result::plotCars(vector<string> carNames, vector<struct Times> times) {
}
gp << "replot" << gp.file1d(xy_pts)
<< "with boxes title 'Dea' lt rgb '#00FF00', ''u 1:($2 + 0.05):($2) "
<< "with boxes title 'Dea' lt rgb '#00FF00', ''u 1:($2 + " << distance
<< "):($2) "
"with labels notitle"
<< std::endl;
}
@@ -676,16 +679,18 @@ void Result::plotDrivers(vector<string> driverNames,
string strMinRange = boost::str(boost::format("%.2f") % minRange);
string strMaxRange = boost::str(boost::format("%.2f") % maxRange);
double distance = (maxRange - minRange) / 35;
gp << "set yrange [" << strMinRange << ":" << strMaxRange << "]\n";
gp << "set term wxt title '" << this->renndatum.toStdString() << "'\n";
gp << "set boxwidth 0.3\nset style fill solid\n";
gp << "set title 'Vergleich der Fahrer'\n";
gp << "set ylabel 'Zeit in Sekunden'\n";
gp << "set xlabel 'Fahrer'\n";
gp << "show grid\nset grid ytics lc rgb '#bbbbbb' lw 1 lt 0\n";
gp << "plot" << gp.file1d(xy_pts)
<< "with boxes title 'Shell' lt rgb '#FF0000', '' u 1:($2 + "
"0.05):($2) with labels notitle"
<< std::endl;
<< "with boxes title 'Shell' lt rgb '#FF0000', '' u 1:($2 + " << distance
<< "):($2) with labels notitle" << std::endl;
xy_pts.clear();
for (size_t i = 0; i < driverNames.size(); i++) {
@@ -694,7 +699,8 @@ void Result::plotDrivers(vector<string> driverNames,
}
gp << "replot" << gp.file1d(xy_pts)
<< "with boxes title 'Dea' lt rgb '#00FF00', ''u 1:($2 + 0.05):($2) "
<< "with boxes title 'Dea' lt rgb '#00FF00', ''u 1:($2 +" << distance
<< "):($2) "
"with labels notitle"
<< std::endl;
}