индивидуальное задание вариант 6

main
Lab1 (ChaginSA) 2 лет назад
Родитель 7e700fabf6
Сommit 905840c0ae

@ -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();

Загрузка…
Отмена
Сохранить