|
1 | 1 | // ignore_for_file: leading_newlines_in_multiline_strings |
2 | 2 |
|
3 | | -import 'package:graphify/src/resources/dependencies.js.dart'; |
4 | 3 | import 'package:graphify/src/utils/js_methods.dart'; |
5 | 4 |
|
6 | | -String indexHtml({ |
7 | | - required String id, |
8 | | - bool enableDependency = true, |
9 | | - String? backgroundColor, |
10 | | -}) { |
| 5 | +String indexHtml({ required String id, String? dependencies}) { |
11 | 6 | return '''<!DOCTYPE html> |
12 | 7 | <html> |
13 | 8 | <head> |
14 | 9 | <meta charset="UTF-8"> |
15 | 10 | <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> |
16 | 11 | <style> |
17 | 12 | html, body { |
18 | | - ${backgroundColor != null ? "background-color: $backgroundColor;" : ""} |
| 13 | + background-color: transparent; |
19 | 14 | height: -webkit-fill-available; |
20 | 15 | box-sizing: content-box; |
21 | 16 | margin: 0; |
22 | 17 | overflow: hidden; |
| 18 | + width: 100%; |
| 19 | + height: 100%; |
23 | 20 | } |
24 | | - #chart { |
25 | | - height: -webkit-fill-available; |
26 | | - } |
| 21 | + #chart { height: -webkit-fill-available; } |
27 | 22 | </style> |
28 | 23 | </head> |
29 | 24 | <body> |
30 | 25 | <div id="chart"></div> |
31 | | - ${enableDependency ? htmlDependencies : ""} |
| 26 | + ${dependencies ?? ''} |
32 | 27 | <script> |
33 | 28 | const dom = document.getElementById('chart'); |
34 | 29 | const context = (window.parent && window.parent.window) || window || {}; |
35 | 30 | const chart = context.echarts.init(dom, 'dark', { renderer: 'canvas', useDirtyRect: false }); |
36 | | - |
37 | 31 | context.${JsMethods.initChart}('$id', chart, {}); |
38 | 32 | context.${JsMethods.updateChart}('$id', {}); |
39 | | - |
40 | 33 | window.addEventListener('resize', chart.resize); |
41 | 34 | </script> |
42 | 35 | </body> |
|
0 commit comments