|
|
@ -5,6 +5,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
|
|
|
check_width(double width) {
|
|
|
|
|
|
|
|
if (width >= 3 && width <= 30)
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|
svg_text(double left, double baseline, string text) {
|
|
|
|
svg_text(double left, double baseline, string text) {
|
|
|
|
cout << "<text x='" << left
|
|
|
|
cout << "<text x='" << left
|
|
|
@ -47,8 +55,16 @@ show_histogram_svg(const vector<size_t>& bins) {
|
|
|
|
const auto TEXT_BASELINE = 20;
|
|
|
|
const auto TEXT_BASELINE = 20;
|
|
|
|
const auto TEXT_WIDTH = 50;
|
|
|
|
const auto TEXT_WIDTH = 50;
|
|
|
|
const auto BIN_HEIGHT = 30;
|
|
|
|
const auto BIN_HEIGHT = 30;
|
|
|
|
const auto BLOCK_WIDTH = 10;
|
|
|
|
double BLOCK_WIDTH = 0;
|
|
|
|
const auto MAX_WIDTH = IMAGE_WIDTH - TEXT_WIDTH;
|
|
|
|
const auto MAX_WIDTH = IMAGE_WIDTH - TEXT_WIDTH;
|
|
|
|
|
|
|
|
cerr << "Enter block width: ";
|
|
|
|
|
|
|
|
cin >> BLOCK_WIDTH;
|
|
|
|
|
|
|
|
bool check = check_width(BLOCK_WIDTH);
|
|
|
|
|
|
|
|
while (!check) {
|
|
|
|
|
|
|
|
cerr << "Incorrectly enter. The block width must be >= 3px and <= 30 px. Please try again." << endl;
|
|
|
|
|
|
|
|
cin >> BLOCK_WIDTH;
|
|
|
|
|
|
|
|
check = check_width(BLOCK_WIDTH);
|
|
|
|
|
|
|
|
}
|
|
|
|
size_t max_count = 0;
|
|
|
|
size_t max_count = 0;
|
|
|
|
for (size_t x : bins) {
|
|
|
|
for (size_t x : bins) {
|
|
|
|
if (x > max_count) {
|
|
|
|
if (x > max_count) {
|
|
|
|