svg: пустое изображение

main
KireevYP 1 год назад
Родитель ee0043d92d
Сommit 84f4351996

@ -3,6 +3,7 @@
#include <string>
#include "histogram.h"
#include "text.h"
#include "svg.h"
using namespace std;
struct Input {
vector<double> numbers;
@ -35,6 +36,6 @@ int main()
auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_text(bins, MAX_ASTERISK, in.bin_count);
show_histogram_svg(bins);
return 0;
}

@ -0,0 +1,25 @@
#include <iostream>
#include <vector>
using namespace std;
void
svg_begin(double width, double height) {
cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
cout << "<svg ";
cout << "width='" << width << "' ";
cout << "height='" << height << "' ";
cout << "viewBox='0 0 " << width << " " << height << "' ";
cout << "xmlns='http://www.w3.org/2000/svg'>\n";
}
void
svg_end() {
cout << "</svg>\n";
}
void
show_histogram_svg(const vector <double>& bins) {
svg_begin(400, 300);
svg_end();
}

@ -0,0 +1,4 @@
#pragma once
void
show_histogram_svg(const std::vector<double>& bins);

@ -4,7 +4,7 @@
using namespace std;
void
show_histogram_text (const vector<double>& bins,size_t MAX_ASTERISK, size_t bin_count){
show_histogram_text (const vector<double>& bins, size_t MAX_ASTERISK, size_t bin_count){
double max_count = bins[0];
for (double x: bins){
if (x > max_count) {

Загрузка…
Отмена
Сохранить