diff --git a/svg.cpp b/svg.cpp index 3289cd3..f74bb5d 100644 --- a/svg.cpp +++ b/svg.cpp @@ -21,14 +21,14 @@ void show_histogram_svg(const std::vector& bins) { const auto BIN_HEIGHT = 30; const auto BLOCK_WIDTH = 10; svg_begin(400, 300); - svg_text(20, 20, std::to_string(bins[0])); - svg_rect(50, 0, bins[0] * 10, 30); + //svg_text(20, 20, std::to_string(bins[0])); + //svg_rect(50, 0, bins[0] * 10, 30,"red","FF9966"); double top = 0; for (size_t bin : bins) { const double bin_width = BLOCK_WIDTH * bin; svg_text(TEXT_LEFT, top + TEXT_BASELINE, std::to_string(bin)); - svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT); + svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT,"red","#006B3C"); top += BIN_HEIGHT; } svg_end(); @@ -36,6 +36,6 @@ void show_histogram_svg(const std::vector& bins) { void svg_text(double left, double baseline, std::string text) { std::cout << "" << text<<""; } -void svg_rect(double x, double y, double width, double height){ - std::cout << ""; +void svg_rect(double x, double y, double width, double height,std::string stroke, std::string fills){ + std::cout << ""; } diff --git a/svg.h b/svg.h index 38d0e26..f6023f5 100644 --- a/svg.h +++ b/svg.h @@ -7,5 +7,5 @@ void svg_begin(double width, double height); void svg_end(); void show_histogram_svg(const std::vector& bins); void svg_text(double left, double baseline, std::string text); -void svg_rect(double x, double y, double width, double height); +void svg_rect(double x, double y, double width, double height,std::string stroke, std::string fills); #endif // SVG_H_INCLUDED