From 905840c0ae93985b39e1a64ef59ceab3b8b3addd Mon Sep 17 00:00:00 2001
From: "Lab1 (ChaginSA)" <ChaginSA@mpei.ru>
Date: Sun, 28 May 2023 20:03:46 +0300
Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=BD=D0=B4=D0=B8=D0=B2=D0=B8=D0=B4?=
 =?UTF-8?q?=D1=83=D0=B0=D0=BB=D1=8C=D0=BD=D0=BE=D0=B5=20=D0=B7=D0=B0=D0=B4?=
 =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD?=
 =?UTF-8?q?=D1=82=206?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 svg.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/svg.cpp b/svg.cpp
index ec6bcf4..6bbef8b 100644
--- a/svg.cpp
+++ b/svg.cpp
@@ -27,10 +27,18 @@ void svg_text(double left, double baseline, string text) {
 
 void svg_rect(double x, double y, double width, double height, string stroke, string fill){
      cout << "<rect x=' " << x << "' y=' "<< y <<" ' width=' " << width <<" ' height=' " << height <<
-      " ' stroke=' red' fill=' #ffeeee'/>";
+      " ' stroke=' " << stroke << "' fill=' " << fill << " '/>";
 }
 
 void show_histogram_svg( vector<size_t>& bins) {
+
+    string colours[bins.size()];
+    cerr << "Enter colours: " << endl;
+    for (size_t i = 0; i < bins.size(); i++) {
+        cerr << "Enter [" << i << "]: "; cin >> colours[i];
+    }
+
+
     const auto IMAGE_WIDTH = 400;
     const auto IMAGE_HEIGHT = 300;
     const auto TEXT_LEFT = 20;
@@ -56,7 +64,7 @@ void show_histogram_svg( vector<size_t>& bins) {
                bin_width = MAX_ASTERISK * bins[i] / maxb;
             }
                svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bins[i]));
-               svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT,  "blue", "#aaffaa");
+               svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT , "#aaffaa",  colours [i]);
                top += BIN_HEIGHT;
     }
     svg_end();