code: цвет добавлен
Этот коммит содержится в:
@@ -29,15 +29,27 @@ svg_text(double left, double baseline, string text) {
|
||||
cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>" << endl;
|
||||
}
|
||||
|
||||
void svg_rect(double x, double y, double width, double height) {
|
||||
cout << "<rect x='" << x << "' width='" << width << "' height='" << height << "' rx ='" << y << "' />" << endl;
|
||||
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 = '" << stroke << "' fill='" << fill << "' />" << endl;
|
||||
}
|
||||
|
||||
void
|
||||
show_histogram_svg(const vector<size_t> bins) {
|
||||
|
||||
const auto IMAGE_WIDTH = 400;
|
||||
const auto IMAGE_HEIGHT = 300;
|
||||
const auto TEXT_LEFT = 20;
|
||||
const auto TEXT_BASELINE = 20;
|
||||
const auto TEXT_WIDTH = 50;
|
||||
const auto BIN_HEIGHT = 30;
|
||||
const auto BLOCK_WIDTH = 10;
|
||||
|
||||
|
||||
|
||||
|
||||
svg_begin(400, 300);
|
||||
svg_text(20, 35, to_string(bins[0]));
|
||||
svg_rect(50, 0, bins[0] * 10, 30);
|
||||
svg_rect(50, 0, bins[0] * 10, 30, "purple", "red");
|
||||
svg_end();
|
||||
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user