|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
#include "percent.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
show_histogram_svg(const vector<size_t>& bins) {
|
|
|
|
@ -29,10 +29,10 @@ show_histogram_svg(const vector<size_t>& bins) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (size_t bin : bins) {
|
|
|
|
|
const double bin_width = BLOCK_WIDTH * bin;
|
|
|
|
|
const double bin_width = (IMAGE_WIDTH - TEXT_WIDTH) * (bin) / (longest);
|
|
|
|
|
if (bin == longest){
|
|
|
|
|
svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
|
|
|
|
|
svg_rect(TEXT_WIDTH, top, IMAGE_WIDTH - 2*TEXT_WIDTH, BIN_HEIGHT, "#000000", "#ff00a2");
|
|
|
|
|
svg_rect(TEXT_WIDTH, top, IMAGE_WIDTH - TEXT_WIDTH, BIN_HEIGHT, "#000000", "#ff00a2");
|
|
|
|
|
top += BIN_HEIGHT;
|
|
|
|
|
} else{
|
|
|
|
|
svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
|
|
|
|
@ -40,11 +40,5 @@ show_histogram_svg(const vector<size_t>& bins) {
|
|
|
|
|
top += BIN_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
top = 0;
|
|
|
|
|
percent(bins, bins_percent);
|
|
|
|
|
for (size_t bin_percent : bins_percent){
|
|
|
|
|
svg_text(IMAGE_WIDTH - TEXT_WIDTH + TEXT_LEFT, top + TEXT_BASELINE, to_string(bin_percent)+"%");
|
|
|
|
|
top += BIN_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
svg_end();
|
|
|
|
|
}
|
|
|
|
|