kopia lustrzana https://gitlab.com/tomaszg/geostat
Add caching days per month timeline
rodzic
37f945c70a
commit
a2e4fd3acf
24
geostat.cpp
24
geostat.cpp
|
@ -420,6 +420,30 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
std::cout << "<h2>Caching days per month</h2>\n";
|
||||
std::cout << "<table class=\"calendar_tab\">\n";
|
||||
std::cout << "<tr><th></th>";
|
||||
for (int j = 1; j <= 12; j++) { // print table month headers
|
||||
std::cout << "<th>" << j << "</th>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
|
||||
max = 31; // maximal value for histogram
|
||||
|
||||
for (int i = y_min; i <= y_max; i++) { // i -> years in rows
|
||||
std::cout << "<tr><th>" << i + 1900 << "</th> ";
|
||||
for (int j = 1; j <= 12; j++) { // j -> months in cols
|
||||
std::map<int, int> dates;
|
||||
for (auto el : cc) {
|
||||
if (el.date_tm.tm_mon == j - 1 && el.date_tm.tm_year == i)
|
||||
dates[el.date_tm.tm_mday]++;
|
||||
}
|
||||
std::cout << "<td style=\"--percent: " << dates.size() * 100 / max << "%\"><span>" << dates.size() << "</span></td>";
|
||||
}
|
||||
std::cout << "</tr>\n";
|
||||
}
|
||||
std::cout << "</table>\n";
|
||||
|
||||
// auto far = std::max_element(fcc.begin(), fcc.end(), [&](const Cache& a, const Cache& b) { return a.distance() < b.distance(); });
|
||||
// auto near = std::min_element(fcc.begin(), fcc.end(), [&](const Cache& a, const Cache& b) { return a.distance() < b.distance(); });
|
||||
//
|
||||
|
|
Ładowanie…
Reference in New Issue