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.
Files changed (37) hide show
  1. package/assets/data/sampleData.js +10 -2
  2. package/assets/templates/mainTemplate.js +128 -0
  3. package/assets/templates/template_combo.js +49 -44
  4. package/package.json +1 -1
  5. package/src/Audiogram/Audiogram.js +43 -21
  6. package/src/Audiogram/Audiogram_100.js +499 -0
  7. package/src/Audiogram/Audiogram_box.js +483 -0
  8. package/src/Audiogram/dims.js +4 -80
  9. package/src/Audiogram/dims_100.js +51 -0
  10. package/src/Audiogram/dims_box.js +125 -0
  11. package/src/{Form → Box}/Box.js +26 -3
  12. package/src/Form/Form.js +8 -8
  13. package/src/Form/Form_N.js +194 -0
  14. package/src/Form/Forms.js +0 -2
  15. package/src/Form/Sections.js +0 -6
  16. package/src/Form/Sections_N.js +66 -0
  17. package/src/{Form → Header}/Header.js +1 -4
  18. package/src/Header/Header_N.js +72 -0
  19. package/src/MultiText/MultiText.js +37 -0
  20. package/src/{Form/Reflex_N.js → Reflex/Reflex.js} +15 -3
  21. package/src/Reflex/units.js +65 -0
  22. package/src/{Form/Speech_N.js → Speech/Speech.js} +45 -28
  23. package/src/Speech/Speech_N.js +125 -0
  24. package/src/Speech/units.js +31 -0
  25. package/src/{Form → Tympanogram}/Tympanogram.js +37 -68
  26. package/src/Tympanogram/units.js +76 -0
  27. package/src/common/{putTextBox.js → putCell.js} +6 -6
  28. package/src/common/putG.js +10 -0
  29. package/src/common/putLine.js +1 -1
  30. package/src/common/putText.js +5 -4
  31. package/src/main.js +140 -19
  32. package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
  33. package/assets/styles-test.css +0 -86
  34. package/assets/styles.css +0 -86
  35. package/src/Form/Reflex.js +0 -145
  36. package/src/Form/Speech.js +0 -121
  37. package/src/Form/globalinfo.js +0 -68
@@ -46,7 +46,11 @@ const patientData = {
46
46
  updateDates: ["2025/6/5,16:32", "2025/6/5,16:32"], // آرایه تاریخ و ساعت بروزرسانی ها
47
47
  age: 77, //سن بیمار در این نشست
48
48
  referrer: "دکتر سید علی سرابی ", //ارجاع‌دهنده
49
- history: { description: "وزوز گوش گهگاهی - سرگیجه گهگاهی - درد در ناحیه گردن - سابقه سرگیجه ۵ سال قبل" },
49
+ history: {
50
+ description:
51
+ `کاهش شنوایی حسی عصبی ملایم تا متوسط در فرکانس بم تامیانه در گوش راست.
52
+ کاهش شنوایی آمیخته متوسط تا شدید در گوش چپ.`,
53
+ },
50
54
 
51
55
  // history, // رشته متن شرح‌حال بیمار
52
56
 
@@ -79,7 +83,11 @@ const patientData = {
79
83
  CONTRA: { 500: "80", 1000: "90", 2000: "NR", 4000: '95' }
80
84
  },
81
85
  },
82
- report: { description: "کاهش شنوایی ملایم در فرکاس های زیر هر دو گوش - تکرار آزمون سالانه توصیه شد." },
86
+ report: {
87
+ description:
88
+ `کاهش شنوایی حسی عصبی ملایم تا متوسط در فرکانس بم تامیانه در گوش راست
89
+ کاهش شنوایی آمیخته متوسط تا شدید در گوش چپ`,
90
+ },
83
91
 
84
92
  },
85
93
  {
@@ -0,0 +1,128 @@
1
+ // 'Printable Area'
2
+ const mainTemplate = {
3
+ name: 'Main Template',
4
+ label: 'ادیومتری و تمپانوتری',
5
+ // backgroundImage: 'backgroundImage',
6
+ // تعیین نمایش بوردرهای سکشن ها
7
+ showSectionBorders: true, // treu || false
8
+
9
+ paper: { type: 'A4', width: 210, height: 297, orientation: 'portrait' },
10
+ margin: { left: 5, top: 5, right: 5, bottom: 5 },
11
+
12
+
13
+ calcDims: function () {
14
+ this.width = this.paper.width - (this.margin.left + this.margin.right);
15
+ this.height = this.paper.height - (this.margin.top + this.margin.bottom);
16
+ },
17
+
18
+ defSections: function () {
19
+ this['Header'] = {
20
+ name: 'header', container: '',
21
+ width: this.width, height: 20,
22
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
23
+ }
24
+ this['Patient Info'] = {
25
+ name: 'patientInfo', container: '',
26
+ width: this.width, height: 15,
27
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
28
+ }
29
+ this['History'] = {
30
+ name: 'history', container: '',
31
+ width: this.width, height: 25,
32
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
33
+ }
34
+ this['Right Audiogram'] = {
35
+ name: 'RAudiogram', container: '',
36
+ width: this.width / 2, height: 90,
37
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
38
+ display: 'inline',
39
+ }
40
+ this['Left Audiogram'] = {
41
+ name: 'LAudiogram', container: '',
42
+ width: this.width / 2, height: 90,
43
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
44
+ }
45
+ this['Right Speech'] = {
46
+ name: 'RSpeech', container: '',
47
+ width: this.width / 2, height: 20,
48
+ display: 'inline',
49
+ container: '', // later SVG node Section
50
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
51
+ }
52
+ this['Left Speech'] = {
53
+ name: 'LSpeech', container: '',
54
+ width: this.width / 2, height: 20,
55
+ box: { container: '', margin: { top: 2, right: 2, bottom: 2, left: 2 } },
56
+ }
57
+
58
+ },
59
+
60
+ defSectionsAray: function () { // تعریف آرایه سکشن‌ها
61
+ this.sections = [
62
+ this['Header'], this['Patient Info'], this['History'],
63
+ this['Right Audiogram'], this['Left Audiogram'],
64
+ this['Right Speech'], this['Left Speech']
65
+
66
+ ];
67
+
68
+ },
69
+
70
+ calcSectionTopLeft: function () { // محاسبه فاصله از بالا و چپ هر سکشن از محدوده قابل چاپ
71
+ let top = 0;
72
+ let left = 0;
73
+
74
+ this.sections.forEach(section => {
75
+ section.top = top
76
+ section.left = left
77
+ if (section.display !== 'inline') {
78
+ top += section.height;
79
+ left = 0
80
+ } else left += section.width;
81
+ });
82
+ },
83
+
84
+ defBoxes: function () {
85
+ // let section = this['Header']
86
+ // section.box.width = section.width - (section.box.margin.left + section.box.margin.right)
87
+ // section.box.height = section.height - (section.box.margin.top + section.box.margin.bottom)
88
+ this.sections.forEach(section => {
89
+ const { box, width, height } = section
90
+ const { margin } = box
91
+ box.width = width - (margin.left + margin.right)
92
+ box.height = height - (margin.top + margin.bottom)
93
+ })
94
+
95
+ },
96
+
97
+ defElements: function () {
98
+ let box = this['Header'].box
99
+ let style = ['user-select: none', 'direction: rtl', 'font-family: Vazir', 'font-size: 1mm'].join('; ')
100
+ box.elements = [
101
+ { type: 'image', x: 10, y: 30 },
102
+ { type: 'line', x1: 0, y1: box.height, x2: box.width, y2: box.height },
103
+ { type: 'label', x: 30, y: 5, value: 'تاریخ :', style },
104
+ { type: 'input', name: 'officeName', x: box.width - 16, y: box.height - 6, style },
105
+ { type: 'input', name: 'date', x: 20, y: 5, style: style + ' font-size: 0.8mm;' },
106
+ ];
107
+
108
+ box = this['Right Speech'].box
109
+ box.elements = ["SAT", "SRT", "MCL", "UCL", "SDS"];
110
+ box.name = this['Right Speech'].name;
111
+
112
+
113
+ },
114
+
115
+
116
+ }
117
+
118
+ // تعریف همه پراپرتی‌های آبجکت با فراخوانی توابع به ترتیب
119
+ mainTemplate.calcDims();
120
+ mainTemplate.defSections();
121
+ mainTemplate.defSectionsAray();
122
+ mainTemplate.calcSectionTopLeft();
123
+ mainTemplate.defBoxes();
124
+ mainTemplate.defElements();
125
+
126
+
127
+
128
+ export default mainTemplate
@@ -3,16 +3,18 @@ const template_combo = {
3
3
  label: 'ادیومتری و تمپانوتری',
4
4
  // backgroundImage: 'backgroundImage',
5
5
  // تعیین نمایش بوردرهای سکشن ها
6
- sectionBorders: 'none', // display || none
6
+ sectionBorders: 'display', // display || none
7
7
  margin: { left: 5, top: 5, right: 5, bottom: 5 },
8
8
  paper: { type: 'A4', case: 'portrait', width: 210, height: 297 },
9
9
 
10
10
  // Printable Dimention
11
11
  calc1: function () {
12
+
12
13
  this.width = this.paper.width - (this.margin.left + this.margin.right);
13
14
  this.height = this.paper.height - (this.margin.top + this.margin.bottom);
14
15
  let width = this.width;
15
16
  // ابعاد و پدینگ المنت ها
17
+
16
18
  // فضای خالی
17
19
  this.blank = {
18
20
  name: 'blank',
@@ -20,6 +22,7 @@ const template_combo = {
20
22
  margin: { left: 0, top: 0, right: 0, bottom: 0 },
21
23
  display: 'block',
22
24
  }
25
+
23
26
  this.header = {
24
27
  // hideContext: true,
25
28
  name: 'header',
@@ -27,25 +30,32 @@ const template_combo = {
27
30
  margin: { left: 0, top: 0, right: 0, bottom: 0 },
28
31
  display: 'block',
29
32
  }
33
+
30
34
  this.patient = {
31
35
  name: 'patient',
32
- w: width, h: 10,
33
- margin: { left: 1, top: 1, right: 1, bottom: 1 },
36
+ w: width, h: 8,
37
+ margin: { left: 1, top: 0, right: 1, bottom: 0 },
34
38
  display: 'block',
35
39
  }
40
+
36
41
  this.history = {
37
42
  name: 'history',
38
- w: width, h: 10,
39
- margin: { left: 1, top: 1, right: 1, bottom: 1 },
43
+ w: width, h: 14,
44
+ margin: { left: 1, top: 0, right: 1, bottom: 0 },
45
+ display: 'block',
46
+ }
47
+
48
+ // Titles Common Object
49
+ this['Title'] = {
50
+ w: width, h: 7, // پهنا و ارتفاع سکشن
51
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
40
52
  display: 'block',
41
53
  }
42
54
 
43
55
  // Audiogram Titles
44
56
  this['Audiogram Titles'] = {
57
+ ...this['Title'],
45
58
  name: 'Audiogram Titles',
46
- w: width, h: 8, // پهنا و ارتفاع سکشن
47
- margin: { left: 5, top: 1, right: 5, bottom: 1 },
48
- display: 'block',
49
59
  stroke: true,
50
60
  // محاسبه پهنا ارتفاع در تابع calc2
51
61
  }
@@ -55,26 +65,26 @@ const template_combo = {
55
65
  {
56
66
  blank: false,
57
67
  name: 'RAudiogram',
58
- w: width / 2, h: 90, // ابعاد سکشن ادیوگرام
59
- margin: { left: 1, top: 0, right: 1, bottom: 0 },
68
+ w: width / 2, h: 95, // ابعاد سکشن ادیوگرام
69
+ margin: { left: 1, top: 0, right: 2, bottom: 0 }, // در مدل باکس این برای باکس هست
60
70
  display: 'inline',
71
+ borderBox: 'display', // display | none default: none بوردر
61
72
  });
62
73
 
63
74
  this.LAudiogram = {}
64
75
  Object.assign(this.LAudiogram,
65
76
  {
66
77
  name: 'LAudiogram',
67
- w: width / 2, h: 90, // پهنای سکشن هست
68
- margin: { left: 1, top: 0, right: 1, bottom: 0 },
78
+ w: width / 2, h: 95, // پهنای سکشن هست
79
+ margin: { left: 2, top: 0, right: 1, bottom: 0 },
69
80
  display: 'block',
81
+ // borderBox: 'none', // display | none default: none بوردر
70
82
  });
71
83
 
72
84
  // Speech Titles
73
85
  this['Speech Titles'] = {
74
86
  name: 'Speech Titles',
75
- w: width, h: 8, // پهنا و ارتفاع سکشن
76
- margin: { left: 5, top: 0.5, right: 5, bottom: 1 },
77
- display: 'block',
87
+ ...this['Title'],
78
88
  stroke: true,
79
89
  // محاسبه پهنا ارتفاع در تابع calc2
80
90
  }
@@ -82,7 +92,7 @@ const template_combo = {
82
92
  this.RSpeech = {
83
93
  name: 'RSpeech',
84
94
  w: width / 2, h: 15,
85
- margin: { left: 2, top: 0, right: 12, bottom: 0 },
95
+ margin: { left: 1, top: 0, right: 2, bottom: 0 },
86
96
  display: 'inline',
87
97
  stroke: true,
88
98
  }
@@ -90,7 +100,7 @@ const template_combo = {
90
100
  this.LSpeech = {
91
101
  name: 'LSpeech',
92
102
  w: width / 2, h: 15,
93
- margin: { left: 12, top: 0, right: 2, bottom: 0 },
103
+ margin: { left: 2, top: 0, right: 1, bottom: 0 },
94
104
  display: 'block',
95
105
  stroke: true
96
106
  }
@@ -98,9 +108,7 @@ const template_combo = {
98
108
  // Tympanogram Titles
99
109
  this['Tympanogram Titles'] = {
100
110
  name: 'Tympanogram Titles',
101
- w: width, h: 8, // پهنا و ارتفاع سکشن
102
- margin: { left: 5, top: 1, right: 5, bottom: 1 },
103
- display: 'block',
111
+ ...this['Title'],
104
112
  stroke: true,
105
113
  // محاسبه پهنا ارتفاع در تابع calc2
106
114
  }
@@ -108,53 +116,50 @@ const template_combo = {
108
116
  this.RTympanogram = {
109
117
  name: 'RTympanogram',
110
118
  w: width / 2, h: 60,
111
- margin: { left: 2, top: 0, right: 2, bottom: 0 },
119
+ margin: { left: 1, top: 0, right: 2, bottom: 0 },
112
120
  display: 'inline',
113
121
  }
114
122
 
115
123
  this.LTympanogram = {
116
124
  name: 'LTympanogram',
117
125
  w: width / 2, h: 60,
118
- margin: { left: 2, top: 0, right: 2, bottom: 0 },
126
+ margin: { left: 2, top: 0, right: 1, bottom: 0 },
119
127
  display: 'block',
120
128
  }
121
129
 
122
130
  // Reflex Titles
123
131
  this['Reflex Titles'] = {
124
132
  name: 'Reflex Titles',
125
- w: width, h: 8, // پهنا و ارتفاع سکشن
126
- margin: { left: 5, top: 1, right: 5, bottom: 1 },
127
- display: 'block',
133
+ ...this['Title'],
128
134
  stroke: true,
129
135
  // محاسبه پهنا ارتفاع در تابع calc2
130
136
  }
131
137
 
132
-
133
138
  this.RReflex = {
134
139
  name: 'RReflex',
135
- w: width / 2, h: 30,
136
- margin: { left: 2, top: 2, right: 2, bottom: 2 },
140
+ w: width / 2, h: 26,
141
+ margin: { left: 1, top: 0, right: 2, bottom: 1 },
137
142
  display: 'inline'
138
143
  }
139
144
 
140
145
  this.LReflex = {
141
146
  name: 'LReflex',
142
- w: width / 2, h: 30,
143
- margin: { left: 2, top: 2, right: 2, bottom: 2 },
147
+ w: width / 2, h: 26,
148
+ margin: { left: 2, top: 0, right: 1, bottom: 1 },
144
149
  display: 'block'
145
150
  }
146
151
 
147
152
  this.report = {
148
153
  name: 'report',
149
- w: width, h: 15,
150
- margin: { left: 1, top: 1, right: 1, bottom: 1 },
154
+ w: width, h: 20,
155
+ margin: { left: 1, top: 0, right: 1, bottom: 0 },
151
156
  display: 'block'
152
157
  }
153
158
 
154
159
  this.footer = {
155
160
  name: 'footer',
156
161
  w: width, h: 10,
157
- margin: { left: 1, top: 1, right: 1, bottom: 1 },
162
+ margin: { left: 0, top: 0, right: 0, bottom: 0 },
158
163
  display: 'block'
159
164
  }
160
165
  },
@@ -181,13 +186,13 @@ const template_combo = {
181
186
  ]
182
187
  this.header.inputs = [
183
188
  { name: 'officeName', x: width - 16, y: height - 6, style },
184
- { name: 'date', x: 20, y: 5, style: style + ' font-size: 0.8mm;' },
189
+ { name: 'date', x: 20, y: 5, style: style + ' font-size: 0.8mm;' },
185
190
  ]
186
191
 
187
192
  width = this.patient.width = this.getWidth(this.patient)
188
- this.patient.height = this.getHeight(this.patient)
193
+ height = this.patient.height = this.getHeight(this.patient)
189
194
  this.patient.elements = [
190
- { type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
195
+ // { type: 'line', x1: 0, y1: height, x2: width, y2: height },
191
196
  { type: 'text', x: width, y: 5, value: 'نام:' },
192
197
  { type: 'text', x: width - 38, y: 5, value: 'نام خانوادگی:' },
193
198
  { type: 'text', x: width - 90, y: 5, value: 'سن:' },
@@ -207,9 +212,9 @@ const template_combo = {
207
212
  ]
208
213
 
209
214
  width = this.history.width = this.getWidth(this.history)
210
- this.history.height = this.getHeight(this.history)
215
+ height = this.history.height = this.getHeight(this.history)
211
216
  this.history.elements = [
212
- { type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
217
+ { type: 'line', x1: 0, y1: height, x2: width, y2: height },
213
218
  { type: 'text', x: width, y: 5, value: 'شرح حال:' },
214
219
  ]
215
220
  this.history.inputs = [
@@ -220,12 +225,12 @@ const template_combo = {
220
225
  height = this['Audiogram Titles'].height = this.getHeight(this['Audiogram Titles'])
221
226
  style = `
222
227
  text-anchor: middle;
228
+ dominant-baseline: middle;
223
229
  font-size: 1.2mm
224
230
  `;
225
-
226
231
  this['Audiogram Titles'].elements = [
227
232
  // { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
228
- { type: 'text', x: width / 2, y: 5, value: 'Audiograms', style },
233
+ { type: 'text', x: width / 2, y: height / 2, value: 'Audiograms', style },
229
234
  { type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
230
235
  { type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
231
236
  ]
@@ -240,7 +245,7 @@ const template_combo = {
240
245
  height = this['Speech Titles'].height = this.getHeight(this['Speech Titles'])
241
246
  this['Speech Titles'].elements = [
242
247
  // { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
243
- { type: 'text', x: width / 2, y: 4, value: 'Speech Tests', style },
248
+ { type: 'text', x: width / 2, y: height / 2, value: 'Speech Tests', style },
244
249
  { type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
245
250
  { type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
246
251
  ]
@@ -257,7 +262,7 @@ const template_combo = {
257
262
  height = this['Tympanogram Titles'].height = this.getHeight(this['Tympanogram Titles'])
258
263
  this['Tympanogram Titles'].elements = [
259
264
  // { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
260
- { type: 'text', x: width / 2, y: 5, value: 'Tympanograms', style },
265
+ { type: 'text', x: width / 2, y: height / 2, value: 'Tympanograms', style },
261
266
  // { type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
262
267
  // { type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
263
268
  ]
@@ -271,7 +276,7 @@ const template_combo = {
271
276
  height = this['Reflex Titles'].height = this.getHeight(this['Reflex Titles'])
272
277
  this['Reflex Titles'].elements = [
273
278
  // { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
274
- { type: 'text', x: width / 2, y: 5, value: 'Acoustic Reflexes', style },
279
+ { type: 'text', x: width / 2, y: height / 2, value: 'Acoustic Reflexes', style },
275
280
  { type: 'text', x: width / 4, y: 5, value: 'Probe in the Right Ear', style: 'fill: red; text-anchor: middle' },
276
281
  { type: 'text', x: width * 3 / 4, y: 5, value: 'Probe in the Left Ear', style: 'fill: blue; text-anchor: middle' },
277
282
  ]
@@ -287,7 +292,7 @@ const template_combo = {
287
292
  { type: 'text', x: width, y: 5, value: 'گزارش:' },
288
293
  ]
289
294
  this.report.inputs = [
290
- { name: 'description', x: width - 10, y: 5 },
295
+ { name: 'description', x: width - 12, y: 5 },
291
296
  ]
292
297
 
293
298
  width = this.footer.width = this.getWidth(this.footer)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "0.10.1",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -1,3 +1,4 @@
1
+ import putG from "../common/putG.js";
1
2
  import putLine from "../common/putLine.js";
2
3
  import putPoint from "../common/putPoint.js";
3
4
  import putRect from "../common/putRect.js";
@@ -15,7 +16,7 @@ export default class Audiogram {
15
16
  // اضافه کردن ابعاد جایگزین و یا اختصاصی دیگر به آبجکت ابعاد
16
17
  dims && Object.assign(this.dims, dims);
17
18
  // console.log(dims);
18
-
19
+
19
20
 
20
21
  this.events = events;
21
22
  this.side = side;
@@ -71,67 +72,88 @@ export default class Audiogram {
71
72
  this.yAxisLength = yAxisLength
72
73
 
73
74
  // Main SVG for Audiogram
75
+ style = styles.svg;
74
76
  const viewBox = [-chartPadding.left, -chartPadding.top, vbWidth, vbHeight]
75
- const svg = putSVG({ container, x, y, width, height, viewBox })
77
+ const svg = putSVG({ container, x, y, width, height, viewBox, style })
76
78
  this.svg = svg; // کل نودی که به کانتینر اپند میشه
77
79
 
78
80
  // برای فرم‌های پیش چاپ نشده
79
81
  if (!dims.blank) {
80
82
  // محدوده مختصات خطوط جدول
81
- const chartArea = putRect({
83
+ putRect({
82
84
  container: svg,
83
85
  x: this.getX(vf.min), y: this.getY(intensity.min),
84
86
  width: xAxisLength.vb, height: yAxisLength.vb,
85
87
  style: 'stroke-width: 0.4; stroke: gray; fill: transparent'
86
88
  })
89
+
87
90
  // رسم خطوط افقی از بالا به پایین
91
+ let g = putG({ container: svg });
92
+
88
93
  let x1 = this.getX(vf.min);
89
94
  let x2 = this.getX(vf.max);
95
+
90
96
  for (let i = intensity.min; i <= intensity.max; i += intensity.step) {
91
97
  const y1 = this.getY(i)
92
98
  const y2 = y1;
93
99
  style = (i === 0) ? styles.boldLine : styles.line;
94
- putLine({ container: svg, x1, y1, x2, y2, style })
100
+ putLine({ container: g, x1, y1, x2, y2, style })
95
101
  }
96
102
 
103
+ svg.appendChild(g);
104
+
97
105
  // رسم خطوط عمودی از چپ به راست
106
+ g = putG({ container: svg });
107
+
98
108
  let y1 = this.getY(intensity.min)
99
109
  let y2 = this.getY(intensity.max)
100
- frequencies.forEach(item => {
101
- const x1 = this.getX(item.vf)
102
- const x2 = x1
103
- style = (item.semiOctav) ? styles.semiOctavFreqline : styles.mainFreqline;
104
- (item.f === 1000) && (style = styles.boldLine);
105
- putLine({ container: svg, x1, y1, x2, y2, style })
106
- })
110
+
111
+ frequencies.
112
+ forEach(item => {
113
+ const x1 = this.getX(item.vf)
114
+ const x2 = x1
115
+ style = (item.semiOctav) ? styles.semiOctavFreqline : styles.mainFreqline;
116
+ (item.f === 1000) && (style = styles.boldLine);
117
+ putLine({ container: g, x1, y1, x2, y2, style })
118
+ });
119
+
120
+ svg.appendChild(g);
121
+
107
122
  // برچسب های اعداد فرکانس
108
123
  style = styles.frequency
124
+ g = putG({ container: svg, style });
109
125
  const y = this.getY(-25)
110
- frequencies.forEach(item => {
111
- const value = item.f
112
- const x = this.getX(item.vf)
113
- !item.semiOctav && item.f != 125 && item.f != 16000 &&
114
- putText({ container: svg, value, x, y, style });
115
- })
126
+
127
+ frequencies.
128
+ forEach(item => {
129
+ const value = item.f
130
+ const x = this.getX(item.vf)
131
+ !item.semiOctav && item.f != 125 && item.f != 16000 &&
132
+ putText({ container: g, value, x, y, });
133
+ });
134
+
135
+ svg.appendChild(g);
116
136
 
117
137
  // رسم اعداد شدت محور عمودی
118
138
  style = styles.intensity
139
+ g = putG({ container: svg, style });
119
140
  const x = this.getX(-0.1)
141
+
120
142
  for (let i = -10; i <= 120; i += 10) {
121
143
  const y = this.getY(i)
122
144
  const value = i
123
- putText({ container: svg, x, y, value, style })
124
-
125
-
145
+ putText({ container: g, x, y, value })
126
146
  }
127
147
 
148
+ svg.appendChild(g);
149
+
128
150
  }
129
151
  // یک بوردر راهنمای توسعه برای اس‌ وی جی به تمام پهنا و ارتفاع رسم می‌کنیم
130
152
  // این مربع مرزی را آخرین ایجاد میکنیم تا بالاترین لایه باشد و روی ریودادها درست عمل کند
131
153
  const borderRect = putRect({
132
154
  container: svg, x: -chartPadding.left, y: -chartPadding.top,
133
155
  width: vbWidth, height: vbHeight, name: '',
134
- style: 'fill: transparent; stroke: transparent;',
156
+ style: 'fill: transparent; stroke: green;',
135
157
  });
136
158
  this.borderRect = borderRect;
137
159