From 7d912af1793a4a6912d5153961a1c864f7139e4c Mon Sep 17 00:00:00 2001 From: GladkyMS <GladkyMS@mpei.ru> Date: Sun, 21 Apr 2024 21:34:06 +0300 Subject: [PATCH] personal variant --- svg.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/svg.cpp b/svg.cpp index ed16f01..a5de7fc 100644 --- a/svg.cpp +++ b/svg.cpp @@ -45,7 +45,9 @@ void show_histogram_svg(const std::vector<size_t>& bins, size_t bin_count) { svg_begin(IMAGE_WIDTH, IMAGE_HEIGHT); double top = 0; for (size_t bin : bins) { - std::string color = "#" + std::to_string(bin*100); + int key = (10 - floor((bin) * 9 / mxbins)); + std::string color = "#" +std::to_string(key)+ std::to_string(key)+ std::to_string(key); + const double bin_width = BLOCK_WIDTH * bin*k; svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bin)); svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT,color,color);