forked from gmgu/graph-analysis-tool
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathhtml.cpp
More file actions
78 lines (70 loc) · 2.3 KB
/
html.cpp
File metadata and controls
78 lines (70 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "html.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
namespace snu {
FILE *openHtml(const char *name, bool directed) {
std::string real_name = name + std::string(".html");
FILE *fp = fopen(real_name.c_str(), "w");
fprintf(fp,
"\
<!DOCTYPE html>\
<html>\
<head>\
<meta charset = \"utf-8\">\
<title>SNU Graph Analysis Tool</title>\
<style type=\"text/css\">\
h1{\
text-indent: 1em;\
}\
h2{\
text-indent: 2em;\
}\
h3{\
text-indent: 4em;\
}\
</style>\
</head>\
<body>\
<h1><p>SNU Graph Analysis Tool</p></h1>");
fprintf(fp,
"\
<h2>\
Graph Information\
</h2>\
<h3>\
<p> graph name: %s </p>\
<p> graph type: %s simple graph </p>\
</h3>\
",
name, directed ? "directed" : "undirected");
return fp;
}
void addStatToHtml(FILE *fp, Stat *stat, bool directed) {
if (stat && stat->getSuccess()) {
stat->writeToHTML(fp, directed);
}
}
void closeHtml(FILE *fp, Plot &plot) {
if (plot.makeplot)
fprintf(fp,
"\
<h2>\
Statistics Image\
</h2>\
<h3>\
<p> label-vertex image </p>\
<img src=\"pyplot/%s_label-vertex.png\" width=\"400\" alt=\"label-vertex image\">\
<img src=\"pyplot/%s_label-vertex_log.png\" width=\"400\" alt=\"log scale label-vertex image\">\
</h3>\
<h3>\
<p> degree image </p>\
<img src=\"pyplot/%s_degree.png\" width=\"400\" alt=\"degree image\">\
<img src=\"pyplot/%s_degree_log.png\" width=\"400\" alt=\"log scale degree image\">\
</h3>\
",
plot.name.c_str(), plot.name.c_str(), plot.name.c_str(), plot.name.c_str());
fprintf(fp, "</body></html>");
fclose(fp);
}
} // namespace snu