|
|
|
@ -6,6 +6,12 @@
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
size_t emptiness_width (size_t a, size_t b)
|
|
|
|
|
{
|
|
|
|
|
size_t c = a - b;
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
svg_begin(double width, double height)
|
|
|
|
|
{
|
|
|
|
@ -36,7 +42,6 @@ svg_rect(double x, double y, double width, double height, string stroke = "black
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
show_histogram_svg(const vector<size_t>& bins)
|
|
|
|
|
{
|
|
|
|
@ -67,11 +72,10 @@ show_histogram_svg(const vector<size_t>& bins)
|
|
|
|
|
for (size_t bin : bins)
|
|
|
|
|
{
|
|
|
|
|
double bin_width = (MAX_WIDTH)*(bin/max_count);
|
|
|
|
|
svg_rect(MAX_WIDTH-bin_width, top, bin_width, BIN_HEIGHT, BLACK, RED);
|
|
|
|
|
svg_rect(emptiness_width(MAX_WIDTH, bin_width), top, bin_width, BIN_HEIGHT, BLACK, RED);
|
|
|
|
|
svg_text(TEXT_LEFT+MAX_WIDTH, top + TEXT_BASELINE, to_string(bin));
|
|
|
|
|
top += BIN_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
svg_end();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|