-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathchart.html
More file actions
815 lines (757 loc) · 48 KB
/
Copy pathchart.html
File metadata and controls
815 lines (757 loc) · 48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="https://wichart.vn/favicon.svg" />
<script src="highchart.11.1.js"></script>
<script>(function(a){"object"===typeof module&&module.exports?(a["default"]=a,module.exports=a):"function"===typeof define&&define.amd?define("highcharts/modules/mouse-wheel-zoom",["highcharts"],function(e){a(e);a.Highcharts=e;return a}):a("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(a){function e(a,g,e,n){a.hasOwnProperty(g)||(a[g]=n.apply(null,e),"function"===typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:g,module:a[g]}})))}
a=a?a._modules:{};e(a,"Extensions/MouseWheelZoom/MouseWheelZoom.js",[a["Core/Utilities.js"]],function(a){function g(){const b=this,x=t(b.options.chart.zooming.mouseWheel);x.enabled&&e(this.container,"wheel",a=>{a=this.pointer.normalize(a);if(b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)){const f=u(x.sensitivity,1.1);C(b,Math.pow(f,a.detail||(a.deltaY||0)/120),b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY),a.chartX,a.chartY,x)}a.preventDefault&&a.preventDefault()})}const {addEvent:e,
isObject:n,pick:u,defined:f,merge:z}=a,A=[],B={enabled:!0,sensitivity:1.1},t=b=>n(b)?z(B,b):z(B,{enabled:f(b)?b:!0}),D=function(b,a){b.x+b.width>a.x+a.width&&(b.width>a.width?(b.width=a.width,b.x=a.x):b.x=a.x+a.width-b.width);b.width>a.width&&(b.width=a.width);b.x<a.x&&(b.x=a.x);b.y+b.height>a.y+a.height&&(b.height>a.height?(b.height=a.height,b.y=a.y):b.y=a.y+a.height-b.height);b.height>a.height&&(b.height=a.height);b.y<a.y&&(b.y=a.y);return b};let y,r;const C=function(a,e,g,v,d,h,w){const b=a.xAxis[0],
c=a.yAxis[0];var p=u(w.type,a.options.chart.zooming.type,"x");w=/x/.test(p);p=/y/.test(p);if(f(b.max)&&f(b.min)&&f(c.max)&&f(c.min)&&f(b.dataMax)&&f(b.dataMin)&&f(c.dataMax)&&f(c.dataMin)){if(p){f(y)&&clearTimeout(y);const {startOnTick:a,endOnTick:b}=c.options;r||(r={startOnTick:a,endOnTick:b});(a||b)&&c.setOptions({startOnTick:!1,endOnTick:!1});y=setTimeout(()=>{if(r){c.setOptions(r);const {min:a,max:b}=c.getExtremes();c.forceRedraw=!0;c.setExtremes(a,b);r=void 0}},400)}if(a.inverted){var q=c.pos+
c.len;g=b.toValue(h);v=c.toValue(d);var k=d;d=h;h=q-k+c.pos}d=d?(d-b.pos)/b.len:.5;if(b.reversed&&!a.inverted||a.inverted&&!b.reversed)d=1-d;h=1-(h?(h-c.pos)/c.len:.5);c.reversed&&(h=1-h);q=b.max-b.min;g=u(g,b.min+q/2);q*=e;k=c.max-c.min;v=u(v,c.min+k/2);const t=k*e;var l=b.dataMax-b.dataMin,m=c.dataMax-c.dataMin;k=b.dataMin-l*b.options.minPadding;l=l+l*b.options.minPadding+l*b.options.maxPadding;const n=c.dataMin-m*c.options.minPadding;m=m+m*c.options.minPadding+m*c.options.maxPadding;d=D({x:g-q*
d,y:v-t*h,width:q,height:t},{x:k,y:n,width:l,height:m});h=d.x<=k&&d.width>=l&&d.y<=n&&d.height>=m;f(e)&&!h?(w&&b.setExtremes(d.x,d.x+d.width,!1),p&&c.setExtremes(d.y,d.y+d.height,!1)):(w&&b.setExtremes(void 0,void 0,!1),p&&c.setExtremes(void 0,void 0,!1));a.redraw(!1)}};"";return{compose:function(a){-1===A.indexOf(a)&&(A.push(a),e(a,"afterGetContainer",g))}}});e(a,"masters/modules/mouse-wheel-zoom.src.js",[a["Core/Globals.js"],a["Extensions/MouseWheelZoom/MouseWheelZoom.js"]],function(a,e){e.compose(a.Chart)})});
</script>
<script>
const wicode=[{keyWord:"Tăng trưởng kinh tế",name:"gdp",className:"wi-g_d_p",type:"vi_mo_tien_te"},{keyWord:"GDP bình quân",name:"gdpbinhquan",className:"wi-g_d_p_binh_quan",type:"vi_mo_tien_te"},{keyWord:"Thu nhập bình quân",name:"gdpbinhquan",className:"wi-g_d_p_binh_quan",type:"vi_mo_tien_te"},{keyWord:"GDP",name:"gdp",className:"wi-g_d_p",type:"vi_mo_tien_te"},{keyWord:"Chỉ số giá tiêu dùng",name:"cpi",className:"wi-c_p_i",type:"vi_mo_tien_te"},{keyWord:"CPI",name:"cpi",className:"wi-c_p_i",type:"vi_mo_tien_te"},{keyWord:"Lạm phát",name:"cpi",className:"wi-c_p_i",type:"vi_mo_tien_te"},{keyWord:"Tổng mức bán lẻ hàng hóa và dịch vụ",name:"hhdv",className:"wi-h_h_d_v",type:"vi_mo_tien_te"},{keyWord:"Doanh thu bán lẻ hàng hóa và dịch vụ",name:"hhdv",className:"wi-h_h_d_v",type:"vi_mo_tien_te"},{keyWord:"Bán lẻ hàng hóa và dịch vụ",name:"hhdv",className:"wi-h_h_d_v",type:"vi_mo_tien_te"},{keyWord:"Vốn đầu tư phát triển xã hội",name:"vdtptxh",className:"wi-v_d_t_ptxh",type:"vi_mo_tien_te"},{keyWord:"Vốn đầu tư từ NSNN",name:"vdtnsnn",className:"wi-v_d_t_nsnn",type:"vi_mo_tien_te"},{keyWord:"Vốn đầu tư từ ngân sách nhà nước",name:"vdtnsnn",className:"wi-v_d_t_nsnn",type:"vi_mo_tien_te"},{keyWord:"Vốn đầu tư công",name:"vdtnsnn",className:"wi-v_d_t_nsnn",type:"vi_mo_tien_te"},{keyWord:"Chỉ số sản xuất công nghiệp",name:"iip",className:"wi-i_i_p",type:"vi_mo_tien_te"},{keyWord:"IIP",name:"iip",className:"wi-i_i_p",type:"vi_mo_tien_te"},{keyWord:"PMI",name:"pmi",className:"wi-p_m_i",type:"vi_mo_tien_te"},{keyWord:"Purchasing Managers Index",name:"pmi",className:"wi-p_m_i",type:"vi_mo_tien_te"},{keyWord:"Chỉ số quản lý thu mua",name:"pmi",className:"wi-p_m_i",type:"vi_mo_tien_te"},{keyWord:"FDI",name:"fdi",className:"wi-f_d_i",type:"vi_mo_tien_te"},{keyWord:"Vốn đầu tư trực tiếp nước ngoài",name:"fdi",className:"wi-f_d_i",type:"vi_mo_tien_te"},{keyWord:"Cán cân thương mại",name:"cctm",className:"wi-c_c_t_m",type:"vi_mo_tien_te"},{keyWord:"Nhập khẩu",name:"cctm",className:"wi-c_c_t_m",type:"vi_mo_tien_te"},{keyWord:"Xuất khẩu",name:"cctm",className:"wi-c_c_t_m",type:"vi_mo_tien_te"},{keyWord:"Vận chuyển hàng hóa",name:"vt",className:"wi-v_t",type:"vi_mo_tien_te"},{keyWord:"Vận chuyển hành khách",name:"vt",className:"wi-v_t",type:"vi_mo_tien_te"},{keyWord:"Khách quốc tế",name:"kqt",className:"wi-k_q_t",type:"vi_mo_tien_te"},{keyWord:"M2",name:"ctt",className:"wi-c_t_t",type:"vi_mo_tien_te"},{keyWord:"Cung tiền tệ",name:"ctt",className:"wi-c_t_t",type:"vi_mo_tien_te"},{keyWord:"Tổng huy động vốn trong nền kinh tế",name:"hd",className:"wi-h_d",type:"vi_mo_tien_te"},{keyWord:"Tổng tiền gửi trong nền kinh tế",name:"hd",className:"wi-h_d",type:"vi_mo_tien_te"},{keyWord:"Tổng tín dụng trong nền kinh tế",name:"td",className:"wi-t_d",type:"vi_mo_tien_te"},{keyWord:"Tín phiếu kho bạc",name:"tpkb",className:"wi-t_p_k_b",type:"vi_mo_tien_te"},{keyWord:"SBV - Bills",name:"tpkb",className:"wi-t_p_k_b",type:"vi_mo_tien_te"},{keyWord:"Treasury bills",name:"tpkb",className:"wi-t_p_k_b",type:"vi_mo_tien_te"},{keyWord:"Bills",name:"tpkb",className:"wi-t_p_k_b",type:"vi_mo_tien_te"},{keyWord:"OMO",name:"nvttm",className:"wi-n_v_t_t_t",type:"vi_mo_tien_te"},{keyWord:"Nghiệp vụ thị trường mở",name:"nvttm",className:"wi-n_v_t_t_t",type:"vi_mo_tien_te"},{keyWord:"Open Market Operations",name:"nvttm",className:"wi-n_v_t_t_t",type:"vi_mo_tien_te"},{keyWord:"Lãi suất liên ngân hàng",name:"lslnh",className:"wi-l_s_l_n_h",type:"vi_mo_tien_te"},{keyWord:"Lãi suất chiết khấu",name:"lsdh",className:"wi-l_s_d_h",type:"vi_mo_tien_te"},{keyWord:"Lãi suất tái cấp vốn",name:"lsdh",className:"wi-l_s_d_h",type:"vi_mo_tien_te"},{keyWord:"LS qua đêm cho vay bù đắp thiếu hụt vốn",name:"lsdh",className:"wi-l_s_d_h",type:"vi_mo_tien_te"},{keyWord:"Lãi suất điều hành",name:"lsdh",className:"wi-l_s_d_h",type:"vi_mo_tien_te"},{keyWord:"Lãi suất chính sách",name:"lsdh",className:"wi-l_s_d_h",type:"vi_mo_tien_te"},{keyWord:"Lãi suất huy động",name:"lshd",className:"wi-l_s_h_d",type:"vi_mo_tien_te"},{keyWord:"Tỷ giá trung tâm",name:"dhtg",className:"wi-d_h_t_g",type:"vi_mo_tien_te"},{keyWord:"Tỷ giá trần",name:"dhtg",className:"wi-d_h_t_g",type:"vi_mo_tien_te"},{keyWord:"Tỷ giá sàn",name:"dhtg",className:"wi-d_h_t_g",type:"vi_mo_tien_te"},{keyWord:"Điều hành tỷ giá",name:"dhtg",className:"wi-d_h_t_g",type:"vi_mo_tien_te"},{keyWord:"Dự trữ ngoại hối nhà nước",name:"dtnh",className:"wi-d_t_n_h",type:"vi_mo_tien_te"},{keyWord:"Dự trữ ngoại hối",name:"dtnh",className:"wi-d_t_n_h",type:"vi_mo_tien_te"},{keyWord:"Cán cân thanh toán",name:"cctt",className:"wi-c_c_t_t",type:"vi_mo_tien_te"},{keyWord:"BOP",name:"cctt",className:"wi-c_c_t_t",type:"vi_mo_tien_te"},{keyWord:"Balance of Payment",name:"cctt",className:"wi-c_c_t_t",type:"vi_mo_tien_te"},{keyWord:"Thu ngân sách",name:"tcns",className:"wi-t_c_n_s",type:"vi_mo_tien_te"},{keyWord:"Bội chi ngân sách",name:"tcns",className:"wi-t_c_n_s",type:"vi_mo_tien_te"},{keyWord:"Chi ngân sách",name:"tcns",className:"wi-t_c_n_s",type:"vi_mo_tien_te"},{keyWord:"Ngân sách nhà nước",name:"tcns",className:"wi-t_c_n_s",type:"vi_mo_tien_te"},{keyWord:"Nợ chính phủ",name:"ncp",className:"wi-n_c_p",type:"vi_mo_tien_te"},{keyWord:"Nợ công",name:"ncp",className:"wi-n_c_p",type:"vi_mo_tien_te"},{keyWord:"Nợ quốc gia",name:"ncp",className:"wi-n_c_p",type:"vi_mo_tien_te"},{keyWord:"Dân số",name:"ds",className:"wi-d_s",type:"vi_mo_tien_te"},{keyWord:"Lực lượng lao động",name:"ld",className:"wi-l_d",type:"vi_mo_tien_te"},{keyWord:"Lao động",name:"ld",className:"wi-l_d",type:"vi_mo_tien_te"},{keyWord:"Thất nghiệp",name:"tn",className:"wi-t_n",type:"vi_mo_tien_te"},{keyWord:"Xi măng Trung Quốc",name:"xi_mang",className:"wi-x_m",type:"vi_mo_hang_hoa"},{keyWord:"Xi măng",name:"xi_mang_pcb",className:"wi-xi_mang_pcb",type:"vi_mo_hang_hoa"},{keyWord:"Giá vàng",name:"vang",className:"wi-vang",type:"vi_mo_hang_hoa"},{keyWord:"Giá điện",name:"dien",className:"wi-dien",type:"vi_mo_hang_hoa"},{keyWord:"Heo hơi",name:"heo_hoi",className:"wi-heo_hoi",type:"vi_mo_hang_hoa"},{keyWord:"Xăng dầu",name:"xang_dau",className:"wi-xang_dau",type:"vi_mo_hang_hoa"},{keyWord:"Cà phê",name:"ca_phe",className:"wi-ca_phe",type:"vi_mo_hang_hoa"},{keyWord:"Cá tra",name:"ca_tra",className:"wi-ca_tra",type:"vi_mo_hang_hoa"},{keyWord:"Giá tiêu",name:"tieu",className:"wi-tieu",type:"vi_mo_hang_hoa"},{keyWord:"Giá thép",name:"thep",className:"wi-thep",type:"vi_mo_hang_hoa"},{keyWord:"Phân Ure",name:"phan_ure",className:"wi-phan_ure",type:"vi_mo_hang_hoa"},{keyWord:"Phốt pho",name:"phot_pho",className:"wi-phot_pho",type:"vi_mo_hang_hoa"},{keyWord:"Lưu huỳnh",name:"luu_huynh",className:"wi-luu_huynh",type:"vi_mo_hang_hoa"},{keyWord:"Giá niken",name:"niken",className:"wi-niken",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng Việt Nam",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng Trung Quốc",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng thế giới",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng tăng",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng giảm",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng vượt",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng đạt",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng cao",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng thấp",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng trên",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá đồng biến động",name:"dong",className:"wi-dong",type:"vi_mo_hang_hoa"},{keyWord:"Giá nhôm",name:"nhom",className:"wi-nhom",type:"vi_mo_hang_hoa"},{keyWord:"Giá kẽm",name:"kem",className:"wi-kem",type:"vi_mo_hang_hoa"},{keyWord:"Giá thiếc",name:"thiec",className:"wi-thiec",type:"vi_mo_hang_hoa"},{keyWord:"Giá chì",name:"chi",className:"wi-chi",type:"vi_mo_hang_hoa"},{keyWord:"Than cốc",name:"than_coc",className:"wi-than_coc",type:"vi_mo_hang_hoa"},{keyWord:"Quặng sắt",name:"quang_sat",className:"wi-quang_sat",type:"vi_mo_hang_hoa"},{keyWord:"Sợi coton",name:"soi_coton",className:"wi-soi_coton",type:"vi_mo_hang_hoa"},{keyWord:"Vải coton",name:"vai_coton",className:"wi-vai_coton",type:"vi_mo_hang_hoa"},{keyWord:"Bột giấy",name:"bot_giay",className:"wi-bot_giay",type:"vi_mo_hang_hoa"},{keyWord:"Lợn hơi Trung Quốc",name:"lon_hoi_trung_quoc",className:"wi-lon_hoi_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Dầu cọ",name:"dau_co_malaysia",className:"wi-dau_co_malaysia",type:"vi_mo_hang_hoa"},{keyWord:"Giấy gợn sóng",name:"giay_gon_song_trung_quoc",className:"wi-giay_gon_song_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Đậu nành Mỹ",name:"dau_nanh_my",className:"wi-dau_nanh_my",type:"vi_mo_hang_hoa"},{keyWord:"Nhựa đường",name:"nhua_duong_60_70",className:"wi-nhua_duong_60_70",type:"vi_mo_hang_hoa"},{keyWord:"Giá đường",name:"duong",className:"wi-duong",type:"vi_mo_hang_hoa"},{keyWord:"Vải cotton Mỹ",name:"vai_cotton_my",className:"wi-vai_cotton_my",type:"vi_mo_hang_hoa"},{keyWord:"Gạo TPXK",name:"gao_tpxk",className:"wi-gao_tpxk",type:"vi_mo_hang_hoa"},{keyWord:"Tôm sú",name:"tom_su",className:"wi-tom_su",type:"vi_mo_hang_hoa"},{keyWord:"Tôm thẻ",name:"tom_the",className:"wi-tom_the",type:"vi_mo_hang_hoa"},{keyWord:"Phụ phẩm lúa gạo",name:"phu_pham_lua_gao",className:"wi-phu_pham_lua_gao",type:"vi_mo_hang_hoa"},{keyWord:"Lúa",name:"lua",className:"wi-lua",type:"vi_mo_hang_hoa"},{keyWord:"Gạo nguyên liệu",name:"gao_nguyen_lieu",className:"wi-gao_nguyen_lieu",type:"vi_mo_hang_hoa"},{keyWord:"Giá bạc",name:"bac",className:"wi-bac",type:"vi_mo_hang_hoa"},{keyWord:"Ure Trung Đông",name:"ure_trung_dong",className:"wi-ure_trung_dong",type:"vi_mo_hang_hoa"},{keyWord:"Xút Trung Quốc",name:"xut_naoh_trung_quoc",className:"wi-xut_naoh_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Phân DAP Trung Quốc",name:"phan_dap_trung_quoc",className:"wi-phan_dap_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Phân Urea Trung Quốc",name:"phan_urea_trung_quoc",className:"wi-phan_urea_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Thép dây Trung Quốc",name:"thep_day_trung_quoc",className:"wi-thep_day_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Thép thanh Trung Quốc",name:"thep_thanh_trung_quoc",className:"wi-thep_thanh_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Thép phế Anh",name:"thep_phe_anh",className:"wi-thep_phe_anh",type:"vi_mo_hang_hoa"},{keyWord:"Thép thanh Anh",name:"thep_thanh_anh",className:"wi-thep_thanh_anh",type:"vi_mo_hang_hoa"},{keyWord:"HRC Trung Quốc",name:"hrc_trung_quoc",className:"wi-hrc_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Đá 0-4",name:"da_0_4",className:"wi-da_0_4",type:"vi_mo_hang_hoa"},{keyWord:"Đá mi sàng",name:"da_mi_sang",className:"wi-da_mi_sang",type:"vi_mo_hang_hoa"},{keyWord:"Đá 1x2",name:"da_1x2",className:"wi-da_1x2",type:"vi_mo_hang_hoa"},{keyWord:"Đá Hộc",name:"da_hoc",className:"wi-da_hoc",type:"vi_mo_hang_hoa"},{keyWord:"Tôn lạnh màu",name:"ton_lanh_mau_hoa_sen_045mm",className:"wi-ton_lanh_mau_hoa_sen_045mm",type:"vi_mo_hang_hoa"},{keyWord:"Tôn lạnh",name:"ton_lanh_hoa_sen_045mm",className:"wi-ton_lanh_hoa_sen_045mm",type:"vi_mo_hang_hoa"},{keyWord:"Bê tông nhựa mịn",name:"be_tong_nhua_min",className:"wi-be_tong_nhua_min",type:"vi_mo_hang_hoa"},{keyWord:"Ống nhựa 27 x 1.8mm",name:"ong_nhua_27x18mm",className:"wi-ong_nhua_27x18mm",type:"vi_mo_hang_hoa"},{keyWord:"Ống nhựa 60 x 2mm",name:"ong_nhua_60x2mm",className:"wi-ong_nhua_60x2mm",type:"vi_mo_hang_hoa"},{keyWord:"Ống nhựa 90 x 2,9mm",name:"ong_nhua_90x29mm",className:"wi-ong_nhua_90x29mm",type:"vi_mo_hang_hoa"},{keyWord:"Sơn lót kháng kiềm",name:"son_lot_khang_kiem_cao_cap",className:"wi-son_lot_khang_kiem_cao_cap",type:"vi_mo_hang_hoa"},{keyWord:"Sơn nội thất",name:"son_noi_that_tieu_chuan",className:"wi-son_noi_that_tieu_chuan",type:"vi_mo_hang_hoa"},{keyWord:"Sơn ngoại thất",name:"son_ngoai_that_tieu_chuan",className:"wi-son_ngoai_that_tieu_chuan",type:"vi_mo_hang_hoa"},{keyWord:"Kính màu trắng cường lực",name:"kinh_mau_trang",className:"wi-kinh_mau_trang",type:"vi_mo_hang_hoa"},{keyWord:"Kính Solar control cường lực",name:"kinh_solar",className:"wi-kinh_solar",type:"vi_mo_hang_hoa"},{keyWord:"Dây cáp điện",name:"day_cap_dien",className:"wi-day_cap_dien",type:"vi_mo_hang_hoa"},{keyWord:"Gạch đất sét nung",name:"gach_dat_set_nung",className:"wi-gach_dat_set_nung",type:"vi_mo_hang_hoa"},{keyWord:"Cọc bê tông",name:"coc_be_tong_du_ung_luc",className:"wi-coc_be_tong_du_ung_luc",type:"vi_mo_hang_hoa"},{keyWord:"Bê tông",name:"be_tong_mac_300",className:"wi-be_tong_mac_300",type:"vi_mo_hang_hoa"},{keyWord:"Khí LPG Trung Quốc",name:"khi_lpg_trung_quoc",className:"wi-khi_lpg_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Dầu WTI",name:"dau_wti",className:"wi-dau_wti",type:"vi_mo_hang_hoa"},{keyWord:"Khí thiên nhiên",name:"khi_thien_nhien",className:"wi-khi_thien_nhien",type:"vi_mo_hang_hoa"},{keyWord:"Than Newcastle",name:"than_newcastle",className:"wi-than_newcastle",type:"vi_mo_hang_hoa"},{keyWord:"Mazút",name:"mazut",className:"wi-mazut",type:"vi_mo_hang_hoa"},{keyWord:"Cao su thế giới",name:"cao_su_nhat_ban",className:"wi-cao_su_nhat_ban",type:"vi_mo_hang_hoa"},{keyWord:"Cao su",name:"cao_su",className:"wi-cao_su",type:"vi_mo_hang_hoa"},{keyWord:"Hạt PET",name:"pet_trung_quoc",className:"wi-pet_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Hạt nhựa PVC Trung Quốc",name:"nhua_pvc_trung_quoc",className:"wi-nhua_pvc_trung_quoc",type:"vi_mo_hang_hoa"},{keyWord:"Hạt nhựa PP Trung Quốc",name:"nhua_pp_trung_quoc",className:"wi-nhua_pp_trung_quoc",type:"vi_mo_hang_hoa"},
// investing
{keyWord:"CK Nhật Bản - Nikkei 225",name:"ni255",className:"178",type:"investing"},{keyWord:"CK Trung Quốc - Shanghai Composite (SSEC)",name:"shanghai",className:"40820",type:"investing"},{keyWord:"CK Mỹ - S&P 500",name:"dow_jone_sp500",className:"166",type:"investing"},{keyWord:"Chỉ số Dow Jones Industrial Average (DJI)",name:"dow_jone",className:"169",type:"investing"},{keyWord:"Chỉ số NASDAQ Composite (IXIC)",name:"nasdaq-composite",className:"14958",type:"investing"},{keyWord:"FTSE 100",name:"ftse100",className:"27",type:"investing"},{keyWord:"Hang Seng Index - CK Hồng Kông",name:"hangseng_hsi",className:"179",type:"investing"},{keyWord:"CK Việt Nam - VNINDEX",name:"vnindex",className:"41063",type:"investing"},{keyWord:"Dollar Index - DXY",name:"dxy",className:"942611",type:"investing"},{keyWord:"Lãi suất TPCP Mỹ - 10 năm (%)",name:"us_bond_10y_investing",className:"23705",type:"investing"},{keyWord:"Lãi suất TPCP Mỹ - 1 năm (%) ",name:"us_bond_1y_investing",className:"23700",type:"investing"},{keyWord:"Lãi suất TPCP Việt Nam - 10 năm (%)",name:"vietnam_bond_10y_investing",className:"29379",type:"investing"},{keyWord:"Lãi suất TPCP Việt Nam - 1 năm (%)",name:"vietnam_bond_1y",className:"29380",type:"investing"},{keyWord:"Bảng cân đối kế toán của Fed (Bil USD)",name:"fed-ballance-sheet",className:"2145.json",type:"investing"},{keyWord:"Lãi suất quỹ liên bang của Fed (%)",name:"fed-funds-rate",className:"168.json",type:"investing"},{keyWord:"Fed Funds Composite Interest Rate (%)",name:"fed-funds-composite-interest-rate",className:"985525",type:"investing"},{keyWord:"Chỉ số CPI Mỹ (%YoY)",name:"usa_cpi",className:"733.json",type:"investing"},{keyWord:"Chỉ số CPI Mỹ (%MoM)",name:"usa_cpi_mom",className:"69.json",type:"investing"},{keyWord:"Chỉ số CPI lõi Mỹ (%YoY)",name:"usa_cpi_core",className:"736.json",type:"investing"},{keyWord:"Chỉ số PCE Lõi Mỹ (%YoY)",name:"usa_pce_core",className:"905.json",type:"investing"},{keyWord:"Chỉ số PCE Lõi Mỹ (%MoM)",name:"usa_pce_month",className:"61.json",type:"investing"},{keyWord:"Tỷ lệ thất nghiệp Mỹ (%)",name:"unemployment_rate_cpi",className:"300.json",type:"investing"},{keyWord:"Chỉ số Thị Trường Nhà ở của NAHB - Mỹ",name:"nahb-housing-market-index",className:"218.json",type:"investing"},{keyWord:"S&P/Case-Shiller House Price Index (%YoY)",name:"case-shiller-house-price-index-yoy",className:"329.json",type:"investing"},{keyWord:"S&P/Case-Shiller House Price Index (%MoM)",name:"case-shiller-house-price-index-mom",className:"913.json",type:"investing"},{keyWord:"30 Year US mortgage rate (%)",name:"mba-30-year-mortgage-rate",className:"1042.json",type:"investing"},{keyWord:"USA Retail Inventories Excluding Auto (%)",name:"retail-inventories-ex-auto-1887",className:"1887.json",type:"investing"},{keyWord:"Eurozone Interest Rate (%)",name:"eurozone-interest-rate-decision",className:"164.json",type:"investing"},{keyWord:"Chỉ số CPI - Trung Quốc (%YoY)",name:"chinese-cpi",className:"459.json",type:"investing"},{keyWord:"Chỉ số IIP - Trung Quốc (%YoY)",name:"chinese-industrial-production",className:"462.json",type:"investing"},{keyWord:"Lãi suất cho vay cơ bản - Trung Quốc (%)",name:"pboc-loan-prime-rate",className:"1967.json",type:"investing"},{keyWord:"Bitcoin US Dollar - BTCUSD",name:"btcusd",className:"945629",type:"investing"},{keyWord:"CBOE Volatility Index (VIX)",name:"volatility-sp500-vix-cboe",className:"44336",type:"investing"},{keyWord:"US Dollar Vietnamese Dong - USDVND",name:"usdvnd",className:"2214",type:"investing"},{keyWord:"US Dollar Japanese Yen - USDJPY",name:"usdjpy",className:"3",type:"investing"},{keyWord:"US Dollar British Pound - USDGPB",name:"usdgbp",className:"2126",type:"investing"},{keyWord:"US Dollar Swiss Franc - USDCHF",name:"usdchf",className:"4",type:"investing"},{keyWord:"US Dollar Canadian Dollar - USDCAD",name:"usdcad",className:"7",type:"investing"},{keyWord:"Astradian Dollar US Dollar - AUDUSD",name:"audusd",className:"5",type:"investing"},{keyWord:"New Zealand Dollar US Dollar - NZDUSD",name:"nzdusd",className:"5",type:"investing"},{keyWord:"US Dollar Chinese Yuan - USDCNY",name:"usdcny",className:"2111",type:"investing"},{keyWord:"Giá dầu Crude Oil WTI Futures (USD)",name:"crude-oil",className:"8849",type:"investing"},{keyWord:"Giá dầu Brent Oil Futures (USD)",name:"LCOc1",className:"8833",type:"investing"},{keyWord:"Cao su - Tocom (CNY)",name:"JRUc1",className:"1013463",type:"investing"},{keyWord:"Cao su RSS3",name:"SRUc1",className:"1013411",type:"investing"},{keyWord:"Cao su TSR20",name:"STFc1",className:"1013412",type:"investing"},{keyWord:"Giá vàng - Gold Futures",name:"gold_future",className:"8830",type:"investing"},{keyWord:"Giá khí thiên nhiên - Natural Gas Futures",name:"natural_gas",className:"8862",type:"investing"},{keyWord:"Giá thép thanh - Steel Rebar Futures",name:"steel_rebar",className:"996702",type:"investing"},{keyWord:"Giá đường mỹ - US Sugar #11 Futures",name:"SBc1",className:"8869",type:"investing"},{keyWord:"Giá Sợi - US Cotton #2 Futures",name:"CTc1",className:"8851",type:"investing"},{keyWord:"Hợp đồng Tương lai nhựa Polyvinyl Clorua - DPVc1 (CNY)",name:"Polyvinyl_Clorua_DPVc1",className:"961746",type:"investing"},{keyWord:"Hợp đồng Tương lai nhựa Polyêtylen - DLLc1 (CNY)",name:"nhua_lldpe",className:"961744",type:"investing"},{keyWord:"Chỉ số vận tải Baltic Dry Index",name:"baltic_dry",className:"940793",type:"investing"},{keyWord:"Giá Baltic Clean Tanker (USD)",name:"baltic-clean-tanker",className:"940799",type:"investing"}];
</script>
<title>Lạm phát (Inflation)</title>
<style>
body {
font-family: Inter, Nunito Sans, Lexend, Noto Sans, sans-serif;
font-size: 14px;
background:#f7f7f7;
}
.container {
display: flex;
flex-wrap: wrap;
}
.existing-div {
flex: 1;
padding: 4px;
}
@media (max-width: 768px) {
.new-div {
width: 100%;
}
}
.tabs {
width: 300px;
background-color: #F8FAFD;
padding: 10px;
height: 500px;
overflow: hidden;
border-radius: 4px;
}
.tab {
padding: 10px;
margin: 5px 0;
background-color: white;
cursor: pointer;
text-align: center;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 0 grey;
border-radius: 1px;
}
::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 10px
}
::-webkit-scrollbar {
width: 5px;
height: 5px;
background: transparent;
}
.tabGroup {
display: flex;
margin-bottom: 10px;
}
.tab-g {
padding: 10px 20px;
cursor: pointer;
border: 1px solid #ccc;
border-bottom: none;
}
.tab-g.active {
background-color: #007bff;
color: white;
}
.search-bar {
margin-bottom: 10px;
display: flex;
}
.filter-list {
list-style: none;
padding: 0;
height: 400px;
overflow: scroll;
}
input {
font: inherit;
letter-spacing: inherit;
color: currentcolor;
box-sizing: content-box;
height: 1.4375em;
margin: 0px;
-webkit-tap-highlight-color: transparent;
display: block;
min-width: 0px;
width: 100%;
animation-name: mui-auto-fill-cancel;
animation-duration: 10ms;
}
.filter-item {
display: flex;
justify-content: space-between;
padding: 10px;
border-bottom: 1px solid #ccc;
margin-bottom: 5px;
text-align: left;
}
.svg {
width: 20px;
position: relative;
}
.loading-container {
position: fixed;
height: 100%;
width: 100%;
top: 0;
left: 0;
z-index: 100000;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, .05);
}
.loading-container .lds-roller {
display: inline-block;
position: relative;
width: 64px;
height: 64px
}
.loading-container .lds-roller div {
-webkit-animation: lds-roller 1.2s cubic-bezier(.5, 0, .5, 1) infinite;
animation: lds-roller 1.2s cubic-bezier(.5, 0, .5, 1) infinite;
-webkit-transform-origin: 32px 32px;
transform-origin: 32px 32px
}
.loading-container .lds-roller div:after {
content: " ";
display: block;
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
background: #ff0;
margin: -3px 0 0 -3px
}
.loading-container .lds-roller div:first-child {
-webkit-animation-delay: -36ms;
animation-delay: -36ms
}
.loading-container .lds-roller div:first-child:after {
top: 50px;
left: 50px
}
.loading-container .lds-roller div:nth-child(2) {
-webkit-animation-delay: -72ms;
animation-delay: -72ms
}
.loading-container .lds-roller div:nth-child(2):after {
top: 54px;
left: 45px
}
.loading-container .lds-roller div:nth-child(3) {
-webkit-animation-delay: -.108s;
animation-delay: -.108s
}
.loading-container .lds-roller div:nth-child(3):after {
top: 57px;
left: 39px
}
.loading-container .lds-roller div:nth-child(4) {
-webkit-animation-delay: -.144s;
animation-delay: -.144s
}
.loading-container .lds-roller div:nth-child(4):after {
top: 58px;
left: 32px
}
.loading-container .lds-roller div:nth-child(5) {
-webkit-animation-delay: -.18s;
animation-delay: -.18s
}
.loading-container .lds-roller div:nth-child(5):after {
top: 57px;
left: 25px
}
.loading-container .lds-roller div:nth-child(6) {
-webkit-animation-delay: -.216s;
animation-delay: -.216s
}
.loading-container .lds-roller div:nth-child(6):after {
top: 54px;
left: 19px
}
.loading-container .lds-roller div:nth-child(7) {
-webkit-animation-delay: -.252s;
animation-delay: -.252s
}
.loading-container .lds-roller div:nth-child(7):after {
top: 50px;
left: 14px
}
.loading-container .lds-roller div:nth-child(8) {
-webkit-animation-delay: -.288s;
animation-delay: -.288s
}
.loading-container .lds-roller div:nth-child(8):after {
top: 45px;
left: 10px
}
@-webkit-keyframes lds-roller {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
to {
-webkit-transform: rotate(1turn);
transform: rotate(1turn)
}
}
@keyframes lds-roller {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg)
}
to {
-webkit-transform: rotate(1turn);
transform: rotate(1turn)
}
}
</style>
</head>
<body>
<div class="container">
<div class="existing-div" id="myChart" style="min-height:400px" orientation="portrait"></div>
<div class="tabs">
<div class="tabGroup">
<div class="tab-g active" onclick="selectTab('vi_mo_tien_te')">Vĩ mô</div>
<div class="tab-g" onclick="selectTab('vi_mo_hang_hoa')">Hàng hóa</div>
<div class="tab-g" onclick="selectTab('investing')">Investing</div>
</div>
<div class="search-bar">
<svg class="svg" focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="SearchIcon">
<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
</svg>
<input autocomplete="off" type="text" style="" placeholder="Tìm kiếm bộ lọc" id="searchInput" onkeyup="filterList()">
</div>
<ul class="filter-list" id="filterList"></ul>
</div>
</div>
<script>
let lastTab ='';
function selectTab(tabName) {
const tabs = document.querySelectorAll('.tab-g');
tabs.forEach(tab => {
tab.classList.remove('active');
});
document.querySelector(`.tab-g[onclick="selectTab('${tabName}')"]`).classList.add('active');
creatList(tabName);
}
function filterList() {
const input = document.getElementById('searchInput');
const filter = input.value.toLowerCase();
const ul = document.getElementById('filterList');
const li = ul.getElementsByTagName('li');
for (let i = 0; i < li.length; i++) {
const item = li[i].textContent || li[i].innerText;
if (item.toLowerCase().indexOf(filter) > -1) {
li[i].style.display = '';
} else {
li[i].style.display = 'none';
}
}
}
const loading = `<div class="loading-container"><div class="lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>`;
document.querySelector('.existing-div').innerHTML = loading;
creatList('vi_mo_tien_te');
function creatList(typeList) {
let vimo = document.getElementById("filterList");
vimo.innerHTML = "";
for (var i = 0; i < wicode.length; i++) {
let a = `<li class="tab filter-item" onclick="fetchData('${wicode[i].name}')">${wicode[i].keyWord}</li>`
if (wicode[i].type == typeList) {
vimo.innerHTML += a
}
}
}
function checkDevice() {
const userAgent = navigator.userAgent.toLowerCase();
const isMobile = /iphone|ipod|android|blackberry|mini|windows\sce|palm/i.test(userAgent);
const isTablet = /ipad|android|tablet/i.test(userAgent);
const isDesktop = !isMobile && !isTablet;
if (isMobile || window.innerWidth <= 768) {
document.querySelector('.tabs').style.width = '100%';
document.querySelector('.tabs').style.height = '500px';
} else {
document.querySelector('.tabs').style.width = '300px';
document.querySelector('.tabs').style.height = '500px';
}
}
window.addEventListener('resize', checkDevice);
window.addEventListener('load', checkDevice);
</script>
<script>
if (typeof Highcharts === "undefined") {
throw new Error("Highcharts.js is not defined");
}
// chèn dữ liệu ở đây
async function fetchData(url = 'lslnh') {
var index = wicode.findIndex(x => x.name === url);
if (index == -1){
url = 'lslnh';
}else if(wicode[index].type =='investing'){
investing(url)
return;
}
var apiUrl = "https://api.wichart.vn/vietnambiz/vi-mo?name=" + url;
if (index > -1 && wicode[index].type == "vi_mo_hang_hoa") apiUrl += "&key=hanghoa";
document.querySelector('.existing-div').innerHTML = loading;
try {
const response = await fetch(apiUrl);
if (!response.ok) {
throw new Error('Network response was not ok');
}
const widata = await response.json();
const dx = function(t) {
var e = new Date(t);
return e.getDate() + "/" + (e.getMonth() + 1) + "/" + e.getFullYear()
};
var arrayString = [],
i = 0,
date = [],
arrayFinal = [],
typechart, txt,
seriesName, ysix = [];
let y1 = {
title: {
text: widata.chart.series[0].unit
},
labels: {
style: {
color: Highcharts.getOptions().colors[0]
}
}
},
y2 = {
title: {
text: ''
},
labels: {
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: 1
},
typeChart = widata.chart.series[0].type,
numY = 0;
widata.chart.series.forEach(s => {
if (typeChart !== s.type) numY = 1, y2.title.text = s.unit
arrayFinal.push({
name: s.name,
data: s.data.sort(),
fillMissingValues: {
type: "previous"
},
unit: s.unit,
connectNulls: true,
type: (s.type == 'bar' ? 'column' : 'spline'),
yAxis: typeChart == s.type ? 0 : 1
});
});
var summaries = '<b>' + widata.timeUpdate + '</b> <br/>';
if (arrayFinal.length > 2) {
arrayFinal.forEach(s => {
let b = s.data.map(e => e[1]);
summaries += s.name + ' : ' + (b[b.length - 1] || b[b.length - 2] || b[b.length - 3]) + ' (' + s.unit + ')<br/>';
})
} else {
for (var i = 0; i < widata.titleIndex.length; i++) summaries += widata.titleIndex[i] + ' (' + widata.unitArray[i] + ')<br/>';
}
var config = {
chart: {
zoomType: "x",
type: "column",
height: "500px",
style: {
fontSize: "14px",
},
resetZoomButton: {
position: {
x: 0,
y: -40
},
theme: {
fill: "white",
style: {
fontSize: "14px"
},
stroke: "silver",
r: 0,
states: {
hover: {
fill: "#41739D",
style: {
color: "white"
}
}
}
}
}
},
xAxis: {
crosshair: 1,
type: "datetime",
labels: {
formatter: function() {
return Highcharts.dateFormat("%e/%m/%Y", this.value)
}
}
},
time: {
useUTC: !1,
timezone: "Asia/Ho_Chi_Minh"
},
title: {
text: widata.title,
floating: !1,
align: "center",
style: {
display: "block"
}
},
subtitle: {
text: summaries,
align: "left"
},
yAxis: numY ? [y1, y2] : [y1],
tooltip: {
headerFormat: "<b>{point.x:%d/%m/%Y}</b><br>",
pointFormat: "{series.name}: {point.y:.2f}<br>",
footerFormat: "</table>",
shared: !0,
useHTML: !0,
},
credits: {
enabled: 0,
},
exporting: {
enabled: 1
},
series: arrayFinal,
plotOptions: {
column: {
stacking: widata.stacked_column
},
line: {
dataLabels: {
enabled: 0
}
}
}
};
document.title = widata.title;
//ve bieu do
Highcharts.chart('myChart', config);
} catch (error) {
console.error('There has been a problem with your fetch operation:', error);
document.querySelector('.existing-div').innerHTML = '';
}
}
var dis_recession = function (chart) { // thêm suy thoái
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(1970, 1, 1),
to: Date.UTC(1970, 12, 1),
id: 'r'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(1973, 12, 1),
to: Date.UTC(1975, 4, 1),
id: 'r1'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(1980, 2, 1),
to: Date.UTC(1980, 8, 1),
id: 'r2'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(1981, 8, 1),
to: Date.UTC(1982, 12, 1),
id: 'r3'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(1990, 8, 1),
to: Date.UTC(1991, 4, 1),
id: 'r4'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(2001, 4, 1),
to: Date.UTC(2001, 12, 1),
id: 'r5'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(2008, 1, 1),
to: Date.UTC(2009, 7, 1),
id: 'r6'
});
}
if (chart.xAxis) {
chart.xAxis[0].addPlotBand({
color: '#F1F1F1',
from: Date.UTC(2020, 3, 1),
to: Date.UTC(2020, 5, 1),
id: 'r7'
});
}
}
function convertNumberToDate(t) {
const e = new Date(t);
return `${e.getDate()}/${e.getMonth()+1}/${e.getFullYear()}`
}
function fNumber(e) {
if (e === null || e === undefined || isNaN(e)) return "0"; // Xử lý null, undefined hoặc không phải số
if (e >= 1e6) {
return (e / 1e6)
.toFixed(2)
.replace(/\.?0+$/, "") + "M"; // Bỏ số 0 thừa sau dấu thập phân
} else {
return e.toFixed(2).replace(/\.?0+$/, ""); // Đảm bảo bỏ số 0 thừa cho số nhỏ hơn 1 triệu
}
}
function changePeriod(myChart) {
var initialMin = myChart.xAxis[0].min;
var initialMax = myChart.xAxis[0].max;
var series = myChart.series[0].data;
var last = series[series.length - 1];
var now = new Date();
var oneYearAgo = new Date(now.getFullYear() - 2, now.getMonth(), now.getDate());
var firsttime = oneYearAgo.getTime() < initialMin ? initialMin : oneYearAgo.getTime()
myChart.xAxis[0].setExtremes(firsttime, last[0]);
}
// Lấy dữ liệu từ investing
async function investing(ul) {
try {
document.querySelector('.existing-div').innerHTML = loading;
var i = wicode.findIndex(x => x.name === ul);
if (i == -1) i = 2;
const event = wicode[i].className.includes("json");
const url = event ? `https://sbcharts.investing.com/events_charts/us/${wicode[i].className}` : `https://api.investing.com/api/financialdata/${wicode[i].className}/historical/chart/?period=MAX&interval=P1D&pointscount=120`
var res = await fetch(url)
var data = await res.json();
var dulieutho = [];
for (var z = 0; z < data.data.length; z++) {
if (event) {
dulieutho.push({
date: data.data[z][0],
actual: data.data[z][1],
forecast: data.attr[z].forecast,
state: data.attr[z].actual_state,
format: data.attr[z].actual_formatted
});
}
}
var last = data.data[data.data.length - 1]
var last2 = data.data[data.data.length - 2]
var changp = last[event ? 1 : 4] - last2[event ? 1 : 4]
var changpe = 100 * last[event ? 1 : 4] / last2[event ? 1 : 4] - 100;
var config = {
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'],
chart: {
zoomType: "x",
type: "spline",
backgroundColor:'transparent',
chart: {
zooming: {
mouseWheel: {
enabled: !0
}
},
margin: [0, 0, 0, 0]
},
resetZoomButton: {
position: {
x: 0,
y: -40
},
theme: {
fill: "white",
style: {
fontSize: "14px",
padding: "0px"
},
stroke: "silver",
r: 0,
states: {
hover: {
fill: "#41739D",
style: {
color: "white"
}
}
}
}
}
},
legend: {
//layout: 'vertical',
align: 'center',
verticalAlign: 'bottom',
//x: 70,
//y: 10,
floating: !1,
borderWidth: 0,
},
xAxis: {
overscroll: 500000,
gridLineWidth: 0,
crosshair: {
width: 1,
color: 'gray',
dashStyle: 'shortdot',
},
type: "datetime",
},
time: {
useUTC: !1,
timezone: "Asia/Ho_Chi_Minh"
},
title: {
text: "",
floating: !1,
align: "center",
style: {
display: "block"
}
},
subtitle: {
text: "",
align: "left"
},
plotOptions: {
series: {
marker: {
radius: 2
},
lineWidth: 1
}
},
yAxis: !1,
tooltip: {
shared: true,
useHTML: true,
formatter: function () {
var s = "<b>Ngày " + Highcharts.dateFormat('%d/%m/%Y', this.x) + "</b><br/>";
this.points.forEach(function (point, i) {
var firstPoint = point.series.points[0].y
var pointY = point.y;
if(event) {
let lastCharStr = dulieutho[dulieutho.length - 1].format;
let lastChar = lastCharStr[lastCharStr.length-1];
let stt = dulieutho.findIndex(s => s.date == point.x)
if(stt >-1) {
s += `<div style="display: block;line-height:1">
<div>Thực tế: <b>${fNumber(pointY)} (${lastChar})</b></div>
<div>Dự báo: <b>${fNumber(dulieutho[stt].forecast)} (${lastChar})</b></div>
<div>Xu hướng: <b>${dulieutho[stt].state}</b></div>
</div>`;
}
}else{
s += `<div style="display: flex;align-items: flex-end; justify-content: space-between;"><div>
<span style="display:inline-block;border-radius:10px;width:10px;height:10px;background-color:${point.color};"></span> Giá trị: </div>
<div style="float:right"><span style="margin-left:2px;margin-left: 10px;">${fNumber(pointY)}</span></div></div>`;
}
});
return s;
}
},
exporting: {
enabled: 1
},
series: []
};
if(event){
let lastCharStr = dulieutho[dulieutho.length - 1].format;
console.log(lastCharStr)
let lastChar = lastCharStr[lastCharStr.length-1];
config.subtitle.text = `<b>Ngày ${convertNumberToDate(last[0])}</b><br>Tháng này: ${dulieutho[dulieutho.length-1].actual} (${lastChar}) <br/>Dự báo: ${fNumber(dulieutho[dulieutho.length-1].forecast)} (${lastChar}) <br/>Tháng trước : ${dulieutho[dulieutho.length-2].actual} (${lastChar})<br/>Xu hướng: ${dulieutho[dulieutho.length-1].state}`;
}else {
config.subtitle.text = `<b>Ngày ${convertNumberToDate(last[0])}</b><br>${last[event? 1: 4].toFixed(2)} (${changp.toFixed(2)}/${changpe.toFixed(2)}%)`;
}
config.title.text = wicode[i].keyWord
config.yAxis = {
lineWidth: 1,
title: {
text: ""
},
labels: {
align: 'center',
style: {
color: Highcharts.getOptions()
.colors[0]
}
},
opposite: true,
crosshair: {
width: 1,
color: 'gray',
dashStyle: 'shortdot',
},
};
config.series = [{
name: wicode[i].keyWord,
data: data.data.map(t => [t[0], t[event ? 1 : 4]])
}]
config.credits = {
enabled: false,
}
document.title = wicode[i].keyWord;
Highcharts.chart('myChart', config, function (chart) {
dis_recession(chart);
changePeriod(chart);
});
} catch (error) {
console.error('There has been a problem with your fetch operation:', error);
document.querySelector('.existing-div').innerHTML = '';
}
}
const ams = new URLSearchParams(window.location.search);
const quote = ams.get("code");
fetchData(quote);
</script>
</body>
</html>