@fto-consult/expo-ui 1.1.39 → 1.1.40
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/package.json +1 -1
- package/src/components/Chart/appexChart/index.html +29 -0
- package/src/components/Chart/appexChart/index.js +26 -0
- package/src/components/Chart/appexChart/index.native.js +62 -0
- package/src/components/Chart/index.js +64 -16
- package/src/components/Chart/utils.js +25 -0
- package/src/components/WebView/index.js +7 -1
- package/src/components/Chart/appexchart.3.5.html +0 -14
- package/src/components/Chart/index.native.js +0 -58
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import FileSystem from "$file-system";
|
|
2
|
-
import appexChartCode from "./appexchart.3.5.html";
|
|
3
|
-
import React from "$react";
|
|
4
|
-
import WebView from "$ecomponents/WebView";
|
|
5
|
-
import {defaultStr,uniqid} from "$utils";
|
|
6
|
-
import View from "$ecomponents/View";
|
|
7
|
-
|
|
8
|
-
let appexchartJSString = null;
|
|
9
|
-
|
|
10
|
-
export const ChartComponent = React.forwardRef(({options,containerId,...props},ref)=>{
|
|
11
|
-
const containerIdRef = React.useRef(defaultStr(containerId,uniqid("chart-container-id")))
|
|
12
|
-
const appexChartJS = appexchartJSString? (appexchartJSString+"\n"):"";
|
|
13
|
-
const optsJSON = JSON.stringify(options);
|
|
14
|
-
const elementId = containerIdRef.current;
|
|
15
|
-
const htmlContent = `
|
|
16
|
-
<!DOCTYPE html>
|
|
17
|
-
<html>
|
|
18
|
-
<head>
|
|
19
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
20
|
-
<script type='text/javascript'>
|
|
21
|
-
${appexChartJS}
|
|
22
|
-
</script>
|
|
23
|
-
<meta
|
|
24
|
-
name="viewport"
|
|
25
|
-
content="width=device-width, initial-scale=1, maximum-scale=1"
|
|
26
|
-
/>
|
|
27
|
-
<body>
|
|
28
|
-
<div id="${elementId}"/>
|
|
29
|
-
<script type='text/javascript'>
|
|
30
|
-
const options = ${optsJSON};
|
|
31
|
-
var element = document.getElementById("#${elementId}");
|
|
32
|
-
if(!element){
|
|
33
|
-
element = document.createElement("div");
|
|
34
|
-
document.body.appendChild(element);
|
|
35
|
-
}
|
|
36
|
-
element.id = "${elementId}";
|
|
37
|
-
const chart = new ApexCharts(element, options);
|
|
38
|
-
chart.render();
|
|
39
|
-
</script>
|
|
40
|
-
</body>
|
|
41
|
-
</html>
|
|
42
|
-
`;
|
|
43
|
-
return <View style={{flex:1}}>
|
|
44
|
-
<WebView.Html
|
|
45
|
-
html = {htmlContent}
|
|
46
|
-
>
|
|
47
|
-
</WebView.Html>
|
|
48
|
-
</View>
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
ChartComponent.displayName = "ChartComponent";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
FileSystem.readFile(appexChartCode).then(code=>{
|
|
55
|
-
appexchartJSString = code;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
export default ChartComponent;
|