svg: пустое изображение
Этот коммит содержится в:
3
main.cpp
3
main.cpp
@@ -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;
|
||||
}
|
||||
|
||||
25
svg.cpp
Обычный файл
25
svg.cpp
Обычный файл
@@ -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();
|
||||
}
|
||||
|
||||
4
svg.h
Обычный файл
4
svg.h
Обычный файл
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void
|
||||
show_histogram_svg(const std::vector<double>& bins);
|
||||
Ссылка в новой задаче
Block a user