hayun-vite 0.10.1 → 0.11.0
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/assets/data/sampleData.js +10 -2
- package/assets/templates/mainTemplate.js +128 -0
- package/assets/templates/template_combo.js +49 -44
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +43 -21
- package/src/Audiogram/Audiogram_100.js +499 -0
- package/src/Audiogram/Audiogram_box.js +483 -0
- package/src/Audiogram/dims.js +4 -80
- package/src/Audiogram/dims_100.js +51 -0
- package/src/Audiogram/dims_box.js +125 -0
- package/src/{Form → Box}/Box.js +26 -3
- package/src/Form/Form.js +8 -8
- package/src/Form/Form_N.js +194 -0
- package/src/Form/Forms.js +0 -2
- package/src/Form/Sections.js +0 -6
- package/src/Form/Sections_N.js +66 -0
- package/src/{Form → Header}/Header.js +1 -4
- package/src/Header/Header_N.js +72 -0
- package/src/MultiText/MultiText.js +37 -0
- package/src/{Form/Reflex_N.js → Reflex/Reflex.js} +15 -3
- package/src/Reflex/units.js +65 -0
- package/src/{Form/Speech_N.js → Speech/Speech.js} +45 -28
- package/src/Speech/Speech_N.js +125 -0
- package/src/Speech/units.js +31 -0
- package/src/{Form → Tympanogram}/Tympanogram.js +37 -68
- package/src/Tympanogram/units.js +76 -0
- package/src/common/{putTextBox.js → putCell.js} +6 -6
- package/src/common/putG.js +10 -0
- package/src/common/putLine.js +1 -1
- package/src/common/putText.js +5 -4
- package/src/main.js +140 -19
- package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
- package/assets/styles-test.css +0 -86
- package/assets/styles.css +0 -86
- package/src/Form/Reflex.js +0 -145
- package/src/Form/Speech.js +0 -121
- package/src/Form/globalinfo.js +0 -68
@@ -1,7 +1,8 @@
|
|
1
1
|
import putRect from "../common/putRect.js";
|
2
2
|
import putSVG from "../common/putSVG.js";
|
3
3
|
import putText from "../common/putText.js";
|
4
|
-
import
|
4
|
+
import putCell from "../common/putCell.js";
|
5
|
+
import units from "./units.js";
|
5
6
|
|
6
7
|
export default class Reflex {
|
7
8
|
constructor({ container, side }) {
|
@@ -18,7 +19,18 @@ export default class Reflex {
|
|
18
19
|
let style;
|
19
20
|
|
20
21
|
// کل چارت
|
21
|
-
const svg = putSVG({ x, y, width, height, className: 'reflex' })
|
22
|
+
// const svg = putSVG({ x, y, width, height, className: 'reflex' })
|
23
|
+
let { styles, vbWidth, vbHeight } = units;
|
24
|
+
|
25
|
+
// کل چارت
|
26
|
+
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
27
|
+
const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
|
28
|
+
const svg = putSVG({ x, y, width, height, viewBox })
|
29
|
+
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
30
|
+
width = vbWidth; // ثابت میماند همیشه
|
31
|
+
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
32
|
+
|
33
|
+
|
22
34
|
|
23
35
|
let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسبهای سطر اول
|
24
36
|
// جدولی با ۳ سطر و ۵ ستون
|
@@ -69,7 +81,7 @@ export default class Reflex {
|
|
69
81
|
let x = cw1 / 2 + cw1 * i;
|
70
82
|
let y = ch1 * j + ch2 / 2;
|
71
83
|
//رسم باکس با مختصات مرکز باکس
|
72
|
-
|
84
|
+
putCell({ container: svg, x, y, dx: 0, dy: -1, width: 13, height: 7, rx: 1 });
|
73
85
|
}
|
74
86
|
}
|
75
87
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const units = {
|
2
|
+
name: 'Acoustic Reflexes',
|
3
|
+
margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
4
|
+
|
5
|
+
// واحد ویوباکس - بدون واحد
|
6
|
+
vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
|
7
|
+
vbHeight: 30, // این به نسبت تغییر میکند
|
8
|
+
|
9
|
+
// واحد پیکسل، میلیمتر، ...
|
10
|
+
// اگر واحد پایینی توسط بیرون تغییر کرد واحدهای بالایی باید با نسبت پایینی تغییر کنند
|
11
|
+
width: 100,
|
12
|
+
height: 30,
|
13
|
+
|
14
|
+
styles: {
|
15
|
+
pressure: `
|
16
|
+
user-select: none;
|
17
|
+
direction: ltr !important;
|
18
|
+
font-family: Vazir;
|
19
|
+
font-size: 3;
|
20
|
+
text-anchor: middle;
|
21
|
+
dominant-baseline: hanging;
|
22
|
+
`,
|
23
|
+
caption: `
|
24
|
+
user-select: none;
|
25
|
+
direction: ltr !important;
|
26
|
+
font-family: Vazir;
|
27
|
+
font-size: 3;
|
28
|
+
text-anchor: middle;
|
29
|
+
dominant-baseline: middle;
|
30
|
+
`,
|
31
|
+
label: `
|
32
|
+
user-select: none;
|
33
|
+
direction: ltr !important;
|
34
|
+
font-family: Vazir;
|
35
|
+
font-size: 1mm;
|
36
|
+
text-anchor: start;
|
37
|
+
dominant-baseline: middle;
|
38
|
+
`,
|
39
|
+
type: `
|
40
|
+
user-select: none;
|
41
|
+
direction: ltr !important;
|
42
|
+
font-family: Vazir;
|
43
|
+
font-size: 1mm;
|
44
|
+
font-weight: bold;
|
45
|
+
text-anchor: start;
|
46
|
+
dominant-baseline: middle;
|
47
|
+
`,
|
48
|
+
compliance: `
|
49
|
+
user-select: none;
|
50
|
+
direction: ltr !important;
|
51
|
+
font-family: Vazir;
|
52
|
+
font-size: 0.7mm;
|
53
|
+
text-anchor: end;
|
54
|
+
dominant-baseline: middle;
|
55
|
+
`,
|
56
|
+
mainFreqline: `stroke: black; stroke-width: 1;`,
|
57
|
+
semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
|
58
|
+
boldLine: 'stroke: black; stroke-width: 3;',
|
59
|
+
|
60
|
+
juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
|
61
|
+
juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
|
62
|
+
},
|
63
|
+
}
|
64
|
+
|
65
|
+
export default units;
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import
|
1
|
+
import putCell from "../common/putCell.js";
|
2
2
|
import putRect from "../common/putRect.js";
|
3
3
|
import putText from "../common/putText.js";
|
4
4
|
import putSVG from "../common/putSVG.js";
|
5
|
-
import
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
import units from "./units.js";
|
10
6
|
const svgNS = "http://www.w3.org/2000/svg";
|
11
7
|
|
12
8
|
export default class Speech {
|
@@ -15,7 +11,8 @@ export default class Speech {
|
|
15
11
|
this.side = side;
|
16
12
|
}
|
17
13
|
|
18
|
-
draw({ dims
|
14
|
+
draw({ dims }) {
|
15
|
+
// console.log(dims);
|
19
16
|
|
20
17
|
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
21
18
|
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
|
@@ -24,43 +21,51 @@ export default class Speech {
|
|
24
21
|
let height = dims.height;
|
25
22
|
let x = dims.margin.left;
|
26
23
|
let y = dims.margin.top;
|
24
|
+
let { styles, vbWidth, vbHeight } = units;
|
25
|
+
|
26
|
+
// کل چارت
|
27
|
+
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
28
|
+
const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
|
29
|
+
const svg = putSVG({ x, y, width, height, viewBox })
|
30
|
+
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
31
|
+
width = vbWidth; // ثابت میماند همیشه
|
32
|
+
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
33
|
+
|
34
|
+
|
27
35
|
const labels = dims.labels;
|
28
36
|
this.labels = labels;
|
29
|
-
// const cn = labels.length;
|
30
|
-
let sideCaption = this.side === "R" ? "Right" : "Left";
|
31
37
|
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
32
38
|
const rows = 2;
|
33
|
-
const
|
34
|
-
|
35
|
-
const cw = width / column; // پهنای هر خانه
|
39
|
+
const columns = labels.length;
|
40
|
+
const cw = width / columns; // پهنای هر خانه
|
36
41
|
const ch = height / rows; // ارتفاع هر خانه
|
42
|
+
// تعریف آبجکتی چارت
|
43
|
+
const chart = {
|
44
|
+
width, height,
|
45
|
+
rows: 2, column: labels.length,
|
46
|
+
cell: { width: 1, height: 1 },
|
47
|
+
calc1: function () {
|
48
|
+
this.cell.width = this.width / this.column
|
49
|
+
}
|
50
|
+
}
|
37
51
|
|
38
|
-
// کل چارت
|
39
|
-
const svg = putSVG({ x, y, width, height, className: 'speach' })
|
40
52
|
|
53
|
+
// ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
|
41
54
|
const matrix = [
|
42
55
|
[],
|
43
56
|
[]
|
44
57
|
];
|
45
58
|
|
46
|
-
for (let i = 0; i <
|
59
|
+
for (let i = 0; i < rows; i++) {
|
47
60
|
x = cw / 2;
|
48
61
|
y = ch / 2 + ch * i;
|
49
|
-
for (let j = 0; j <
|
62
|
+
for (let j = 0; j < columns; j++) {
|
50
63
|
matrix[i][j] = { i, j, x, y };
|
51
64
|
x += cw;
|
52
65
|
}
|
53
66
|
}
|
54
|
-
style = `
|
55
|
-
user-select: none;
|
56
|
-
direction: ltr !important;
|
57
|
-
/* text-align: center; */
|
58
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
59
|
-
font-size: 1mm;
|
60
|
-
font-weight: bold;
|
61
|
-
text-anchor: middle; /*تراز افقی*/
|
62
|
-
`;
|
63
67
|
|
68
|
+
style = styles.label;
|
64
69
|
// برچسب های سطر اول
|
65
70
|
// برای فرم های پیش چاپ شده انجام نمیشود
|
66
71
|
!dims.hideContext &&
|
@@ -69,19 +74,31 @@ export default class Speech {
|
|
69
74
|
|
70
75
|
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
71
76
|
|
77
|
+
const inputBox = {
|
78
|
+
width: width / 5 * 0.70, height: height / 2 * 0.85,
|
79
|
+
rx: width / 100
|
80
|
+
}
|
81
|
+
// محاسبه کمان گردی بر اساس مقدار پهنا
|
82
|
+
inputBox.rx = inputBox.width / 10
|
83
|
+
|
72
84
|
// باکس و تکست مقادیر
|
73
85
|
matrix[1].forEach((cell, index) => {
|
74
86
|
// برای فرم های پیش چاپ شده باکس رسم نمیشود
|
75
|
-
!dims.hideContext &&
|
87
|
+
!dims.hideContext &&
|
88
|
+
putCell({
|
89
|
+
container: svg, x: cell.x, y: cell.y, dy: -1,
|
90
|
+
width: inputBox.width, height: inputBox.height,
|
91
|
+
rx: inputBox.rx,
|
92
|
+
});
|
76
93
|
// مقدار نگه دارها
|
77
94
|
if (!dims.forceInsert) {
|
78
|
-
putText({ container: svg, value: "", x: cell.x, y: cell.y, style
|
95
|
+
putText({ container: svg, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
|
79
96
|
} else {
|
80
97
|
// برای فرم های مثل رسا استفاده میشود
|
81
98
|
let name;
|
82
99
|
this.inputs.forEach(input => {
|
83
100
|
({ name, x, y } = input);
|
84
|
-
putText({ container: svg, x, y, style
|
101
|
+
putText({ container: svg, x, y, style, name });
|
85
102
|
});
|
86
103
|
}
|
87
104
|
}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import putCell from "../common/putCell.js";
|
2
|
+
import putRect from "../common/putRect.js";
|
3
|
+
import putText from "../common/putText.js";
|
4
|
+
import putSVG from "../common/putSVG.js";
|
5
|
+
import units from "./units.js";
|
6
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
7
|
+
|
8
|
+
export default class Speech {
|
9
|
+
constructor({ box, side = 'R' }) {
|
10
|
+
console.log(box);
|
11
|
+
|
12
|
+
// const { container, width, height, elements } = box
|
13
|
+
// this.container = container;
|
14
|
+
this.side = side;
|
15
|
+
this.draw({ box })
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
draw({ box }) {
|
20
|
+
const { container, width, height, margin, elements, name} = box
|
21
|
+
|
22
|
+
// console.log(dims);
|
23
|
+
|
24
|
+
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
25
|
+
// this.inputs = (dims.forceInsesrt) ? dims.forceInputs : dims.inputs
|
26
|
+
let style;
|
27
|
+
// let width = dims.width;
|
28
|
+
// let height = dims.height;
|
29
|
+
let x = margin.left;
|
30
|
+
let y = margin.top;
|
31
|
+
|
32
|
+
// کل چارت
|
33
|
+
// const svg = putSVG({ x, y, width, height, viewBox: [0, 0, width, height] })
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
const labels = elements;
|
38
|
+
this.labels = labels;
|
39
|
+
let { styles } = units;
|
40
|
+
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
41
|
+
const rows = 2;
|
42
|
+
const columns = labels.length;
|
43
|
+
const cw = width / columns; // پهنای هر خانه
|
44
|
+
const ch = height / rows; // ارتفاع هر خانه
|
45
|
+
// تعریف آبجکتی چارت
|
46
|
+
const chart = {
|
47
|
+
width, height,
|
48
|
+
rows: 2, column: labels.length,
|
49
|
+
cell: { width: 1, height: 1 },
|
50
|
+
calc1: function () {
|
51
|
+
this.cell.width = this.width / this.column
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
// ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
|
57
|
+
const matrix = [
|
58
|
+
[],
|
59
|
+
[]
|
60
|
+
];
|
61
|
+
|
62
|
+
for (let i = 0; i < rows; i++) {
|
63
|
+
x = cw / 2;
|
64
|
+
y = ch / 2 + ch * i;
|
65
|
+
for (let j = 0; j < columns; j++) {
|
66
|
+
matrix[i][j] = { i, j, x, y };
|
67
|
+
x += cw;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
style = styles.label;
|
72
|
+
|
73
|
+
// برچسب های سطر اول
|
74
|
+
// برای فرم های پیش چاپ شده انجام نمیشود
|
75
|
+
// !dims.hideContext &&
|
76
|
+
matrix[0].forEach((cell, index) =>
|
77
|
+
putText({ container, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
|
78
|
+
|
79
|
+
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
80
|
+
|
81
|
+
const inputBox = {
|
82
|
+
width: width / 5 * 0.78, height: height / 2 * 0.85,
|
83
|
+
rx: width / 100
|
84
|
+
}
|
85
|
+
// محاسبه کمان گردی بر اساس مقدار پهنا
|
86
|
+
inputBox.rx = inputBox.width / 10
|
87
|
+
|
88
|
+
// باکس و تکست مقادیر
|
89
|
+
matrix[1].forEach((cell, index) => {
|
90
|
+
// برای فرم های پیش چاپ شده باکس رسم نمیشود
|
91
|
+
// !dims.hideContext &&
|
92
|
+
putCell({
|
93
|
+
container, x: cell.x, y: cell.y, dy: -1,
|
94
|
+
width: inputBox.width, height: inputBox.height,
|
95
|
+
rx: inputBox.rx,
|
96
|
+
});
|
97
|
+
// مقدار نگه دارها
|
98
|
+
// if (!dims.forceInsert) {
|
99
|
+
putText({ container, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
|
100
|
+
// } else {
|
101
|
+
// // برای فرم های مثل رسا استفاده میشود
|
102
|
+
// let name;
|
103
|
+
// this.inputs.forEach(input => {
|
104
|
+
// ({ name, x, y } = input);
|
105
|
+
// putText({ container: svg, x, y, style, name });
|
106
|
+
// });
|
107
|
+
// }
|
108
|
+
}
|
109
|
+
);
|
110
|
+
|
111
|
+
|
112
|
+
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
113
|
+
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
114
|
+
let className = 'no-print'
|
115
|
+
putRect({ container, x: 0, y: 0, width, height, style, name })
|
116
|
+
// this.chart = svg;
|
117
|
+
// container.appendChild(svg);
|
118
|
+
}
|
119
|
+
|
120
|
+
update(data) {
|
121
|
+
this.labels.forEach((label) => {
|
122
|
+
this.chart.querySelector(`text[data-name=${label}]`).innerHTML = data?.[label] || "";
|
123
|
+
})
|
124
|
+
}
|
125
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const units = {
|
2
|
+
|
3
|
+
name: 'Speech',
|
4
|
+
margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
5
|
+
// اگر واحد پایینی توسط بیرون تغییر کرد ارتفاع ویوباکس باید با نسبت پایینی تغییر کنند
|
6
|
+
width: 100,
|
7
|
+
height: 20,
|
8
|
+
// این فاصله خطوط محورهای بالا و چپ ادیوگرام از لبه ها هست
|
9
|
+
chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
|
10
|
+
// واحد ویوباکس - بدون واحد
|
11
|
+
vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
|
12
|
+
vbHeight: 20, // این به نسبت تغییر میکند
|
13
|
+
// پایینی شکل آبجکت بالایی هست
|
14
|
+
// viewBoxObj: { 'min-x': -0, 'min-y': 0, width: 100, height: 20 },
|
15
|
+
// viewBox: [0, 0, 100, 20],
|
16
|
+
// واحد پیکسل، میلیمتر، ...
|
17
|
+
|
18
|
+
|
19
|
+
styles: {
|
20
|
+
label: `
|
21
|
+
user-select: none;
|
22
|
+
direction: ltr;
|
23
|
+
font-family: Vazir;
|
24
|
+
font-size: ${4.2};
|
25
|
+
font-weight: 700;
|
26
|
+
text-anchor: middle;
|
27
|
+
`,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
export default units
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import putRect from "../common/putRect.js";
|
2
|
+
import putSVG from "../common/putSVG.js";
|
2
3
|
import putText from "../common/putText.js";
|
4
|
+
import units from "./units.js";
|
3
5
|
const svgNS = "http://www.w3.org/2000/svg";
|
4
6
|
|
5
7
|
export default class Tympanogram {
|
@@ -16,23 +18,23 @@ export default class Tympanogram {
|
|
16
18
|
let height = dims.height;
|
17
19
|
let x = dims.margin.left;
|
18
20
|
let y = dims.margin.top;
|
19
|
-
|
21
|
+
let style;
|
20
22
|
|
21
23
|
const { pressure, compliance, padding } = {
|
22
24
|
pressure: this.pressure,
|
23
25
|
compliance: this.compliance,
|
24
26
|
padding: this.padding,
|
27
|
+
}
|
25
28
|
|
26
|
-
};
|
27
|
-
const svg = document.createElementNS(svgNS, "svg");
|
28
|
-
svg.setAttribute("data-name", "R_Tymp");
|
29
|
-
svg.setAttribute("width", width);
|
30
|
-
svg.setAttribute("height", height);
|
31
|
-
svg.setAttribute("x", x);
|
32
|
-
svg.setAttribute("y", y);
|
33
|
-
svg.setAttribute("viewBox", [-padding.left, -padding.top, width, height]);
|
34
|
-
|
29
|
+
let { styles, vbWidth, vbHeight } = units;
|
35
30
|
|
31
|
+
// کل چارت
|
32
|
+
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
33
|
+
const viewBox = [-padding.left, -padding.top, vbWidth, vbHeight].join(' ');
|
34
|
+
const svg = putSVG({ x, y, width, height, viewBox })
|
35
|
+
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
36
|
+
width = vbWidth; // ثابت میماند همیشه
|
37
|
+
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
36
38
|
|
37
39
|
const pressureAxiosLength = {
|
38
40
|
dapa: pressure.max - pressure.min,
|
@@ -44,17 +46,16 @@ export default class Tympanogram {
|
|
44
46
|
mm: height - padding.top - padding.bottom
|
45
47
|
}
|
46
48
|
|
47
|
-
this.chartInfo = { pressure, compliance, padding, pressureAxiosLength, complianceAxiosLength }
|
49
|
+
this.chartInfo = { pressure, compliance, padding, pressureAxiosLength, complianceAxiosLength }
|
48
50
|
|
49
51
|
// point({ this.container: svg, x: getX(pressure.min), y: getY(compliance.max), color: 'red' });
|
50
52
|
// point({ this.container: svg, x: getX(pressure.max), y: getY(compliance.min), color: 'green' });
|
51
53
|
// point({ this.container: svg, x: getX(pressure.min), y: getY(compliance.min), color: 'brown' });
|
52
|
-
let style;
|
53
54
|
// Pressure Axios (Horizontal)
|
54
55
|
style = `
|
55
56
|
stroke-width: 0.15mm;
|
56
57
|
stroke: black;
|
57
|
-
|
58
|
+
`;
|
58
59
|
putLine({
|
59
60
|
x1: getX(pressure.min), y1: getY(compliance.min),
|
60
61
|
x2: getX(pressure.max), y2: getY(compliance.min), style: style
|
@@ -70,109 +71,87 @@ export default class Tympanogram {
|
|
70
71
|
stroke: black;
|
71
72
|
stroke-dasharray: 0.4;
|
72
73
|
stroke-opacity: 0.5;
|
73
|
-
|
74
|
+
`;
|
74
75
|
putLine({
|
75
76
|
x1: getX(0), y1: getY(compliance.min),
|
76
77
|
x2: getX(0), y2: getY(compliance.max), style: style
|
77
|
-
})
|
78
|
+
});
|
79
|
+
|
78
80
|
// Compliance Zero Line
|
79
81
|
putLine({
|
80
82
|
x1: getX(pressure.min), y1: getY(0),
|
81
83
|
x2: getX(pressure.max), y2: getY(0), style: style
|
82
|
-
})
|
84
|
+
});
|
83
85
|
|
84
86
|
// Captions:
|
85
|
-
style =
|
86
|
-
|
87
|
-
direction: ltr !important;
|
88
|
-
/* text-align: center; */
|
89
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
90
|
-
font-size: 0.8mm;
|
91
|
-
text-anchor: middle; /*تراز افقی*/
|
92
|
-
dominant-baseline: middle; /* تراز عمودی*/
|
93
|
-
`;
|
87
|
+
style = styles.caption;
|
88
|
+
|
94
89
|
putText({
|
95
|
-
container: svg, value: "Compliance (ml)", style
|
90
|
+
container: svg, value: "Compliance (ml)", style,
|
96
91
|
x: getX(pressure.min), y: getY(compliance.max), dx: 5, dy: -3
|
97
92
|
});
|
93
|
+
|
98
94
|
putText({
|
99
95
|
container: svg, value: "Pressure (dapa)", style: style,
|
100
96
|
x: getX(pressure.max), y: getY(compliance.min), dx: -8, dy: 6,
|
101
97
|
});
|
102
|
-
|
103
|
-
|
104
|
-
direction: ltr !important;
|
105
|
-
/* text-align: center; */
|
106
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
107
|
-
font-size: 1mm;
|
108
|
-
text-anchor: start; /*تراز افقی*/
|
109
|
-
dominant-baseline: middle; /* تراز عمودی*/
|
110
|
-
`;
|
98
|
+
|
99
|
+
style = styles.label;
|
111
100
|
let color = (this.side === 'R') ? 'red' : 'blue';
|
112
101
|
|
113
102
|
putText({
|
114
103
|
container: svg, value: "ECV:", style: style,
|
115
104
|
x: getX(pressure.min), y: getY(compliance.min), dy: 10
|
116
105
|
});
|
106
|
+
|
117
107
|
putText({
|
118
108
|
container: svg, value: "", style: style + 'fill: ' + color, name: 'ECV',
|
119
109
|
x: getX(pressure.min), y: getY(compliance.min), dy: 10, dx: 11
|
120
110
|
});
|
111
|
+
|
121
112
|
putText({
|
122
113
|
container: svg, value: "MEP:", style: style,
|
123
114
|
x: getX(-300), y: getY(compliance.min), dy: 10
|
124
115
|
});
|
116
|
+
|
125
117
|
putText({
|
126
118
|
container: svg, value: "", style: style + 'fill: ' + color, name: 'MEP',
|
127
119
|
x: getX(-300), y: getY(compliance.min), dy: 10, dx: 11
|
128
120
|
});
|
121
|
+
|
129
122
|
putText({
|
130
123
|
container: svg, value: "SC:", style: style,
|
131
124
|
x: getX(0), y: getY(compliance.min), dy: 10
|
132
125
|
});
|
126
|
+
|
133
127
|
putText({
|
134
128
|
container: svg, value: "", style: style + 'fill: ' + color, name: 'SC',
|
135
129
|
x: getX(0), y: getY(compliance.min), dy: 10, dx: 8
|
136
130
|
});
|
131
|
+
|
137
132
|
putText({
|
138
133
|
container: svg, value: "G:", style: style,
|
139
134
|
x: getX(280), y: getY(compliance.min), dy: 10
|
140
135
|
});
|
136
|
+
|
141
137
|
putText({
|
142
138
|
container: svg, value: "", style: style + 'fill: ' + color, name: 'G',
|
143
139
|
x: getX(300), y: getY(compliance.min), dy: 10, dx: 4
|
144
140
|
});
|
145
141
|
|
146
|
-
style =
|
147
|
-
user-select: none;
|
148
|
-
direction: ltr !important;
|
149
|
-
/* text-align: center; */
|
150
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
151
|
-
font-size: 1mm;
|
152
|
-
font-weight: bold;
|
153
|
-
text-anchor: start; /*تراز افقی*/
|
154
|
-
dominant-baseline: middle; /* تراز عمودی*/
|
155
|
-
`;
|
142
|
+
style = styles.type;
|
156
143
|
putText({
|
157
144
|
container: svg, value: "Type", style: style + 'fill: ' + color,
|
158
145
|
x: getX(-500), y: getY(2.5),
|
159
146
|
});
|
147
|
+
|
160
148
|
putText({
|
161
149
|
container: svg, value: "", style: style + 'fill: ' + color, name: 'Type',
|
162
150
|
x: getX(-500), y: getY(2.5), dx: 9
|
163
151
|
});
|
164
152
|
|
165
153
|
// Compliance Axios digits
|
166
|
-
style =
|
167
|
-
user-select: none;
|
168
|
-
direction: ltr !important;
|
169
|
-
/* text-align: center; */
|
170
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
171
|
-
font-size: 0.7mm;
|
172
|
-
text-anchor: end; /*تراز افقی*/
|
173
|
-
dominant-baseline: middle; /* تراز عمودی*/
|
174
|
-
|
175
|
-
`;
|
154
|
+
style = styles.compliance;
|
176
155
|
x = getX(pressure.min);
|
177
156
|
for (let c = compliance.min + compliance.step; c <= compliance.max; c += compliance.step) {
|
178
157
|
c = Math.round(c * 10) / 10 // برای اون پدیده اعشاری غیرمنتظر
|
@@ -184,22 +163,13 @@ export default class Tympanogram {
|
|
184
163
|
}
|
185
164
|
|
186
165
|
// Pressure Axios digits
|
187
|
-
style =
|
188
|
-
user-select: none;
|
189
|
-
direction: ltr !important;
|
190
|
-
/* text-align: center; */
|
191
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
192
|
-
font-size: 0.7mm;
|
193
|
-
text-anchor: middle; /*تراز افقی*/
|
194
|
-
dominant-baseline: hanging; /* تراز عمودی*/
|
195
|
-
`;
|
166
|
+
style = styles.pressure;
|
196
167
|
for (let p = pressure.min; p <= pressure.max; p += pressure.step) {
|
197
168
|
putText({
|
198
169
|
container: svg, value: p,
|
199
170
|
x: getX(p), y: getY(compliance.min), dy: 1,
|
200
|
-
style
|
171
|
+
style,
|
201
172
|
});
|
202
|
-
|
203
173
|
}
|
204
174
|
|
205
175
|
// console.log(this.container);
|
@@ -258,7 +228,6 @@ export default class Tympanogram {
|
|
258
228
|
this.chart.querySelector(`path[data-name="curve"]`)?.remove();
|
259
229
|
// رسم منحنی
|
260
230
|
this.drawCurve(data);
|
261
|
-
|
262
231
|
}
|
263
232
|
|
264
233
|
// توابع داخلی
|
@@ -274,7 +243,7 @@ export default class Tympanogram {
|
|
274
243
|
// data.SC = 0.5;
|
275
244
|
// data.MEP = -75;
|
276
245
|
// با توجه به اندازه اس سی میشه برای مقادیر زیر یک سری رل گذاشت با منحنی قشنگ تر باشد
|
277
|
-
let cp =
|
246
|
+
let cp = 70; // جابجایی نقطه کنترل منحنی های راست و چپ روی محور افقی
|
278
247
|
// let k = 0.5; // width and height change [0, 1]
|
279
248
|
let cpp = 5; //جابجایی نقطه کنترل قله ها روی محور افقی
|
280
249
|
// رلهایی برای تغییر مقادیر بالا برای زیبایی بیشتر منحنی در نقطه قله
|