diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4c7473d..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bin -/obj diff --git a/hist_proc.h b/hist_proc.h deleted file mode 100644 index ae505d2..0000000 --- a/hist_proc.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef HIST_PROC_H_INCLUDED -#define HIST_PROC_H_INCLUDED - -std::vector -make_histogram_proc(const std::vector numbers, size_t bin_count, std::vector bins); - -#endif // HIST_PROC_H_INCLUDED diff --git a/histogram.h b/histogram.h deleted file mode 100644 index aab82b8..0000000 --- a/histogram.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef HISTOGRAM_H_INCLUDED -#define HISTOGRAM_H_INCLUDED -#include -#include - -std::vector -make_histogram(const std::vector numbers, size_t bin_count); - -#endif // HISTOGRAM_H_INCLUDED diff --git a/lab003.cbp b/lab003.cbp index bce77cc..45b22cf 100644 --- a/lab003.cbp +++ b/lab003.cbp @@ -38,10 +38,6 @@ - - - diff --git a/main.cpp b/main.cpp index b71ca3a..97ef452 100644 --- a/main.cpp +++ b/main.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include "histogram.h" #include diff --git a/svg.cpp b/svg.cpp index 11e48d9..94f000c 100644 --- a/svg.cpp +++ b/svg.cpp @@ -1,6 +1,5 @@ #include #include -#include #include using namespace std; @@ -20,59 +19,8 @@ svg_end() { cout << "\n"; } -void -svg_text(double left, double baseline, string text) { - cout << " "<< text <<" "; -} - -void -svg_rect(double x, double y, double width, double height){ - cout << "\n"; -} - void show_histogram_svg(const vector& bins) { - const auto IMAGE_WIDTH = 400; - const auto IMAGE_HEIGHT = 300; - const auto TEXT_LEFT = 20; - const auto TEXT_BASELINE = 20; - const auto TEXT_WIDTH = 50; - const auto BIN_HEIGHT = 30; - const auto BLOCK_WIDTH = 10; - const double SCALE = IMAGE_WIDTH - TEXT_WIDTH; svg_begin(400, 300); - - - double max_count = 0; - for (double x: bins) { - if (x > max_count) { - max_count = x; - } - } - double top = 0; - if ((max_count*BLOCK_WIDTH)>SCALE){ - for (size_t bin : bins) { - const double bin_width = SCALE * ( bin / max_count); - svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin)); - svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT); - top += BIN_HEIGHT; - cout << endl; - cout << bin_width; - } - } - else{ - for (size_t bin : bins) { - const double bin_width = BLOCK_WIDTH * bin; - svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin)); - svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT); - top += BIN_HEIGHT; - cout << endl; - cout << bin_width; -} - } svg_end(); - } - - - diff --git a/svg.h b/svg.h index ac36df3..0c45c32 100644 --- a/svg.h +++ b/svg.h @@ -1,6 +1,12 @@ #ifndef SVG_H_INCLUDED #define SVG_H_INCLUDED +void +svg_begin(double width, double height); + +void +svg_end(); + void show_histogram_svg(const std::vector& bins); diff --git a/text.h b/text.h deleted file mode 100644 index a7006f9..0000000 --- a/text.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef TEXT_H_INCLUDED -#define TEXT_H_INCLUDED - -void -show_histogram(size_t bin_count, std::vector bins, std::vector procent); - -#endif // TEXT_H_INCLUDED