File tree 3 files changed +28
-14
lines changed
3 files changed +28
-14
lines changed Original file line number Diff line number Diff line change @@ -60,20 +60,28 @@ const options = {
60
60
} ;
61
61
62
62
( async function ( ) {
63
- const result = await loadClientConfig ( ) ;
63
+ try {
64
+ const result = await loadClientConfig ( ) ;
64
65
65
- const ctx = document . getElementById ( "data" ) ;
66
+ const ctx = document . getElementById ( "data" ) ;
66
67
67
- new Chart ( ctx , {
68
- type : "line" ,
69
- options : options ,
70
- data : {
71
- labels : result . map ( ( item ) => item . labels ) ,
72
- datasets : [
73
- {
74
- data : result . map ( ( item ) => item . data )
75
- }
76
- ]
77
- }
78
- } ) ;
68
+ new Chart ( ctx , {
69
+ type : "line" ,
70
+ options : options ,
71
+ data : {
72
+ labels : result . map ( ( item ) => item . labels ) ,
73
+ datasets : [
74
+ {
75
+ data : result . map ( ( item ) => item . data )
76
+ }
77
+ ]
78
+ }
79
+ } ) ;
80
+ } catch {
81
+ const body = document . querySelector ( "body" ) ;
82
+ const message = document . createElement ( "p" ) ;
83
+ message . classList . add ( "error" ) ;
84
+ message . innerHTML = "Please run this page in a formsort flow." ;
85
+ body . prepend ( message ) ;
86
+ }
79
87
} ) ( ) ;
Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="UTF-8 " />
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6
+ < link rel ="stylesheet " href ="./styles.css " />
6
7
< title > Chart.js</ title >
7
8
</ head >
8
9
< body >
Original file line number Diff line number Diff line change
1
+ p .error {
2
+ color : red;
3
+ font-size : 1.5em ;
4
+ text-align : center;
5
+ }
You can’t perform that action at this time.
0 commit comments