@@ -76,39 +76,44 @@ <h1 style="text-align: center; margin: 40px 0px;">Telegram Charts</h1>
7676
7777 var chartsContainer = document . querySelector ( '#container' ) ;
7878
79- fetch ( 'assets/stage_2_data/1/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
80- chartData . x_on_zoom = ( timestamp ) => {
81- const response = fetch ( 'assets/stage_2_data_extended/1/2018-04/07.json' ) . then ( res => res . json ( ) )
82- return response ;
83- } ;
84- Graph . render ( chartsContainer , chartData ) ;
85- } )
86-
87- fetch ( 'assets/stage_2_data/2/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
88- chartData . x_on_zoom = ( timestamp ) => {
89- const response = fetch ( 'assets/stage_2_data_extended/2/2018-04/07.json' ) . then ( res => res . json ( ) )
90- return response ;
91- } ;
92- Graph . render ( chartsContainer , chartData ) ;
93- } )
94-
95- fetch ( 'assets/stage_2_data/3/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
96- chartData . x_on_zoom = ( timestamp ) => {
97- const response = fetch ( 'assets/stage_2_data_extended/3/2018-04/07.json' ) . then ( res => res . json ( ) )
98- return response ;
99- } ;
100- Graph . render ( chartsContainer , chartData ) ;
101- } ) ;
79+ async function init ( ) {
80+ await fetch ( 'assets/stage_2_data/1/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
81+ chartData . x_on_zoom = ( timestamp ) => {
82+ const response = fetch ( 'assets/stage_2_data_extended/1/2018-04/07.json' ) . then ( res => res . json ( ) )
83+ return response ;
84+ } ;
85+ Graph . render ( chartsContainer , chartData ) ;
86+ } )
87+
88+ await fetch ( 'assets/stage_2_data/2/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
89+ chartData . x_on_zoom = ( timestamp ) => {
90+ const response = fetch ( 'assets/stage_2_data_extended/2/2018-04/07.json' ) . then ( res => res . json ( ) )
91+ return response ;
92+ } ;
93+ Graph . render ( chartsContainer , chartData ) ;
94+ } )
95+
96+ await fetch ( 'assets/stage_2_data/3/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
97+ chartData . x_on_zoom = ( timestamp ) => {
98+ const response = fetch ( 'assets/stage_2_data_extended/3/2018-04/07.json' ) . then ( res => res . json ( ) )
99+ return response ;
100+ } ;
101+ Graph . render ( chartsContainer , chartData ) ;
102+ } ) ;
103+
104+ await fetch ( 'assets/stage_2_data/4/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
105+ chartData . x_on_zoom = ( timestamp ) => {
106+ const response = fetch ( 'assets/stage_2_data_extended/4/2018-04/07.json' ) . then ( res => res . json ( ) )
107+ return response ;
108+ } ;
109+ Graph . render ( chartsContainer , chartData ) ;
110+ } ) ;
111+
112+ await fetch ( 'assets/stage_2_data/5/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => Graph . render ( chartsContainer , chartData ) )
113+ }
102114
103- fetch ( 'assets/stage_2_data/4/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => {
104- chartData . x_on_zoom = ( timestamp ) => {
105- const response = fetch ( 'assets/stage_2_data_extended/4/2018-04/07.json' ) . then ( res => res . json ( ) )
106- return response ;
107- } ;
108- Graph . render ( chartsContainer , chartData ) ;
109- } ) ;
115+ init ( ) ;
110116
111- fetch ( 'assets/stage_2_data/5/overview.json' ) . then ( res => res . json ( ) ) . then ( chartData => Graph . render ( chartsContainer , chartData ) )
112117 </ script >
113118</ body >
114119</ html >
0 commit comments