@medicus.ai/medicus-report-pdf-generator 1.3.13 → 1.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +3 -3
- package/HANDOVER.md +146 -0
- package/README.md +26 -26
- package/app/i18n.config.js +20 -20
- package/app/i18n_wellbeing.config.js +20 -20
- package/app/services/localeService.js +28 -28
- package/assets/Mediclinic/css/nasco_report.css +6297 -6297
- package/assets/Mediclinic/css/nasco_report_rtl.css +851 -851
- package/assets/Mediclinic/css/style.css +33 -33
- package/assets/Mediclinic/js/js.js +112 -112
- package/assets/Mediclinic/js/raphael.js +8437 -8437
- package/assets/arabic.css +275 -275
- package/assets/charts.min.js +7 -7
- package/assets/corporate_report/css/report.css +582 -582
- package/assets/corporate_report/css/report_rtl.css +144 -144
- package/assets/corporate_report/js/js.js +14 -14
- package/assets/data/data.json +124 -124
- package/assets/data/data2.json +675 -675
- package/assets/data/pdf_data_with_history.json +1255 -1255
- package/assets/doctor-note-insight-icon.svg +11 -11
- package/assets/imc/css/style.css +61 -61
- package/assets/jquery-1.4.min.js +151 -151
- package/assets/jquery-2.1.0.min.js +3 -3
- package/assets/js.js +201 -201
- package/assets/medicus_pdf/arabic.css +444 -444
- package/assets/medicus_pdf/styles.css +2427 -2427
- package/assets/print.css +4 -4
- package/assets/qr-code-style.css +68 -68
- package/assets/qrcode.min.js +3 -3
- package/assets/raphael-min.js +10 -10
- package/assets/sanusx/css/sanusx_report.css +707 -707
- package/assets/sizing.js +2 -2
- package/assets/styles.css +1545 -1545
- package/assets/styles.min.css +1358 -1358
- package/assets/translation.js +30 -30
- package/assets/wellbeing/css/nasco_report.css +3472 -3472
- package/assets/wellbeing/css/nasco_report_rtl.css +679 -679
- package/assets/wellbeing/js/js.js +111 -111
- package/assets/wellbeing/js/raphael.js +8437 -8437
- package/base64/cairo-font.js +2 -2
- package/config/Mediclinic.json +37 -37
- package/config/Najeeb.ai.json +35 -35
- package/config/Pha.json +64 -64
- package/config/bionext.json +37 -37
- package/config/default.json +35 -35
- package/config/diagnostikare.json +34 -34
- package/config/maisonsante.json +39 -39
- package/config/nasco.json +35 -35
- package/config/sanitas.json +35 -35
- package/config/sanusx.json +34 -34
- package/config/test.txt +4 -4
- package/data converter.js +53 -53
- package/docs/01-architecture-overview.md +149 -0
- package/docs/02-configuration-and-whitelabelling.md +111 -0
- package/docs/03-templating-and-rendering.md +71 -0
- package/docs/04-report-pipelines.md +128 -0
- package/docs/05-questions-and-data-model.md +67 -0
- package/docs/06-internationalization.md +59 -0
- package/docs/07-email-notifications.md +59 -0
- package/docs/08-known-issues-and-technical-debt.md +41 -0
- package/docs/README.md +22 -0
- package/downloadfile.js +6 -6
- package/example.txt +1188 -1188
- package/index.js +481 -480
- package/lib/big_integral_questionnaire.js +370 -298
- package/lib/corporate_report_generator.js +399 -399
- package/lib/pdf_generator.min.js +525 -525
- package/lib/sanusx_report_generator.js +533 -533
- package/lib/sendEmail.js +343 -343
- package/lib/template.js +2227 -2227
- package/lib/wellbeing_report_generator.js +2164 -2134
- package/locales/ar-AE.json +169 -169
- package/locales/ar-SA.json +169 -169
- package/locales/ar.json +397 -397
- package/locales/de.json +169 -169
- package/locales/en.json +229 -229
- package/locales/fr.json +168 -168
- package/locales/pt.json +165 -165
- package/locales/wellbeing/ar-AE.json +149 -149
- package/locales/wellbeing/ar-SA.json +257 -257
- package/locales/wellbeing/de.json +301 -301
- package/locales/wellbeing/en.json +423 -423
- package/locales/wellbeing/es.json +133 -133
- package/locales/wellbeing/fr.json +121 -121
- package/locales/wellbeing/it-IT.json +121 -121
- package/locales/wellbeing/pt.json +121 -121
- package/locales/wellbeing/tr.json +121 -121
- package/locales/wellbeing/zh-CN.json +121 -121
- package/locales/zh-CN.json +165 -165
- package/package.json +47 -47
- package/preview-big-integral.js +75 -75
- package/run.js +15 -15
- package/templates/Mediclinic/blocks/first-section.html +205 -205
- package/templates/Mediclinic/blocks/footer.html +7 -7
- package/templates/Mediclinic/blocks/header-template.html +5 -5
- package/templates/Mediclinic/blocks/header.html +20 -20
- package/templates/Mediclinic/blocks/patient-table.html +38 -38
- package/templates/Mediclinic/blocks/pdf-header.html +9 -9
- package/templates/Mediclinic/blocks/tips.html +8 -8
- package/templates/Mediclinic/ltr_no_pages.html +37 -37
- package/templates/Mediclinic/rtl_no_pages.html +42 -42
- package/templates/Mediclinic/wellbeing_template.html +41 -41
- package/templates/Pha/blocks/first-section.html +207 -207
- package/templates/Pha/blocks/footer.html +7 -7
- package/templates/Pha/blocks/header-template.html +5 -5
- package/templates/Pha/blocks/header.html +20 -20
- package/templates/Pha/blocks/patient-table.html +38 -38
- package/templates/Pha/blocks/pdf-header.html +8 -8
- package/templates/Pha/blocks/tips.html +8 -8
- package/templates/Pha/ltr_no_pages.html +37 -37
- package/templates/Pha/rtl_no_pages.html +42 -42
- package/templates/Pha/wellbeing_template.html +41 -41
- package/templates/base.html +23 -23
- package/templates/blocks/ar-first-page-header.html +68 -68
- package/templates/blocks/ar-footer.html +54 -54
- package/templates/blocks/ar-header.html +67 -67
- package/templates/blocks/biomarker-compact-ar.html +27 -27
- package/templates/blocks/biomarker-compact.html +27 -27
- package/templates/blocks/biomarker-details.html +41 -41
- package/templates/blocks/biomarker-insight.html +22 -22
- package/templates/blocks/biomarker-min.html +9 -9
- package/templates/blocks/doctor-note.html +11 -11
- package/templates/blocks/footer.html +35 -35
- package/templates/blocks/header-first-page.html +46 -46
- package/templates/blocks/header.html +49 -49
- package/templates/blocks/panel-compact.html +38 -38
- package/templates/blocks/panel-details.html +16 -16
- package/templates/blocks/report-summary.html +16 -16
- package/templates/blocks/section-title.html +4 -4
- package/templates/blocks/signature.html +16 -16
- package/templates/blocks/summary-insight.html +15 -15
- package/templates/blocks/summary.html +9 -9
- package/templates/corporate_report/cover_page.html +23 -23
- package/templates/corporate_report/footer.html +9 -9
- package/templates/corporate_report/ltr_no_pages.html +20 -20
- package/templates/corporate_report/page.html +24 -24
- package/templates/corporate_report/participant_analytics.html +5 -5
- package/templates/corporate_report/rtl_no_pages.html +20 -20
- package/templates/empty.html +10 -10
- package/templates/first_page_head.html +157 -157
- package/templates/imc/first-header-template.html +53 -53
- package/templates/ltr.html +1368 -1368
- package/templates/ltr_no_pages.html +89 -89
- package/templates/maisonsante/blocks/first-section.html +151 -207
- package/templates/maisonsante/blocks/footer.html +7 -7
- package/templates/maisonsante/blocks/header-template.html +5 -5
- package/templates/maisonsante/blocks/header.html +20 -20
- package/templates/maisonsante/blocks/patient-table.html +38 -38
- package/templates/maisonsante/blocks/pdf-header.html +8 -8
- package/templates/maisonsante/blocks/tips.html +8 -8
- package/templates/maisonsante/ltr_no_pages.html +38 -38
- package/templates/maisonsante/rtl_no_pages.html +43 -43
- package/templates/maisonsante/wellbeing_template.html +41 -41
- package/templates/no_pages.html +1224 -1224
- package/templates/popup/popup-template.html +129 -129
- package/templates/rtl_no_pages.html +92 -92
- package/templates/sanusx/blocks/footer.html +6 -6
- package/templates/sanusx/blocks/header.html +20 -20
- package/templates/sanusx/blocks/personal-details.html +123 -123
- package/templates/sanusx/blocks/predictions-section.html +57 -57
- package/templates/sanusx/blocks/recommendations-section.html +6 -6
- package/templates/sanusx/blocks/super-power-section.html +29 -29
- package/templates/sanusx/blocks/tips.html +8 -8
- package/templates/sanusx/ltr_no_pages.html +26 -26
- package/templates/sanusx/rtl_no_pages.html +36 -36
- package/templates/template.html +1377 -1377
- package/templates/wellbeing/blocks/first-section.html +106 -106
- package/templates/wellbeing/blocks/footer.html +7 -7
- package/templates/wellbeing/blocks/header.html +37 -37
- package/templates/wellbeing/blocks/tips.html +8 -8
- package/templates/wellbeing/ltr_no_pages.html +35 -35
- package/templates/wellbeing/rtl_no_pages.html +36 -36
- package/templates/wellbeing/wellbeing_template.html +43 -43
- package/test.js +74 -74
- package/testing-reports/mediclinic/arabic-data.js +0 -439
- package/testing-reports/mediclinic/doctor-data.js +0 -523
- package/testing-reports/mediclinic/with-wellbeing.js +0 -415
- package/testing-reports/pha/notes-example.js +0 -397
package/assets/js.js
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
$(function () {
|
|
2
|
-
if(qrCodeText){
|
|
3
|
-
drawQRCode();
|
|
4
|
-
}
|
|
5
|
-
convertAllRanges();
|
|
6
|
-
drowBioCharts();
|
|
7
|
-
addPageNumbers();
|
|
8
|
-
if (IS_ARABIC) arabize();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
console.log("in js")
|
|
12
|
-
function arabize() {
|
|
13
|
-
/* translate risk labels*/
|
|
14
|
-
$(".biom-info .risk").each(function () {
|
|
15
|
-
var t = $.trim($(this).text());
|
|
16
|
-
$(this).text(translate(t));
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
function getNumFromElem(elem) {
|
|
22
|
-
if (elem.length) {
|
|
23
|
-
var v = elem.text();
|
|
24
|
-
v = v.split(" ").join("");
|
|
25
|
-
v = v.split(",").join(".");
|
|
26
|
-
v = parseFloat(v);
|
|
27
|
-
return v;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function convertAllRanges() {
|
|
34
|
-
console.log("in convertAllRanges")
|
|
35
|
-
$(".biomarker-container .range-placeholder").each(function () {
|
|
36
|
-
convertToRangeLayout(this)
|
|
37
|
-
});
|
|
38
|
-
/* rendering children ranges after the parent ones*/
|
|
39
|
-
$(".biomarker-container .extra-range-placeholder").each(function () {
|
|
40
|
-
convertToRangeLayout(this)
|
|
41
|
-
});
|
|
42
|
-
$(".listing .range-placeholder").each(function () {
|
|
43
|
-
convertToMiniRangeLayout(this)
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function convertToRangeLayout(elem) {
|
|
49
|
-
var data = $.trim($(elem).text());
|
|
50
|
-
if (!data.length) return;
|
|
51
|
-
var splits = data.split("//");
|
|
52
|
-
splits.trimAll();
|
|
53
|
-
var t = $("<table></table>");
|
|
54
|
-
var tr1 = $("<tr>").addClass("ranges");
|
|
55
|
-
var tr2 = $("<tr>").addClass("labels");
|
|
56
|
-
var tr3 = $("<tr>").addClass("values");
|
|
57
|
-
let rand = 0;
|
|
58
|
-
for (var i = 0; i < splits.length; i++) {
|
|
59
|
-
var cols = splits[i].split("\n");
|
|
60
|
-
cols.trimAll();
|
|
61
|
-
if (cols.length < 2) continue;
|
|
62
|
-
if (cols[3] == "current") {
|
|
63
|
-
rand = Math.floor(Math.random() * 10000000);
|
|
64
|
-
}
|
|
65
|
-
var color = cols[0];
|
|
66
|
-
var isHex = color.includes('#');
|
|
67
|
-
|
|
68
|
-
if(!isHex)
|
|
69
|
-
tr1.append(`<td style="background-position-x:${cols[4]}%" class="${color} ${cols[3]}" ${cols[3] == "current" ? `id=${i}-${rand}` : ''}><div class="range colorablebg"></div></td>`);
|
|
70
|
-
else
|
|
71
|
-
tr1.append(`<td class="${cols[3]}" ${cols[3] == "current" ? `id=${i}-${rand}` : ''}><div class="range colorablebg" style="background:${color};background-position-x:${cols[4]}%"></div></td>`);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var label = cols[2];
|
|
75
|
-
if (IS_ARABIC && typeof translate != "undefined") label = translate(label);
|
|
76
|
-
tr2.append('<td class="' + cols[0] + ' ' + cols[3] + '"><span class="' + (cols[3] == "current" ? "colorable" : "") + '">' + label + '</span></td>');
|
|
77
|
-
tr3.append('<td>' + cols[1] + '</td>');
|
|
78
|
-
}
|
|
79
|
-
$(t).append(tr1).append(tr2).append(tr3);
|
|
80
|
-
$(elem).empty().append(t);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* The ones that appear in summary*/
|
|
84
|
-
function convertToMiniRangeLayout(elem) {
|
|
85
|
-
var data = $.trim($(elem).text());
|
|
86
|
-
if (!data.length) return;
|
|
87
|
-
var splits = data.split("//");
|
|
88
|
-
splits.trimAll();
|
|
89
|
-
var t = $("<div>");
|
|
90
|
-
t.addClass("bar");
|
|
91
|
-
|
|
92
|
-
for (var i = 0; i < splits.length; i++) {
|
|
93
|
-
var cols = splits[i].split("\n");
|
|
94
|
-
cols.trimAll();
|
|
95
|
-
if (cols.length < 2) continue;
|
|
96
|
-
var color = cols[0];
|
|
97
|
-
var isHex = color.includes('#');
|
|
98
|
-
if(!isHex)
|
|
99
|
-
t.append(`<div class="segment ${color} ${cols[3]}"></div>`)
|
|
100
|
-
else
|
|
101
|
-
t.append(`<div class="segment ${cols[3]}" style="background:${color}"></div>`)
|
|
102
|
-
}
|
|
103
|
-
$(elem).empty().append(t);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Array.prototype.trimAll = function () {
|
|
108
|
-
for (var i = 0; i < this.length; i++) {
|
|
109
|
-
this[i] = $.trim(this[i]);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function addPageNumbers() {
|
|
114
|
-
$(".page_total").text($(".paper").length);
|
|
115
|
-
var p = 0;
|
|
116
|
-
$(".paper .page_num").each(function () {
|
|
117
|
-
p++;
|
|
118
|
-
$(this).text(p)
|
|
119
|
-
})
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function drowBioCharts() {
|
|
123
|
-
chartsData.forEach((itemdData) => {
|
|
124
|
-
var contex = document.getElementById(itemdData.id);
|
|
125
|
-
var ctx = contex.getContext('2d');
|
|
126
|
-
|
|
127
|
-
let myChart = new Chart(ctx, {
|
|
128
|
-
type: 'line',
|
|
129
|
-
data: {
|
|
130
|
-
labels: itemdData.dataLabel,
|
|
131
|
-
datasets: [{
|
|
132
|
-
data: itemdData.dataset,
|
|
133
|
-
pointBorderColor: "rgba(255,255,255)",
|
|
134
|
-
pointRadius: 8,
|
|
135
|
-
pointBorderWidth: 2,
|
|
136
|
-
lineTension: 0,
|
|
137
|
-
fill: false,
|
|
138
|
-
pointBackgroundColor: itemdData.dataColor,
|
|
139
|
-
}]
|
|
140
|
-
},
|
|
141
|
-
options: {
|
|
142
|
-
layout: {
|
|
143
|
-
padding: {
|
|
144
|
-
top: 30,
|
|
145
|
-
bottom: 30
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
legend: {
|
|
149
|
-
display: false
|
|
150
|
-
},
|
|
151
|
-
tooltips: {enabled: false},
|
|
152
|
-
document: true,
|
|
153
|
-
window: true,
|
|
154
|
-
hover: {mode: null},
|
|
155
|
-
responsive: true,
|
|
156
|
-
maintainAspectRatio: true,
|
|
157
|
-
scales: {
|
|
158
|
-
yAxes: [{
|
|
159
|
-
ticks: {
|
|
160
|
-
suggestedMax: 10,
|
|
161
|
-
suggestedMin: 0,
|
|
162
|
-
stepSize: 1
|
|
163
|
-
},
|
|
164
|
-
display: false
|
|
165
|
-
}],
|
|
166
|
-
xAxes: [{
|
|
167
|
-
gridLines: {
|
|
168
|
-
display: false
|
|
169
|
-
}
|
|
170
|
-
}]
|
|
171
|
-
},
|
|
172
|
-
animation: {
|
|
173
|
-
duration: 0,
|
|
174
|
-
onComplete: function () {
|
|
175
|
-
var ctx = this.chart.ctx;
|
|
176
|
-
ctx.font = Chart.helpers.fontString(14, 'normal', Chart.defaults.global.defaultFontFamily);
|
|
177
|
-
ctx.fillStyle = this.chart.config.options.defaultFontColor;
|
|
178
|
-
ctx.textAlign = 'center';
|
|
179
|
-
ctx.textBaseline = 'bottom';
|
|
180
|
-
|
|
181
|
-
this.data.datasets.forEach(function (dataset) {
|
|
182
|
-
for (var i = 0; i < dataset.data.length; i++) {
|
|
183
|
-
var model = dataset._meta[Object.keys(dataset._meta)[0]].data[i]._model;
|
|
184
|
-
ctx.fillText(dataset.data[i], model.x, model.y - 12);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
})
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function drawQRCode() {
|
|
195
|
-
if(document.getElementById('canvas')){
|
|
196
|
-
QRCode.toCanvas(document.getElementById('canvas'), qrCodeText, function (error) {
|
|
197
|
-
if (error) console.error(error)
|
|
198
|
-
console.log('success!');
|
|
199
|
-
})
|
|
200
|
-
}
|
|
201
|
-
}
|
|
1
|
+
$(function () {
|
|
2
|
+
if(qrCodeText){
|
|
3
|
+
drawQRCode();
|
|
4
|
+
}
|
|
5
|
+
convertAllRanges();
|
|
6
|
+
drowBioCharts();
|
|
7
|
+
addPageNumbers();
|
|
8
|
+
if (IS_ARABIC) arabize();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
console.log("in js")
|
|
12
|
+
function arabize() {
|
|
13
|
+
/* translate risk labels*/
|
|
14
|
+
$(".biom-info .risk").each(function () {
|
|
15
|
+
var t = $.trim($(this).text());
|
|
16
|
+
$(this).text(translate(t));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function getNumFromElem(elem) {
|
|
22
|
+
if (elem.length) {
|
|
23
|
+
var v = elem.text();
|
|
24
|
+
v = v.split(" ").join("");
|
|
25
|
+
v = v.split(",").join(".");
|
|
26
|
+
v = parseFloat(v);
|
|
27
|
+
return v;
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
function convertAllRanges() {
|
|
34
|
+
console.log("in convertAllRanges")
|
|
35
|
+
$(".biomarker-container .range-placeholder").each(function () {
|
|
36
|
+
convertToRangeLayout(this)
|
|
37
|
+
});
|
|
38
|
+
/* rendering children ranges after the parent ones*/
|
|
39
|
+
$(".biomarker-container .extra-range-placeholder").each(function () {
|
|
40
|
+
convertToRangeLayout(this)
|
|
41
|
+
});
|
|
42
|
+
$(".listing .range-placeholder").each(function () {
|
|
43
|
+
convertToMiniRangeLayout(this)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
function convertToRangeLayout(elem) {
|
|
49
|
+
var data = $.trim($(elem).text());
|
|
50
|
+
if (!data.length) return;
|
|
51
|
+
var splits = data.split("//");
|
|
52
|
+
splits.trimAll();
|
|
53
|
+
var t = $("<table></table>");
|
|
54
|
+
var tr1 = $("<tr>").addClass("ranges");
|
|
55
|
+
var tr2 = $("<tr>").addClass("labels");
|
|
56
|
+
var tr3 = $("<tr>").addClass("values");
|
|
57
|
+
let rand = 0;
|
|
58
|
+
for (var i = 0; i < splits.length; i++) {
|
|
59
|
+
var cols = splits[i].split("\n");
|
|
60
|
+
cols.trimAll();
|
|
61
|
+
if (cols.length < 2) continue;
|
|
62
|
+
if (cols[3] == "current") {
|
|
63
|
+
rand = Math.floor(Math.random() * 10000000);
|
|
64
|
+
}
|
|
65
|
+
var color = cols[0];
|
|
66
|
+
var isHex = color.includes('#');
|
|
67
|
+
|
|
68
|
+
if(!isHex)
|
|
69
|
+
tr1.append(`<td style="background-position-x:${cols[4]}%" class="${color} ${cols[3]}" ${cols[3] == "current" ? `id=${i}-${rand}` : ''}><div class="range colorablebg"></div></td>`);
|
|
70
|
+
else
|
|
71
|
+
tr1.append(`<td class="${cols[3]}" ${cols[3] == "current" ? `id=${i}-${rand}` : ''}><div class="range colorablebg" style="background:${color};background-position-x:${cols[4]}%"></div></td>`);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var label = cols[2];
|
|
75
|
+
if (IS_ARABIC && typeof translate != "undefined") label = translate(label);
|
|
76
|
+
tr2.append('<td class="' + cols[0] + ' ' + cols[3] + '"><span class="' + (cols[3] == "current" ? "colorable" : "") + '">' + label + '</span></td>');
|
|
77
|
+
tr3.append('<td>' + cols[1] + '</td>');
|
|
78
|
+
}
|
|
79
|
+
$(t).append(tr1).append(tr2).append(tr3);
|
|
80
|
+
$(elem).empty().append(t);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* The ones that appear in summary*/
|
|
84
|
+
function convertToMiniRangeLayout(elem) {
|
|
85
|
+
var data = $.trim($(elem).text());
|
|
86
|
+
if (!data.length) return;
|
|
87
|
+
var splits = data.split("//");
|
|
88
|
+
splits.trimAll();
|
|
89
|
+
var t = $("<div>");
|
|
90
|
+
t.addClass("bar");
|
|
91
|
+
|
|
92
|
+
for (var i = 0; i < splits.length; i++) {
|
|
93
|
+
var cols = splits[i].split("\n");
|
|
94
|
+
cols.trimAll();
|
|
95
|
+
if (cols.length < 2) continue;
|
|
96
|
+
var color = cols[0];
|
|
97
|
+
var isHex = color.includes('#');
|
|
98
|
+
if(!isHex)
|
|
99
|
+
t.append(`<div class="segment ${color} ${cols[3]}"></div>`)
|
|
100
|
+
else
|
|
101
|
+
t.append(`<div class="segment ${cols[3]}" style="background:${color}"></div>`)
|
|
102
|
+
}
|
|
103
|
+
$(elem).empty().append(t);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Array.prototype.trimAll = function () {
|
|
108
|
+
for (var i = 0; i < this.length; i++) {
|
|
109
|
+
this[i] = $.trim(this[i]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function addPageNumbers() {
|
|
114
|
+
$(".page_total").text($(".paper").length);
|
|
115
|
+
var p = 0;
|
|
116
|
+
$(".paper .page_num").each(function () {
|
|
117
|
+
p++;
|
|
118
|
+
$(this).text(p)
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function drowBioCharts() {
|
|
123
|
+
chartsData.forEach((itemdData) => {
|
|
124
|
+
var contex = document.getElementById(itemdData.id);
|
|
125
|
+
var ctx = contex.getContext('2d');
|
|
126
|
+
|
|
127
|
+
let myChart = new Chart(ctx, {
|
|
128
|
+
type: 'line',
|
|
129
|
+
data: {
|
|
130
|
+
labels: itemdData.dataLabel,
|
|
131
|
+
datasets: [{
|
|
132
|
+
data: itemdData.dataset,
|
|
133
|
+
pointBorderColor: "rgba(255,255,255)",
|
|
134
|
+
pointRadius: 8,
|
|
135
|
+
pointBorderWidth: 2,
|
|
136
|
+
lineTension: 0,
|
|
137
|
+
fill: false,
|
|
138
|
+
pointBackgroundColor: itemdData.dataColor,
|
|
139
|
+
}]
|
|
140
|
+
},
|
|
141
|
+
options: {
|
|
142
|
+
layout: {
|
|
143
|
+
padding: {
|
|
144
|
+
top: 30,
|
|
145
|
+
bottom: 30
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
legend: {
|
|
149
|
+
display: false
|
|
150
|
+
},
|
|
151
|
+
tooltips: {enabled: false},
|
|
152
|
+
document: true,
|
|
153
|
+
window: true,
|
|
154
|
+
hover: {mode: null},
|
|
155
|
+
responsive: true,
|
|
156
|
+
maintainAspectRatio: true,
|
|
157
|
+
scales: {
|
|
158
|
+
yAxes: [{
|
|
159
|
+
ticks: {
|
|
160
|
+
suggestedMax: 10,
|
|
161
|
+
suggestedMin: 0,
|
|
162
|
+
stepSize: 1
|
|
163
|
+
},
|
|
164
|
+
display: false
|
|
165
|
+
}],
|
|
166
|
+
xAxes: [{
|
|
167
|
+
gridLines: {
|
|
168
|
+
display: false
|
|
169
|
+
}
|
|
170
|
+
}]
|
|
171
|
+
},
|
|
172
|
+
animation: {
|
|
173
|
+
duration: 0,
|
|
174
|
+
onComplete: function () {
|
|
175
|
+
var ctx = this.chart.ctx;
|
|
176
|
+
ctx.font = Chart.helpers.fontString(14, 'normal', Chart.defaults.global.defaultFontFamily);
|
|
177
|
+
ctx.fillStyle = this.chart.config.options.defaultFontColor;
|
|
178
|
+
ctx.textAlign = 'center';
|
|
179
|
+
ctx.textBaseline = 'bottom';
|
|
180
|
+
|
|
181
|
+
this.data.datasets.forEach(function (dataset) {
|
|
182
|
+
for (var i = 0; i < dataset.data.length; i++) {
|
|
183
|
+
var model = dataset._meta[Object.keys(dataset._meta)[0]].data[i]._model;
|
|
184
|
+
ctx.fillText(dataset.data[i], model.x, model.y - 12);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
})
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function drawQRCode() {
|
|
195
|
+
if(document.getElementById('canvas')){
|
|
196
|
+
QRCode.toCanvas(document.getElementById('canvas'), qrCodeText, function (error) {
|
|
197
|
+
if (error) console.error(error)
|
|
198
|
+
console.log('success!');
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
}
|