Сравнить коммиты
7 Коммитов
3e0f5aa9a3
...
cdcef0e4b6
Автор | SHA1 | Дата |
---|---|---|
|
cdcef0e4b6 | 1 неделю назад |
|
983c07c251 | 1 неделю назад |
|
fde71ba245 | 1 неделю назад |
|
e7e763fbe0 | 1 неделю назад |
|
52a3ea05a1 | 1 неделю назад |
|
5cd6030edb | 1 неделю назад |
|
9fee231331 | 1 неделю назад |
@ -1,10 +1,16 @@
|
|||||||
#ifndef HISTOGRAM_H_INCLUDED
|
#ifndef HISTOGRAM_H_INCLUDED
|
||||||
#define HISTOGRAM_H_INCLUDED
|
#define HISTOGRAM_H_INCLUDED
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
// Создание корзин для оценок.
|
||||||
|
|
||||||
std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
||||||
|
|
||||||
|
// Создание гистограммы на основании корзин в формате SVG.
|
||||||
|
|
||||||
|
void show_histogram_svg(const std::vector<size_t>& bins);
|
||||||
|
|
||||||
|
|
||||||
#endif // HISTOGRAM_H_INCLUDED
|
#endif // HISTOGRAM_H_INCLUDED
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include "svg.h"
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
// Ôóíêöèÿ çàãîëîâêà.
|
||||||
|
|
||||||
|
void svg_begin(double width, double height)
|
||||||
|
{
|
||||||
|
cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
|
||||||
|
cout << "<svg ";
|
||||||
|
cout << "width='" << width << "' ";
|
||||||
|
cout << "height='" << height << "' ";
|
||||||
|
cout << "viewBox='0 0 " << width << " " << height << "' ";
|
||||||
|
cout << "xmlns='http://www.w3.org/2000/svg'>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ôóíêöèÿ îêîí÷àíèÿ.
|
||||||
|
|
||||||
|
void svg_end()
|
||||||
|
{
|
||||||
|
cout << "</svg>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ôóíêöèÿ âûâîäà ñòðîêè.
|
||||||
|
|
||||||
|
void svg_text(double left, double baseline, string text)
|
||||||
|
{
|
||||||
|
cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ôóíêöèÿ âûâîäà ïðÿìîóãîëüíèêà.
|
||||||
|
|
||||||
|
void svg_rect(double x, double y, double width, double height, string stroke, string fill)
|
||||||
|
{
|
||||||
|
cout << "<rect x='" << x << "' y='" << y << "' width='" << width;
|
||||||
|
cout << "' height='" << height << "' stroke='" << stroke << "' fill='" << fill << "'/>";
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef SVG_H_INCLUDED
|
||||||
|
#define SVG_H_INCLUDED
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
// Ôóíêöèÿ çàãîëîâêà.
|
||||||
|
|
||||||
|
void svg_begin(double width, double height);
|
||||||
|
|
||||||
|
// Ôóíêöèÿ îêîí÷àíèÿ.
|
||||||
|
|
||||||
|
void svg_end();
|
||||||
|
|
||||||
|
// Ôóíêöèÿ âûâîäà ñòðîêè.
|
||||||
|
|
||||||
|
void svg_text(double left, double baseline, std::string text);
|
||||||
|
|
||||||
|
// Ôóíêöèÿ âûâîäà ïðÿìîóãîëüíèêà.
|
||||||
|
|
||||||
|
void svg_rect(double x, double y, double width, double height, std::string stroke = "black", std::string fill = "green");//Öâåòà çàäàíû ïî óìîë÷àíèþ.
|
||||||
|
|
||||||
|
#endif // SVG_H_INCLUDED
|
Загрузка…
Ссылка в новой задаче