hayun-vite 0.12.0 → 0.14.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 +11 -11
- package/assets/templates/templAudiometry.js +348 -0
- package/assets/templates/{template_combo.js → templCombo.js} +5 -5
- package/index.html +44 -11
- package/index.js +3 -1
- package/package.json +1 -1
- package/src/Audiogram/test.js +37 -0
- package/src/Form/Form.js +57 -58
- package/src/Forms/Forms.js +62 -78
- package/src/Forms/test.js +18 -0
- package/src/Header/Header.js +4 -8
- package/src/MultiText/MultiText.js +12 -10
- package/src/Tympanogram/Tympanogram.js +213 -168
- package/src/Tympanogram/test.js +85 -0
- package/src/Tympanogram/units.js +17 -26
- package/src/common/putGrid.js +31 -0
- package/src/main.js +1 -2
- /package/{src/styles.css → styles.css} +0 -0
@@ -6,150 +6,175 @@ const svgNS = "http://www.w3.org/2000/svg";
|
|
6
6
|
|
7
7
|
export default class Tympanogram {
|
8
8
|
constructor({ container, side, dims }) {
|
9
|
-
this.pressure = { min: -600, max: +400, step: 200 };
|
10
|
-
this.compliance = { min: -0.50, max: 3, step: 0.50 };
|
11
|
-
this.padding = { right: 5, left: 8, top: 7, bottom: 14 };
|
12
9
|
this.container = container;
|
13
10
|
this.side = side
|
14
|
-
this.
|
11
|
+
this.dims = dims
|
12
|
+
this.draw({ dims })
|
15
13
|
}
|
16
14
|
|
17
15
|
draw({ dims }) {
|
18
|
-
|
19
|
-
|
16
|
+
// پاک کردن چارت قبلی اگر وجود دارد
|
17
|
+
this.chart && this.chart.remove()
|
18
|
+
|
19
|
+
// دادههای یونتیت خوانده میشود و بعد دادههای دیمز به آن اضافه میشودکه میتواند جایگزین دادههای قبلی یونیتز شود
|
20
|
+
dims = { ...units, ...dims }
|
21
|
+
|
22
|
+
let { width, height } = dims
|
20
23
|
let x = dims.margin.left;
|
21
24
|
let y = dims.margin.top;
|
22
|
-
|
25
|
+
const { extraCompliance, compensated } = dims
|
23
26
|
|
24
|
-
const { pressure,
|
25
|
-
|
26
|
-
|
27
|
-
padding: this.padding,
|
28
|
-
}
|
27
|
+
const { pressure, padding, styles } = units
|
28
|
+
|
29
|
+
const compliance = extraCompliance ? units.compliance.extra : units.compliance.normal
|
29
30
|
|
30
|
-
let {
|
31
|
+
let { vbWidth, vbHeight } = units;
|
31
32
|
|
32
33
|
// کل چارت
|
34
|
+
let style
|
35
|
+
style = styles.svg
|
33
36
|
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
34
|
-
const viewBox = [-padding.left, -padding.top, vbWidth, vbHeight].join(' ')
|
35
|
-
const svg = putSVG({ x, y, width, height, viewBox })
|
37
|
+
const viewBox = [-padding.left, -padding.top, vbWidth, vbHeight].join(' ')
|
38
|
+
const svg = putSVG({ x, y, width, height, viewBox, style })
|
39
|
+
this.chart = svg;
|
36
40
|
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
37
41
|
width = vbWidth; // ثابت میماند همیشه
|
38
42
|
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
39
43
|
|
40
44
|
const pressureAxiosLength = {
|
41
45
|
dapa: pressure.max - pressure.min,
|
42
|
-
mm: width - padding.left
|
46
|
+
mm: width - (padding.left + padding.right)
|
43
47
|
}
|
44
48
|
|
45
49
|
const complianceAxiosLength = {
|
46
50
|
ml: compliance.max - compliance.min,
|
47
|
-
mm: height - padding.top
|
51
|
+
mm: height - (padding.top + padding.bottom)
|
52
|
+
}
|
53
|
+
|
54
|
+
this.chartInfo = {
|
55
|
+
pressure, compliance, padding,
|
56
|
+
pressureAxiosLength, complianceAxiosLength, compensated,
|
57
|
+
}
|
58
|
+
|
59
|
+
// point({ container: svg, x: getX(pressure.min), y: getY(compliance.max), color: 'red' })
|
60
|
+
// point({ container: svg, x: getX(pressure.max), y: getY(compliance.min), color: 'green' })
|
61
|
+
// point({ container: svg, x: getX(pressure.min), y: getY(compliance.min), color: 'brown' })
|
62
|
+
|
63
|
+
|
64
|
+
// Drawing Chart Lines
|
65
|
+
{
|
66
|
+
// Pressure Axios (Horizontal)
|
67
|
+
style = `
|
68
|
+
stroke-width: 0.15mm;
|
69
|
+
stroke: black;
|
70
|
+
`;
|
71
|
+
putLine({
|
72
|
+
x1: getX(pressure.min), y1: getY(compliance.min),
|
73
|
+
x2: getX(pressure.max), y2: getY(compliance.min), style
|
74
|
+
})
|
75
|
+
|
76
|
+
// Compliance Axios (Vertical)
|
77
|
+
putLine({
|
78
|
+
x1: getX(pressure.min), y1: getY(compliance.min),
|
79
|
+
x2: getX(pressure.min), y2: getY(compliance.max), style
|
80
|
+
})
|
81
|
+
|
82
|
+
// Pressure Zero Line
|
83
|
+
style = `
|
84
|
+
stroke-width: 0.07mm;
|
85
|
+
stroke: black;
|
86
|
+
stroke-dasharray: 0.4;
|
87
|
+
stroke-opacity: 0.5;
|
88
|
+
`;
|
89
|
+
putLine({
|
90
|
+
x1: getX(0), y1: getY(compliance.min),
|
91
|
+
x2: getX(0), y2: getY(compliance.max), style
|
92
|
+
})
|
93
|
+
|
94
|
+
// Compliance Zero Line
|
95
|
+
putLine({
|
96
|
+
x1: getX(pressure.min), y1: getY(0),
|
97
|
+
x2: getX(pressure.max), y2: getY(0), style
|
98
|
+
})
|
99
|
+
}
|
100
|
+
|
101
|
+
// Texts Chart (Captions & Labels)
|
102
|
+
{
|
103
|
+
|
104
|
+
// Captions:
|
105
|
+
style = styles.caption;
|
106
|
+
|
107
|
+
putText({
|
108
|
+
container: svg, value: "Compliance (ml)", style,
|
109
|
+
x: getX(pressure.min), y: getY(compliance.max), dx: 5, dy: -3
|
110
|
+
})
|
111
|
+
|
112
|
+
putText({
|
113
|
+
container: svg, value: "Pressure (dapa)", style: style,
|
114
|
+
x: getX(pressure.max), y: getY(compliance.min), dx: -8, dy: 6,
|
115
|
+
})
|
116
|
+
|
117
|
+
// Lables
|
118
|
+
style = styles.label;
|
119
|
+
|
120
|
+
putText({
|
121
|
+
container: svg, value: "ECV:", style: style,
|
122
|
+
x: getX(pressure.min), y: getY(compliance.min), dy: 10
|
123
|
+
})
|
124
|
+
|
125
|
+
putText({
|
126
|
+
container: svg, value: "MEP:", style,
|
127
|
+
x: getX(-300), y: getY(compliance.min), dy: 10
|
128
|
+
})
|
129
|
+
|
130
|
+
putText({
|
131
|
+
container: svg, value: "SC:", style: style,
|
132
|
+
x: getX(0), y: getY(compliance.min), dy: 10
|
133
|
+
});
|
134
|
+
|
135
|
+
|
136
|
+
putText({
|
137
|
+
container: svg, value: "G:", style,
|
138
|
+
x: getX(280), y: getY(compliance.min), dy: 10
|
139
|
+
});
|
140
|
+
|
141
|
+
style = styles.type;
|
142
|
+
putText({
|
143
|
+
container: svg, value: "Type", style: style,
|
144
|
+
x: getX(-500), y: getY(2.5),
|
145
|
+
});
|
48
146
|
}
|
49
147
|
|
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
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
// Compliance Zero Line
|
82
|
-
putLine({
|
83
|
-
x1: getX(pressure.min), y1: getY(0),
|
84
|
-
x2: getX(pressure.max), y2: getY(0), style: style
|
85
|
-
});
|
86
|
-
|
87
|
-
// Captions:
|
88
|
-
style = styles.caption;
|
89
|
-
|
90
|
-
putText({
|
91
|
-
container: svg, value: "Compliance (ml)", style,
|
92
|
-
x: getX(pressure.min), y: getY(compliance.max), dx: 5, dy: -3
|
93
|
-
});
|
94
|
-
|
95
|
-
putText({
|
96
|
-
container: svg, value: "Pressure (dapa)", style: style,
|
97
|
-
x: getX(pressure.max), y: getY(compliance.min), dx: -8, dy: 6,
|
98
|
-
});
|
99
|
-
|
100
|
-
style = styles.label;
|
101
|
-
let color = (this.side === 'R') ? 'red' : 'blue';
|
102
|
-
|
103
|
-
putText({
|
104
|
-
container: svg, value: "ECV:", style: style,
|
105
|
-
x: getX(pressure.min), y: getY(compliance.min), dy: 10
|
106
|
-
});
|
107
|
-
|
108
|
-
putText({
|
109
|
-
container: svg, value: "", style: style + 'fill: ' + color, name: 'ECV',
|
110
|
-
x: getX(pressure.min), y: getY(compliance.min), dy: 10, dx: 11
|
111
|
-
});
|
112
|
-
|
113
|
-
putText({
|
114
|
-
container: svg, value: "MEP:", style: style,
|
115
|
-
x: getX(-300), y: getY(compliance.min), dy: 10
|
116
|
-
});
|
117
|
-
|
118
|
-
putText({
|
119
|
-
container: svg, value: "", style: style + 'fill: ' + color, name: 'MEP',
|
120
|
-
x: getX(-300), y: getY(compliance.min), dy: 10, dx: 11
|
121
|
-
});
|
122
|
-
|
123
|
-
putText({
|
124
|
-
container: svg, value: "SC:", style: style,
|
125
|
-
x: getX(0), y: getY(compliance.min), dy: 10
|
126
|
-
});
|
127
|
-
|
128
|
-
putText({
|
129
|
-
container: svg, value: "", style: style + 'fill: ' + color, name: 'SC',
|
130
|
-
x: getX(0), y: getY(compliance.min), dy: 10, dx: 8
|
131
|
-
});
|
132
|
-
|
133
|
-
putText({
|
134
|
-
container: svg, value: "G:", style: style,
|
135
|
-
x: getX(280), y: getY(compliance.min), dy: 10
|
136
|
-
});
|
137
|
-
|
138
|
-
putText({
|
139
|
-
container: svg, value: "", style: style + 'fill: ' + color, name: 'G',
|
140
|
-
x: getX(300), y: getY(compliance.min), dy: 10, dx: 4
|
141
|
-
});
|
142
|
-
|
143
|
-
style = styles.type;
|
144
|
-
putText({
|
145
|
-
container: svg, value: "Type", style: style + 'fill: ' + color,
|
146
|
-
x: getX(-500), y: getY(2.5),
|
147
|
-
});
|
148
|
-
|
149
|
-
putText({
|
150
|
-
container: svg, value: "", style: style + 'fill: ' + color, name: 'Type',
|
151
|
-
x: getX(-500), y: getY(2.5), dx: 9
|
152
|
-
});
|
148
|
+
// Tympanogram Values (Inputs)
|
149
|
+
{
|
150
|
+
let color = (this.side === 'R') ? 'red' : 'blue';
|
151
|
+
style = styles.input
|
152
|
+
|
153
|
+
putText({
|
154
|
+
container: svg, value: "", style: style + 'fill: ' + color, name: 'ECV',
|
155
|
+
x: getX(pressure.min), y: getY(compliance.min), dy: 10, dx: 11
|
156
|
+
})
|
157
|
+
|
158
|
+
putText({
|
159
|
+
container: svg, value: "", style: style + 'fill: ' + color, name: 'MEP',
|
160
|
+
x: getX(-300), y: getY(compliance.min), dy: 10, dx: 11
|
161
|
+
})
|
162
|
+
|
163
|
+
putText({
|
164
|
+
container: svg, value: "", style: style + 'fill: ' + color, name: 'SC',
|
165
|
+
x: getX(0), y: getY(compliance.min), dy: 10, dx: 8
|
166
|
+
})
|
167
|
+
|
168
|
+
putText({
|
169
|
+
container: svg, value: "", style: style + 'fill: ' + color, name: 'G',
|
170
|
+
x: getX(300), y: getY(compliance.min), dy: 10, dx: 4
|
171
|
+
})
|
172
|
+
|
173
|
+
putText({
|
174
|
+
container: svg, value: "", style: style + 'fill: ' + color, name: 'Type',
|
175
|
+
x: getX(-500), y: getY(2.5), dx: 9
|
176
|
+
})
|
177
|
+
}
|
153
178
|
|
154
179
|
// Compliance Axios digits
|
155
180
|
style = styles.compliance;
|
@@ -157,9 +182,9 @@ export default class Tympanogram {
|
|
157
182
|
for (let c = compliance.min + compliance.step; c <= compliance.max; c += compliance.step) {
|
158
183
|
c = Math.round(c * 10) / 10 // برای اون پدیده اعشاری غیرمنتظر
|
159
184
|
putText({
|
160
|
-
container: svg, value: c,
|
185
|
+
container: svg, value: c.toFixed(1),
|
161
186
|
x, y: getY(c), dx: -1,
|
162
|
-
style
|
187
|
+
style,
|
163
188
|
});
|
164
189
|
}
|
165
190
|
|
@@ -173,13 +198,13 @@ export default class Tympanogram {
|
|
173
198
|
});
|
174
199
|
}
|
175
200
|
|
176
|
-
// console.log(this.container);
|
177
201
|
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
178
202
|
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
179
203
|
// یک بوردر راهنمای توسعه برای اس وی جی به تمام پهنا و ارتفاع رسم میکنیم
|
180
204
|
putRect({ container: svg, x: -padding.left, y: -padding.top, width, height, name: dims.name, style })
|
181
|
-
this.chart = svg;
|
182
205
|
this.container.appendChild(svg);
|
206
|
+
// اگر آبجکت از قبل دیتایی دارد اون رو آپدیت کن
|
207
|
+
this.data && this.update(this.data)
|
183
208
|
|
184
209
|
// بلاک توابع داخلی مورد نیاز تابع اصلی
|
185
210
|
// توابع تبدیل فشار و کامپلیانس به مختصات میلیمتر
|
@@ -193,17 +218,13 @@ export default class Tympanogram {
|
|
193
218
|
|
194
219
|
// تابع رسم خط
|
195
220
|
function putLine({ x1, y1, x2, y2, style }) {
|
196
|
-
|
197
221
|
let line = document.createElementNS(svgNS, "line");
|
198
222
|
line.setAttribute("x1", x1);
|
199
223
|
line.setAttribute("y1", y1);
|
200
224
|
line.setAttribute("x2", x2);
|
201
225
|
line.setAttribute("y2", y2);
|
202
226
|
line.setAttribute("style", style)
|
203
|
-
// line.setAttribute("stroke", "black");
|
204
|
-
// line.setAttribute("stroke-width", "0.1px");
|
205
227
|
svg.appendChild(line);
|
206
|
-
|
207
228
|
}
|
208
229
|
|
209
230
|
// تابع ایجاد و رسم نقطه نشانگر رنگی
|
@@ -218,13 +239,20 @@ export default class Tympanogram {
|
|
218
239
|
}
|
219
240
|
|
220
241
|
update(data) {
|
242
|
+
this.data = data
|
243
|
+
let { ECV, SC, MEP, G } = data
|
244
|
+
|
245
|
+
// تبدبل اعداد رشته ای به عدد با دو رقم اعشاری
|
246
|
+
ECV && (ECV = (+ECV).toFixed(2));
|
247
|
+
SC && (SC = (+SC).toFixed(2));
|
248
|
+
G && (G = (+G).toFixed(2));
|
221
249
|
|
222
250
|
// جایگذاری مقادیر تمپانومتری در تکستباکس ها
|
223
|
-
this.chart.querySelector(`text[data-name="Type"]`).innerHTML = data?.Type || "";
|
224
|
-
this.chart.querySelector(`text[data-name="ECV"]`).innerHTML =
|
225
|
-
this.chart.querySelector(`text[data-name="MEP"]`).innerHTML = data?.MEP || "";
|
226
|
-
this.chart.querySelector(`text[data-name="SC"]`).innerHTML =
|
227
|
-
this.chart.querySelector(`text[data-name="G"]`).innerHTML =
|
251
|
+
this.chart.querySelector(`text[data-name="Type"]`).innerHTML = data?.Type || "-";
|
252
|
+
this.chart.querySelector(`text[data-name="ECV"]`).innerHTML = ECV || "-";
|
253
|
+
this.chart.querySelector(`text[data-name="MEP"]`).innerHTML = data?.MEP || "-";
|
254
|
+
this.chart.querySelector(`text[data-name="SC"]`).innerHTML = SC || "-";
|
255
|
+
this.chart.querySelector(`text[data-name="G"]`).innerHTML = G || "-";
|
228
256
|
// پاک کردن منحنی قبلی از کانتینر جاری
|
229
257
|
this.chart.querySelector(`path[data-name="curve"]`)?.remove();
|
230
258
|
// رسم منحنی
|
@@ -233,79 +261,96 @@ export default class Tympanogram {
|
|
233
261
|
|
234
262
|
// توابع داخلی
|
235
263
|
drawCurve(data) {
|
264
|
+
let { Type, ECV, SC, MEP, G, expanded, cp, cpp } = data
|
265
|
+
|
236
266
|
// Ensure to Convert to Numbers //
|
267
|
+
SC = +SC
|
268
|
+
ECV = +ECV
|
269
|
+
MEP = +MEP
|
270
|
+
G = +G
|
271
|
+
cp = +cp
|
272
|
+
cpp = +cpp
|
273
|
+
|
274
|
+
// اگر این مقادیر وجود نداشته باشه مقدار صفر میدیم بهشون که خطا در رسم منحنی نخوریم
|
275
|
+
SC || (SC = 0)
|
276
|
+
MEP || (MEP = 0)
|
277
|
+
|
237
278
|
const container = this.chart
|
238
|
-
const { pressure, compliance, pressureAxiosLength, complianceAxiosLength } = this.chartInfo;
|
279
|
+
const { pressure, compliance, pressureAxiosLength, complianceAxiosLength, compensated } = this.chartInfo;
|
239
280
|
|
240
|
-
|
241
|
-
|
281
|
+
let cmp = 0 // for non-compensated
|
282
|
+
compensated && (cmp = ECV)
|
242
283
|
|
243
284
|
// مقداردهی دستی برای تست شکل منحنی
|
244
285
|
// data.SC = 0.5;
|
245
286
|
// data.MEP = -75;
|
246
287
|
// با توجه به اندازه اس سی میشه برای مقادیر زیر یک سری رل گذاشت با منحنی قشنگ تر باشد
|
247
|
-
let cp = 70
|
288
|
+
// let cp = 70 // جابجایی نقطه کنترل منحنی های راست و چپ روی محور افقی
|
289
|
+
!cp && (cp = 70)
|
248
290
|
// let k = 0.5; // width and height change [0, 1]
|
249
|
-
|
291
|
+
!cpp && (cpp = 5) //جابجایی نقطه کنترل قله ها روی محور افقی
|
250
292
|
// رلهایی برای تغییر مقادیر بالا برای زیبایی بیشتر منحنی در نقطه قله
|
251
293
|
// (data.SC <= 0.30)? k=0
|
252
|
-
let k
|
253
|
-
k = (
|
294
|
+
let k
|
295
|
+
k = (SC > 0.30) ? 0.5 : 0.1 // width and height change [0, 1]
|
296
|
+
k = (SC > 1.0) ? 0.2 : k
|
254
297
|
// k = (data.SC < 1.0) ? 0 : k;
|
255
298
|
|
256
|
-
let pw = 20 * k
|
257
|
-
let ph = 0.1 * k
|
299
|
+
let pw = 20 * k // نصف پهنای قله
|
300
|
+
let ph = 0.1 * k // ارتفاع قله
|
258
301
|
|
259
302
|
let zone = {
|
260
303
|
normal: { min: -300, max: 250 },
|
261
304
|
expanded: { min: -600, max: 400 },
|
262
305
|
}
|
263
306
|
// تعیین کرانههای منحنی بر حسب فشار گوش میانی
|
264
|
-
let RV = zone.normal
|
265
|
-
if (
|
266
|
-
|
307
|
+
let RV = zone.normal
|
308
|
+
if (MEP <= -150 || MEP >= 100 || expanded) { RV = zone.expanded } else { RV = zone.normal }
|
267
309
|
|
268
|
-
const
|
310
|
+
const curve = {
|
269
311
|
R: {
|
270
|
-
P1: { p: RV.max, c:
|
271
|
-
P2: { p:
|
272
|
-
C: { p:
|
312
|
+
P1: { p: RV.max, c: cmp },
|
313
|
+
P2: { p: MEP + pw, c: cmp + SC - ph },
|
314
|
+
C: { p: MEP + cp, c: cmp }
|
273
315
|
},
|
274
316
|
RM: {
|
275
|
-
|
276
|
-
|
317
|
+
P1: {}, // Define later
|
318
|
+
P2: { p: MEP, c: cmp + SC },
|
319
|
+
C: { p: MEP + cpp, c: cmp + SC }
|
277
320
|
},
|
278
321
|
LM: {
|
279
|
-
|
280
|
-
|
322
|
+
P1: {}, // Define later
|
323
|
+
P2: { p: MEP - pw, c: cmp + SC - ph },
|
324
|
+
C: { p: MEP - cpp, c: cmp + SC }
|
281
325
|
},
|
282
326
|
L: {
|
283
|
-
P1: {},
|
284
|
-
P2: { p: RV.min, c:
|
285
|
-
C: { p:
|
327
|
+
P1: {}, // Define later
|
328
|
+
P2: { p: RV.min, c: cmp },
|
329
|
+
C: { p: MEP - cp, c: cmp }
|
286
330
|
}
|
287
331
|
}
|
288
332
|
|
289
333
|
// به دست آوردن مختصات نقاط کنترل بر حسب مختصات پیک
|
290
|
-
|
291
|
-
|
292
|
-
|
334
|
+
curve.RM.P1 = curve.R.P2
|
335
|
+
curve.LM.P1 = curve.RM.P2
|
336
|
+
curve.L.P1 = curve.LM.P2
|
337
|
+
|
338
|
+
let color = (this.side == "R") ? "red" : "blue";
|
293
339
|
let path = document.createElementNS(svgNS, "path");
|
294
340
|
path.setAttribute("fill", "none");
|
295
341
|
path.setAttribute("data-name", "curve");
|
296
|
-
let color = (this.side == "R") ? "red" : "blue";
|
297
342
|
path.setAttribute("stroke", color);
|
298
343
|
path.setAttribute("stroke-width", "0.5px");
|
299
344
|
path.setAttribute(
|
300
345
|
"d", `
|
301
|
-
M ${ctg(
|
302
|
-
Q ${ctg(
|
303
|
-
M ${ctg(
|
304
|
-
Q ${ctg(
|
305
|
-
M ${ctg(
|
306
|
-
Q ${ctg(
|
307
|
-
M ${ctg(
|
308
|
-
Q ${ctg(
|
346
|
+
M ${ctg(curve.R.P1)}
|
347
|
+
Q ${ctg(curve.R.C)} ${ctg(curve.R.P2)}
|
348
|
+
M ${ctg(curve.RM.P1)}
|
349
|
+
Q ${ctg(curve.RM.C)} ${ctg(curve.RM.P2)}
|
350
|
+
M ${ctg(curve.LM.P1)}
|
351
|
+
Q ${ctg(curve.LM.C)} ${ctg(curve.LM.P2)}
|
352
|
+
M ${ctg(curve.L.P1)}
|
353
|
+
Q ${ctg(curve.L.C)} ${ctg(curve.L.P2)}
|
309
354
|
`
|
310
355
|
);
|
311
356
|
container.appendChild(path);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import Tympanogram from "./Tympanogram";
|
2
|
+
|
3
|
+
document.querySelector('#app').innerHTML = `
|
4
|
+
<div id="test"></div>
|
5
|
+
<p>Curve settings:</p>
|
6
|
+
<div>
|
7
|
+
<input type="range" id="cp" name="cp" min="10" max="150" value="70" step="5" />
|
8
|
+
<label for="cp">cp</label>
|
9
|
+
<input type="range" id="cpp" name="cpp" min="1" max="10" value="5" step="1" />
|
10
|
+
<label for="cpp">cpp</label>
|
11
|
+
<div>
|
12
|
+
<input type="checkbox" name="extra-sc" id="extra-sc">
|
13
|
+
<label for="extra-sc">Extra SC</label>
|
14
|
+
</div>
|
15
|
+
<div>
|
16
|
+
<input type="checkbox" name="compensated" id="compensated">
|
17
|
+
<label for="compensated">Compensated</label>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
`;
|
21
|
+
let dims = {
|
22
|
+
"name": "RTympanogram",
|
23
|
+
"w": 100,
|
24
|
+
"h": 60,
|
25
|
+
"margin": {
|
26
|
+
"left": 2,
|
27
|
+
"top": 0,
|
28
|
+
"right": 2,
|
29
|
+
"bottom": 0
|
30
|
+
},
|
31
|
+
"display": "inline",
|
32
|
+
"width": 100 * 12,
|
33
|
+
"height": 60 * 12,
|
34
|
+
}
|
35
|
+
let data = {
|
36
|
+
Type: "An",
|
37
|
+
ECV: '1.30',
|
38
|
+
SC: '0.80',
|
39
|
+
MEP: '-130',
|
40
|
+
G: 0.2,
|
41
|
+
expanded: false, // by default is false for expand pressure from -600 to +400
|
42
|
+
|
43
|
+
}
|
44
|
+
let cp = 70, cpp = 5, extraCompliance, compensated
|
45
|
+
|
46
|
+
document.querySelector("#compensated").addEventListener("input", e => {
|
47
|
+
compensated = e.target.checked
|
48
|
+
console.log(e.target.checked);
|
49
|
+
dims = { ...dims, compensated }
|
50
|
+
RTympanogram.draw({ dims })
|
51
|
+
|
52
|
+
})
|
53
|
+
|
54
|
+
document.querySelector("#extra-sc").addEventListener("input", e => {
|
55
|
+
extraCompliance = e.target.checked
|
56
|
+
console.log(e.target.checked);
|
57
|
+
dims = { ...dims, extraCompliance }
|
58
|
+
RTympanogram.draw({ dims })
|
59
|
+
|
60
|
+
})
|
61
|
+
|
62
|
+
document.querySelector("#cp")
|
63
|
+
.addEventListener("input", e => {
|
64
|
+
cp = e.target.value
|
65
|
+
console.log(cp);
|
66
|
+
data = {...data, cp}
|
67
|
+
|
68
|
+
RTympanogram.update(data)
|
69
|
+
})
|
70
|
+
|
71
|
+
|
72
|
+
document.querySelector("#cpp")
|
73
|
+
.addEventListener("input", e => {
|
74
|
+
cpp = e.target.value
|
75
|
+
console.log(cpp);
|
76
|
+
data = {...data, cpp}
|
77
|
+
|
78
|
+
RTympanogram.update(data)
|
79
|
+
})
|
80
|
+
|
81
|
+
const container = document.getElementById('test')
|
82
|
+
|
83
|
+
const RTympanogram = new Tympanogram({ container, dims, side: 'R' })
|
84
|
+
RTympanogram.update(data)
|
85
|
+
|
package/src/Tympanogram/units.js
CHANGED
@@ -11,55 +11,46 @@ const units = {
|
|
11
11
|
width: 100,
|
12
12
|
height: 60,
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
width: 240, height: 60
|
14
|
+
pressure: { min: -600, max: +400, step: 200 },
|
15
|
+
compliance: {
|
16
|
+
normal: { min: -0.50, max: 3, step: 0.50 },
|
17
|
+
extra: { min: -0.50, max: 6, step: 0.50 }
|
19
18
|
},
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
padding: { right: 5, left: 8, top: 7, bottom: 14 },
|
20
|
+
extraCompliance: false, // default is false (0-3) | true (0-6)
|
21
|
+
compensated: false, // default is false | true
|
22
|
+
|
25
23
|
styles: {
|
24
|
+
svg: 'user-select: none; direction: ltr !important; font-family: Vazir;',
|
26
25
|
pressure: `
|
27
|
-
user-select: none;
|
28
|
-
direction: ltr !important;
|
29
|
-
font-family: Vazir;
|
30
26
|
font-size: 3;
|
31
27
|
text-anchor: middle;
|
32
28
|
dominant-baseline: hanging;
|
33
29
|
`,
|
34
30
|
caption: `
|
35
|
-
user-select: none;
|
36
|
-
direction: ltr !important;
|
37
|
-
font-family: Vazir;
|
38
31
|
font-size: 3;
|
39
32
|
text-anchor: middle;
|
40
33
|
dominant-baseline: middle;
|
41
34
|
`,
|
42
35
|
label: `
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
36
|
+
font-size: 4.2;
|
37
|
+
font-weight: bold;
|
38
|
+
text-anchor: start;
|
39
|
+
dominant-baseline: middle;
|
40
|
+
`,
|
41
|
+
input: `
|
42
|
+
font-size: 4.2;
|
43
|
+
font-weight: bold;
|
47
44
|
text-anchor: start;
|
48
45
|
dominant-baseline: middle;
|
49
46
|
`,
|
50
47
|
type: `
|
51
|
-
user-select: none;
|
52
|
-
direction: ltr !important;
|
53
|
-
font-family: Vazir;
|
54
48
|
font-size: 1mm;
|
55
49
|
font-weight: bold;
|
56
50
|
text-anchor: start;
|
57
51
|
dominant-baseline: middle;
|
58
52
|
`,
|
59
53
|
compliance: `
|
60
|
-
user-select: none;
|
61
|
-
direction: ltr !important;
|
62
|
-
font-family: Vazir;
|
63
54
|
font-size: 0.7mm;
|
64
55
|
text-anchor: end;
|
65
56
|
dominant-baseline: middle;
|