@oanda/labs-currency-power-balance-widget 1.0.150 → 1.0.151
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/CHANGELOG.md +608 -0
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +11 -32
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +11 -32
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +9 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,614 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.151 (2025-08-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.211 (2025-08-05)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.210 (2025-07-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.209 (2025-07-31)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.208 (2025-07-24)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## 1.0.207 (2025-07-18)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.206 (2025-07-18)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.205 (2025-07-17)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.204 (2025-07-09)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.203 (2025-06-16)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 1.0.202 (2025-06-04)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 1.0.201 (2025-06-02)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## 1.0.200 (2025-05-30)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 1.0.199 (2025-05-29)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 1.0.198 (2025-05-26)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 1.0.197 (2025-05-23)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 1.0.196 (2025-05-22)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## 1.0.195 (2025-05-21)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## 1.0.194 (2025-05-21)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## 1.0.193 (2025-05-15)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## 1.0.192 (2025-05-14)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
## 1.0.191 (2025-04-30)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## 1.0.190 (2025-04-28)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## 1.0.189 (2025-04-23)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## 1.0.188 (2025-04-22)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## 1.0.187 (2025-04-18)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## 1.0.186 (2025-04-10)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## 1.0.185 (2025-04-09)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## 1.0.184 (2025-04-08)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 1.0.183 (2025-04-04)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## 1.0.182 (2025-03-21)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## 1.0.181 (2025-03-13)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## 1.0.180 (2025-01-30)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## 1.0.179 (2025-01-29)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## 1.0.178 (2025-01-12)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## 1.0.177 (2025-01-10)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## 1.0.176 (2025-01-10)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## 1.0.175 (2025-01-08)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## 1.0.174 (2024-12-16)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## 1.0.173 (2024-12-11)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 1.0.172 (2024-11-29)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## 1.0.171 (2024-11-28)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## 1.0.170 (2024-11-28)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## 1.0.169 (2024-11-20)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## 1.0.168 (2024-11-19)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## 1.0.167 (2024-10-14)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## 1.0.166 (2024-10-07)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
## 1.0.165 (2024-10-03)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## 1.0.164 (2024-09-26)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
## 1.0.163 (2024-09-18)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## 1.0.162 (2024-09-12)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
## 1.0.161 (2024-09-11)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
## 1.0.160 (2024-09-10)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## 1.0.159 (2024-09-09)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## 1.0.158 (2024-09-04)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## 1.0.157 (2024-09-04)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## 1.0.156 (2024-09-02)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## 1.0.155 (2024-08-29)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## 1.0.154 (2024-08-29)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## 1.0.153 (2024-08-23)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## 1.0.152 (2024-08-23)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## 1.0.151 (2024-08-20)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
## 1.0.150 (2024-08-19)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
## 1.0.149 (2024-08-07)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
## 1.0.148 (2024-08-01)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
## 1.0.147 (2024-08-01)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 1.0.146 (2024-07-26)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
## 1.0.145 (2024-07-25)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
## 1.0.144 (2024-07-22)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
## 1.0.143 (2024-07-19)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
## 1.0.142 (2024-07-16)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
## 1.0.141 (2024-07-16)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
## 1.0.140 (2024-07-12)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
## 1.0.139 (2024-07-12)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## 1.0.138 (2024-07-10)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
## 1.0.137 (2024-07-05)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
## 1.0.136 (2024-07-03)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
## 1.0.135 (2024-07-03)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
## 1.0.134 (2024-07-03)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 1.0.133 (2024-06-28)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
## 1.0.132 (2024-06-27)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
## 1.0.131 (2024-06-27)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
## 1.0.130 (2024-06-26)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
## 1.0.129 (2024-06-17)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
## 1.0.128 (2024-06-17)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 1.0.127 (2024-06-10)
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
## 1.0.126 (2024-05-29)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
## 1.0.125 (2024-05-29)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
## 1.0.124 (2024-05-29)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
## 1.0.123 (2024-05-28)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
## 1.0.122 (2024-05-27)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
## 1.0.121 (2024-05-27)
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
## 1.0.120 (2024-05-24)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
## 1.0.119 (2024-05-17)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
## 1.0.118 (2024-05-09)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
## 1.0.117 (2024-05-07)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
## 1.0.116 (2024-04-23)
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
## 1.0.115 (2024-04-22)
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## 1.0.114 (2024-04-19)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
## 1.0.113 (2024-04-19)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
## 1.0.112 (2024-04-15)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
## 1.0.111 (2024-04-11)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
## 1.0.110 (2024-04-05)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
## 1.0.109 (2024-04-05)
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
## 1.0.108 (2024-04-04)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
## 1.0.107 (2024-04-03)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
## 1.0.106 (2024-03-29)
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
## 1.0.105 (2024-03-28)
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
## 1.0.104 (2024-03-21)
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
## 1.0.103 (2024-03-20)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
## 1.0.102 (2024-03-20)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
## 1.0.101 (2024-03-13)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
## 1.0.100 (2024-03-12)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
## 1.0.99 (2024-03-11)
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
## 1.0.98 (2024-03-07)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
## 1.0.97 (2024-03-06)
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
## 1.0.96 (2024-03-06)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
## 1.0.95 (2024-03-04)
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
## 1.0.94 (2024-02-29)
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
## 1.0.93 (2024-02-28)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
## 1.0.92 (2024-02-28)
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
## 1.0.91 (2024-02-23)
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
## 1.0.90 (2024-02-23)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
## 1.0.89 (2024-02-21)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
## 1.0.88 (2024-02-21)
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
## 1.0.87 (2024-02-20)
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
## 1.0.86 (2024-02-20)
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
## 1.0.85 (2024-02-13)
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
## 1.0.84 (2024-02-13)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
## 1.0.83 (2024-02-09)
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
## 1.0.82 (2024-02-05)
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
## 1.0.81 (2024-02-05)
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
## 1.0.80 (2024-02-05)
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
## 1.0.79 (2024-02-05)
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
## 1.0.78 (2024-01-30)
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
## 1.0.77 (2024-01-25)
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
## 1.0.76 (2024-01-25)
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
## 1.0.75 (2024-01-22)
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
## 1.0.74 (2024-01-22)
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
## 1.0.73 (2024-01-22)
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
## 1.0.72 (2024-01-19)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
## 1.0.71 (2024-01-18)
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
## 1.0.70 (2024-01-17)
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
## 1.0.69 (2024-01-17)
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
## 1.0.68 (2024-01-15)
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
## 1.0.67 (2024-01-15)
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
## 1.0.66 (2024-01-12)
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
## 1.0.65 (2024-01-11)
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
## 1.0.64 (2024-01-11)
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
## 1.0.63 (2024-01-11)
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
## 1.0.62 (2024-01-10)
|
|
607
|
+
|
|
608
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
6
614
|
## 1.0.150 (2025-08-05)
|
|
7
615
|
|
|
8
616
|
|
|
@@ -4,59 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.xAxisLabelFormatter = exports.tooltipFormatter = exports.isMonthWeek = exports.intervalFormatter = exports.formatLegendData = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
7
8
|
var _graphql = require("../../../../gql/types/graphql");
|
|
8
9
|
var _constants = require("./constants");
|
|
9
|
-
const getDateAndTime = param => {
|
|
10
|
-
const dateAndTime = param.split('T');
|
|
11
|
-
return {
|
|
12
|
-
date: dateAndTime[0],
|
|
13
|
-
time: dateAndTime[1].substring(0, 5)
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
const dateFormat = date => `${new Date(date).toLocaleDateString(undefined, {
|
|
17
|
-
month: 'numeric',
|
|
18
|
-
day: 'numeric'
|
|
19
|
-
})}`;
|
|
20
|
-
const dateTimeFormat = _ref => {
|
|
21
|
-
let {
|
|
22
|
-
date,
|
|
23
|
-
time
|
|
24
|
-
} = _ref;
|
|
25
|
-
return `${new Date(date).toLocaleDateString(undefined, {
|
|
26
|
-
year: 'numeric',
|
|
27
|
-
month: 'numeric',
|
|
28
|
-
day: 'numeric'
|
|
29
|
-
})}, ${time} UTC`;
|
|
30
|
-
};
|
|
31
10
|
const isMonthWeek = timeUnit => timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M3 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.M1 || timeUnit === _graphql.CurrencyPowerBalanceTimeUnit.W1;
|
|
32
11
|
exports.isMonthWeek = isMonthWeek;
|
|
33
12
|
const xAxisLabelFormatter = (label, timeUnit) => {
|
|
34
13
|
const {
|
|
35
14
|
date,
|
|
36
15
|
time
|
|
37
|
-
} =
|
|
16
|
+
} = (0, _labsWidgetCommon.getChartDateAndTime)(label);
|
|
38
17
|
const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';
|
|
39
|
-
return isDateFormat ?
|
|
18
|
+
return isDateFormat ? (0, _labsWidgetCommon.chartDateFormat)(date) : time;
|
|
40
19
|
};
|
|
41
20
|
exports.xAxisLabelFormatter = xAxisLabelFormatter;
|
|
42
21
|
const intervalFormatter = dataLength => Math.round(dataLength / _constants.VERTICAL_LINE_COUNT);
|
|
43
22
|
exports.intervalFormatter = intervalFormatter;
|
|
44
23
|
const tooltipFormatter = values => {
|
|
45
|
-
const date =
|
|
46
|
-
const row = values.sort((
|
|
24
|
+
const date = (0, _labsWidgetCommon.chartDateTimeFormat)((0, _labsWidgetCommon.getChartDateAndTime)(values[0].value[0]));
|
|
25
|
+
const row = values.sort((_ref, _ref2) => {
|
|
47
26
|
let {
|
|
48
27
|
value: valueA
|
|
49
|
-
} =
|
|
28
|
+
} = _ref;
|
|
50
29
|
let {
|
|
51
30
|
value: valueB
|
|
52
|
-
} =
|
|
31
|
+
} = _ref2;
|
|
53
32
|
return Number(valueB[1]) - Number(valueA[1]);
|
|
54
|
-
}).map(
|
|
33
|
+
}).map(_ref3 => {
|
|
55
34
|
let {
|
|
56
35
|
marker,
|
|
57
36
|
seriesName,
|
|
58
37
|
value
|
|
59
|
-
} =
|
|
38
|
+
} = _ref3;
|
|
60
39
|
return `<div style="display:flex;align-items:center;">
|
|
61
40
|
<div style="display:flex;align-items:center;width:50px;margin-right:10px;">
|
|
62
41
|
${marker}
|
|
@@ -72,10 +51,10 @@ const tooltipFormatter = values => {
|
|
|
72
51
|
};
|
|
73
52
|
exports.tooltipFormatter = tooltipFormatter;
|
|
74
53
|
const formatLegendData = values => {
|
|
75
|
-
const dataCurrencies = values.map(
|
|
54
|
+
const dataCurrencies = values.map(_ref4 => {
|
|
76
55
|
let {
|
|
77
56
|
currency
|
|
78
|
-
} =
|
|
57
|
+
} = _ref4;
|
|
79
58
|
return currency;
|
|
80
59
|
});
|
|
81
60
|
const list = dataCurrencies.length === _constants.CURRENCIES_ORDER.length ? _constants.CURRENCIES_ORDER : _constants.CURRENCIES_ORDER.filter(currency => dataCurrencies.includes(currency));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["_labsWidgetCommon","require","_graphql","_constants","isMonthWeek","timeUnit","CurrencyPowerBalanceTimeUnit","M3","M1","W1","exports","xAxisLabelFormatter","label","date","time","getChartDateAndTime","isDateFormat","chartDateFormat","intervalFormatter","dataLength","Math","round","VERTICAL_LINE_COUNT","tooltipFormatter","values","chartDateTimeFormat","value","row","sort","_ref","_ref2","valueA","valueB","Number","map","_ref3","marker","seriesName","join","formatLegendData","dataCurrencies","_ref4","currency","list","length","CURRENCIES_ORDER","filter","includes","name","itemStyle","color","COLOR_CONFIG"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import {\n chartDateFormat,\n chartDateTimeFormat,\n getChartDateAndTime,\n} from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { TooltipFormatterParams } from './types';\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getChartDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? chartDateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = chartDateTimeFormat(getChartDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`\n );\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAOA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAOA,MAAMG,WAAW,GAAIC,QAAsC,IACzDA,QAAQ,KAAKC,qCAA4B,CAACC,EAAE,IAC5CF,QAAQ,KAAKC,qCAA4B,CAACE,EAAE,IAC5CH,QAAQ,KAAKC,qCAA4B,CAACG,EAAE;AAACC,OAAA,CAAAN,WAAA,GAAAA,WAAA;AAE/C,MAAMO,mBAAmB,GAAGA,CAC1BC,KAAa,EACbP,QAAsC,KACnC;EACH,MAAM;IAAEQ,IAAI;IAAEC;EAAK,CAAC,GAAG,IAAAC,qCAAmB,EAACH,KAAK,CAAC;EACjD,MAAMI,YAAY,GAAGZ,WAAW,CAACC,QAAQ,CAAC,IAAIS,IAAI,KAAK,OAAO;EAE9D,OAAOE,YAAY,GAAG,IAAAC,iCAAe,EAACJ,IAAI,CAAC,GAAGC,IAAI;AACpD,CAAC;AAACJ,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAEF,MAAMO,iBAAiB,GAAIC,UAAkB,IAC3CC,IAAI,CAACC,KAAK,CAACF,UAAU,GAAGG,8BAAmB,CAAC;AAACZ,OAAA,CAAAQ,iBAAA,GAAAA,iBAAA;AAE/C,MAAMK,gBAAgB,GAAIC,MAAgC,IAAK;EAC7D,MAAMX,IAAI,GAAG,IAAAY,qCAAmB,EAAC,IAAAV,qCAAmB,EAACS,MAAM,CAAC,CAAC,CAAC,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EAEzE,MAAMC,GAAG,GAAGH,MAAM,CACfI,IAAI,CACH,CAAAC,IAAA,EAAAC,KAAA;IAAA,IAAC;MAAEJ,KAAK,EAAEK;IAAO,CAAC,GAAAF,IAAA;IAAA,IAAE;MAAEH,KAAK,EAAEM;IAAO,CAAC,GAAAF,KAAA;IAAA,OACnCG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,CACzC,CAAC,CACAG,GAAG,CACFC,KAAA;IAAA,IAAC;MACCC,MAAM;MACNC,UAAU;MACVX;IACF,CAAC,GAAAS,KAAA;IAAA,OAAK;AACZ;AACA,UAAUC,MAAM;AAChB,gBAAgBC,UAAU;AAC1B;AACA,cAAcX,KAAK,CAAC,CAAC,CAAC;AACtB,WAAW;EAAA,CACP,CAAC;EAEH,OAAO;AACT,uCAAuCb,IAAI;AAC3C,MAAMc,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AACpB,SAAS;AACT,CAAC;AAAC5B,OAAA,CAAAa,gBAAA,GAAAA,gBAAA;AAEF,MAAMgB,gBAAgB,GAAIf,MAA8B,IAAK;EAC3D,MAAMgB,cAAc,GAAGhB,MAAM,CAACU,GAAG,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKC,2BAAgB,CAACD,MAAM,GAC7CC,2BAAgB,GAChBA,2BAAgB,CAACC,MAAM,CAAEJ,QAAQ,IAC/BF,cAAc,CAACO,QAAQ,CAACL,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BM,IAAI,EAAEN,QAAQ;IACdO,SAAS,EAAE;MACTC,KAAK,EAAEC,uBAAY,CAACT,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAAChC,OAAA,CAAA6B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,53 +1,32 @@
|
|
|
1
|
+
import { chartDateFormat, chartDateTimeFormat, getChartDateAndTime } from '@oanda/labs-widget-common';
|
|
1
2
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
2
3
|
import { COLOR_CONFIG, CURRENCIES_ORDER, VERTICAL_LINE_COUNT } from './constants';
|
|
3
|
-
const getDateAndTime = param => {
|
|
4
|
-
const dateAndTime = param.split('T');
|
|
5
|
-
return {
|
|
6
|
-
date: dateAndTime[0],
|
|
7
|
-
time: dateAndTime[1].substring(0, 5)
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
const dateFormat = date => `${new Date(date).toLocaleDateString(undefined, {
|
|
11
|
-
month: 'numeric',
|
|
12
|
-
day: 'numeric'
|
|
13
|
-
})}`;
|
|
14
|
-
const dateTimeFormat = _ref => {
|
|
15
|
-
let {
|
|
16
|
-
date,
|
|
17
|
-
time
|
|
18
|
-
} = _ref;
|
|
19
|
-
return `${new Date(date).toLocaleDateString(undefined, {
|
|
20
|
-
year: 'numeric',
|
|
21
|
-
month: 'numeric',
|
|
22
|
-
day: 'numeric'
|
|
23
|
-
})}, ${time} UTC`;
|
|
24
|
-
};
|
|
25
4
|
const isMonthWeek = timeUnit => timeUnit === CurrencyPowerBalanceTimeUnit.M3 || timeUnit === CurrencyPowerBalanceTimeUnit.M1 || timeUnit === CurrencyPowerBalanceTimeUnit.W1;
|
|
26
5
|
const xAxisLabelFormatter = (label, timeUnit) => {
|
|
27
6
|
const {
|
|
28
7
|
date,
|
|
29
8
|
time
|
|
30
|
-
} =
|
|
9
|
+
} = getChartDateAndTime(label);
|
|
31
10
|
const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';
|
|
32
|
-
return isDateFormat ?
|
|
11
|
+
return isDateFormat ? chartDateFormat(date) : time;
|
|
33
12
|
};
|
|
34
13
|
const intervalFormatter = dataLength => Math.round(dataLength / VERTICAL_LINE_COUNT);
|
|
35
14
|
const tooltipFormatter = values => {
|
|
36
|
-
const date =
|
|
37
|
-
const row = values.sort((
|
|
15
|
+
const date = chartDateTimeFormat(getChartDateAndTime(values[0].value[0]));
|
|
16
|
+
const row = values.sort((_ref, _ref2) => {
|
|
38
17
|
let {
|
|
39
18
|
value: valueA
|
|
40
|
-
} =
|
|
19
|
+
} = _ref;
|
|
41
20
|
let {
|
|
42
21
|
value: valueB
|
|
43
|
-
} =
|
|
22
|
+
} = _ref2;
|
|
44
23
|
return Number(valueB[1]) - Number(valueA[1]);
|
|
45
|
-
}).map(
|
|
24
|
+
}).map(_ref3 => {
|
|
46
25
|
let {
|
|
47
26
|
marker,
|
|
48
27
|
seriesName,
|
|
49
28
|
value
|
|
50
|
-
} =
|
|
29
|
+
} = _ref3;
|
|
51
30
|
return `<div style="display:flex;align-items:center;">
|
|
52
31
|
<div style="display:flex;align-items:center;width:50px;margin-right:10px;">
|
|
53
32
|
${marker}
|
|
@@ -62,10 +41,10 @@ const tooltipFormatter = values => {
|
|
|
62
41
|
</div>`;
|
|
63
42
|
};
|
|
64
43
|
const formatLegendData = values => {
|
|
65
|
-
const dataCurrencies = values.map(
|
|
44
|
+
const dataCurrencies = values.map(_ref4 => {
|
|
66
45
|
let {
|
|
67
46
|
currency
|
|
68
|
-
} =
|
|
47
|
+
} = _ref4;
|
|
69
48
|
return currency;
|
|
70
49
|
});
|
|
71
50
|
const list = dataCurrencies.length === CURRENCIES_ORDER.length ? CURRENCIES_ORDER : CURRENCIES_ORDER.filter(currency => dataCurrencies.includes(currency));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["chartDateFormat","chartDateTimeFormat","getChartDateAndTime","CurrencyPowerBalanceTimeUnit","COLOR_CONFIG","CURRENCIES_ORDER","VERTICAL_LINE_COUNT","isMonthWeek","timeUnit","M3","M1","W1","xAxisLabelFormatter","label","date","time","isDateFormat","intervalFormatter","dataLength","Math","round","tooltipFormatter","values","value","row","sort","_ref","_ref2","valueA","valueB","Number","map","_ref3","marker","seriesName","join","formatLegendData","dataCurrencies","_ref4","currency","list","length","filter","includes","name","itemStyle","color"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import {\n chartDateFormat,\n chartDateTimeFormat,\n getChartDateAndTime,\n} from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { TooltipFormatterParams } from './types';\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getChartDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? chartDateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = chartDateTimeFormat(getChartDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`\n );\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":"AAAA,SACEA,eAAe,EACfC,mBAAmB,EACnBC,mBAAmB,QACd,2BAA2B;AAGlC,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SACEC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,QACd,aAAa;AAGpB,MAAMC,WAAW,GAAIC,QAAsC,IACzDA,QAAQ,KAAKL,4BAA4B,CAACM,EAAE,IAC5CD,QAAQ,KAAKL,4BAA4B,CAACO,EAAE,IAC5CF,QAAQ,KAAKL,4BAA4B,CAACQ,EAAE;AAE9C,MAAMC,mBAAmB,GAAGA,CAC1BC,KAAa,EACbL,QAAsC,KACnC;EACH,MAAM;IAAEM,IAAI;IAAEC;EAAK,CAAC,GAAGb,mBAAmB,CAACW,KAAK,CAAC;EACjD,MAAMG,YAAY,GAAGT,WAAW,CAACC,QAAQ,CAAC,IAAIO,IAAI,KAAK,OAAO;EAE9D,OAAOC,YAAY,GAAGhB,eAAe,CAACc,IAAI,CAAC,GAAGC,IAAI;AACpD,CAAC;AAED,MAAME,iBAAiB,GAAIC,UAAkB,IAC3CC,IAAI,CAACC,KAAK,CAACF,UAAU,GAAGZ,mBAAmB,CAAC;AAE9C,MAAMe,gBAAgB,GAAIC,MAAgC,IAAK;EAC7D,MAAMR,IAAI,GAAGb,mBAAmB,CAACC,mBAAmB,CAACoB,MAAM,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EAEzE,MAAMC,GAAG,GAAGF,MAAM,CACfG,IAAI,CACH,CAAAC,IAAA,EAAAC,KAAA;IAAA,IAAC;MAAEJ,KAAK,EAAEK;IAAO,CAAC,GAAAF,IAAA;IAAA,IAAE;MAAEH,KAAK,EAAEM;IAAO,CAAC,GAAAF,KAAA;IAAA,OACnCG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,CACzC,CAAC,CACAG,GAAG,CACFC,KAAA;IAAA,IAAC;MACCC,MAAM;MACNC,UAAU;MACVX;IACF,CAAC,GAAAS,KAAA;IAAA,OAAK;AACZ;AACA,UAAUC,MAAM;AAChB,gBAAgBC,UAAU;AAC1B;AACA,cAAcX,KAAK,CAAC,CAAC,CAAC;AACtB,WAAW;EAAA,CACP,CAAC;EAEH,OAAO;AACT,uCAAuCT,IAAI;AAC3C,MAAMU,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AACpB,SAAS;AACT,CAAC;AAED,MAAMC,gBAAgB,GAAId,MAA8B,IAAK;EAC3D,MAAMe,cAAc,GAAGf,MAAM,CAACS,GAAG,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKpC,gBAAgB,CAACoC,MAAM,GAC7CpC,gBAAgB,GAChBA,gBAAgB,CAACqC,MAAM,CAAEH,QAAQ,IAC/BF,cAAc,CAACM,QAAQ,CAACJ,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BK,IAAI,EAAEL,QAAQ;IACdM,SAAS,EAAE;MACTC,KAAK,EAAE1C,YAAY,CAACmC,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SACEH,gBAAgB,EAChBnB,iBAAiB,EACjBV,WAAW,EACXc,gBAAgB,EAChBT,mBAAmB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oanda/labs-currency-power-balance-widget",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.151",
|
|
4
4
|
"description": "Labs Currency Power Balance Widget",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "OANDA",
|
|
13
13
|
"license": "UNLICENSED",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@oanda/labs-widget-common": "^1.0.
|
|
15
|
+
"@oanda/labs-widget-common": "^1.0.212",
|
|
16
16
|
"@oanda/mono-i18n": "10.0.1",
|
|
17
17
|
"echarts": "5.5.0",
|
|
18
18
|
"echarts-for-react": "3.0.2",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@graphql-codegen/cli": "5.0.0",
|
|
23
23
|
"@graphql-codegen/client-preset": "4.1.0"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "53a43d8d60d462d74949c32e30a75b09e86f659d"
|
|
26
26
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
chartDateFormat,
|
|
3
|
+
chartDateTimeFormat,
|
|
4
|
+
getChartDateAndTime,
|
|
5
|
+
} from '@oanda/labs-widget-common';
|
|
6
|
+
|
|
1
7
|
import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';
|
|
2
8
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
3
9
|
import {
|
|
@@ -7,21 +13,6 @@ import {
|
|
|
7
13
|
} from './constants';
|
|
8
14
|
import type { TooltipFormatterParams } from './types';
|
|
9
15
|
|
|
10
|
-
const getDateAndTime = (param: string) => {
|
|
11
|
-
const dateAndTime = param.split('T');
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
date: dateAndTime[0],
|
|
15
|
-
time: dateAndTime[1].substring(0, 5),
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const dateFormat = (date: string) =>
|
|
20
|
-
`${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;
|
|
21
|
-
|
|
22
|
-
const dateTimeFormat = ({ date, time }: { date: string; time: string }) =>
|
|
23
|
-
`${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;
|
|
24
|
-
|
|
25
16
|
const isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>
|
|
26
17
|
timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||
|
|
27
18
|
timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||
|
|
@@ -31,17 +22,17 @@ const xAxisLabelFormatter = (
|
|
|
31
22
|
label: string,
|
|
32
23
|
timeUnit: CurrencyPowerBalanceTimeUnit
|
|
33
24
|
) => {
|
|
34
|
-
const { date, time } =
|
|
25
|
+
const { date, time } = getChartDateAndTime(label);
|
|
35
26
|
const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';
|
|
36
27
|
|
|
37
|
-
return isDateFormat ?
|
|
28
|
+
return isDateFormat ? chartDateFormat(date) : time;
|
|
38
29
|
};
|
|
39
30
|
|
|
40
31
|
const intervalFormatter = (dataLength: number) =>
|
|
41
32
|
Math.round(dataLength / VERTICAL_LINE_COUNT);
|
|
42
33
|
|
|
43
34
|
const tooltipFormatter = (values: TooltipFormatterParams[]) => {
|
|
44
|
-
const date =
|
|
35
|
+
const date = chartDateTimeFormat(getChartDateAndTime(values[0].value[0]));
|
|
45
36
|
|
|
46
37
|
const row = values
|
|
47
38
|
.sort(
|