kopia lustrzana https://gitlab.com/tomaszg/geostat
Add extra class specifier to histograms
rodzic
fe6f540bd7
commit
62129dca09
10
common.cpp
10
common.cpp
|
@ -50,6 +50,14 @@ void show_histogram(const Caches& cc, std::string Cache::*ptr, const std::string
|
|||
sort(pairs.begin(), pairs.end(), [&](std::pair<std::string, int>& a, std::pair<std::string, int>& b) { return a.first < b.first; });
|
||||
|
||||
if (html) {
|
||||
std::string id;
|
||||
id.reserve(caption.size());
|
||||
|
||||
for (size_t i = 0; i != caption.size(); i++) {
|
||||
if (caption[i] == ' ') continue;
|
||||
if (std::isupper(caption[i])) id.push_back(std::tolower(caption[i]));
|
||||
else id.push_back(caption[i]);
|
||||
}
|
||||
int max;
|
||||
if (sort_by_val)
|
||||
max = pairs[0].second;
|
||||
|
@ -57,7 +65,7 @@ void show_histogram(const Caches& cc, std::string Cache::*ptr, const std::string
|
|||
max = std::max_element(pairs.begin(), pairs.end(), [&](std::pair<std::string, int>& a, std::pair<std::string, int>& b) { return a.second < b.second; })->second;
|
||||
int i = 0;
|
||||
std::cout << "<h2>" << caption << "</h2>\n";
|
||||
std::cout << "<div class=\"histogram\">\n";
|
||||
std::cout << "<div class=\"histogram " << id << "\">\n";
|
||||
for (auto own : pairs) {
|
||||
htmlencode(own.first);
|
||||
if (own.first.empty()) own.first = "[unknown]";
|
||||
|
|
Ładowanie…
Reference in New Issue