@amcharts/amcharts5-react-native 5.0.0 → 5.0.2
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/CHANGELOG.md +15 -0
- package/README.md +4 -4
- package/dist/AmChart.d.ts +3 -2
- package/dist/AmChart.js.map +1 -1
- package/dist/generated.js +2 -2
- package/dist/generated.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
|
|
|
5
5
|
Please note, that this project, while following numbering syntax, it DOES NOT
|
|
6
6
|
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
|
|
7
7
|
|
|
8
|
+
## [5.0.2] - 2026-10-26
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Loads amCharts 5.21.5.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [5.0.1] - 2026-10-23
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `themes`: a theme can come with its settings, e.g. `["Adaptive", { baseColor: "#4150a0" }]`.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Loads amCharts 5.21.4.
|
|
21
|
+
|
|
22
|
+
|
|
8
23
|
## [5.0.0] - 2026-10-22
|
|
9
24
|
|
|
10
25
|
### Added
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# amCharts 5 for React Native
|
|
2
2
|
|
|
3
|
-
A React Native component for [amCharts 5](https://
|
|
3
|
+
A React Native component for [amCharts 5](https://docs.amcharts.com/v5/).
|
|
4
4
|
The chart is drawn by the library itself, in a WebView, so every chart type,
|
|
5
5
|
theme and feature works as it does on the web, on canvas or as SVG.
|
|
6
6
|
|
|
@@ -26,7 +26,7 @@ import { AmChart } from "@amcharts/amcharts5-react-native";
|
|
|
26
26
|
<AmChart config={config} themes={["Animated"]} style={{ height: 300 }} />
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
The config is a [JSON config](https://
|
|
29
|
+
The config is a [JSON config](https://docs.amcharts.com/v5/concepts/serializing/),
|
|
30
30
|
as an object or a string. The chart types it uses are loaded for it, and so
|
|
31
31
|
is map geodata it names by its global name (`"geoJSON": "am5geodata_worldLow"`).
|
|
32
32
|
A config with different content makes the chart again; the same content
|
|
@@ -122,7 +122,7 @@ chartView.current?.run("chart.series.getIndex(0).hide()");
|
|
|
122
122
|
| `config` | The chart as a JSON config: an object or a JSON string. |
|
|
123
123
|
| `code` | The chart as code, used when there is no `config`. |
|
|
124
124
|
| `data` | Data for `code`, as `data`. It must be JSON. With a `config`, it is only there for `run()`. |
|
|
125
|
-
| `themes` | Theme names, e.g. `["Animated", "Dark"]`: the files in the library's `themes/` folder. |
|
|
125
|
+
| `themes` | Theme names, e.g. `["Animated", "Dark"]`: the files in the library's `themes/` folder. A theme with settings is a pair: `["Adaptive", { baseColor: "#4150a0" }]`. |
|
|
126
126
|
| `renderer` | `"svg"` draws the chart as SVG; the default is canvas. SVG needs amCharts 5.21.0 or later. |
|
|
127
127
|
| `licenses` | amCharts license keys, which remove the logo: see [License](#license). |
|
|
128
128
|
| `modules` | More script files to load before the chart is built, e.g. `"locales/de_DE"` for a locale named only in a config, or full URLs. Chart types, themes, plugins, locales, fonts and geodata named by their global (`am5fonts_notosans_jp`) are loaded without this. |
|
|
@@ -190,5 +190,5 @@ JSON config with `run()`, and a map.
|
|
|
190
190
|
|
|
191
191
|
## More
|
|
192
192
|
|
|
193
|
-
- [amCharts 5 documentation](https://
|
|
193
|
+
- [amCharts 5 documentation](https://docs.amcharts.com/v5/) and [demos](https://www.amcharts.com/demos/)
|
|
194
194
|
- License: see [License](#license) above.
|
package/dist/AmChart.d.ts
CHANGED
|
@@ -24,9 +24,10 @@ export interface AmChartProps {
|
|
|
24
24
|
*/
|
|
25
25
|
data?: unknown;
|
|
26
26
|
/**
|
|
27
|
-
* Theme names, e.g. `["Animated", "Dark"]
|
|
27
|
+
* Theme names, e.g. `["Animated", "Dark"]`, or a name with the theme's
|
|
28
|
+
* settings: `["Adaptive", { baseColor: "#4150a0" }]`. Settings must be JSON.
|
|
28
29
|
*/
|
|
29
|
-
themes?: Array<string>;
|
|
30
|
+
themes?: Array<string | [string, object]>;
|
|
30
31
|
/**
|
|
31
32
|
* Draws the chart as SVG instead of canvas.
|
|
32
33
|
*
|
package/dist/AmChart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AmChart.js","sourceRoot":"","sources":["../src/AmChart.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA0H;AAE1H,+CAAyD;AAEzD,gFAA2C;AAE3C,2CAAuD;AAuHvD,SAAS,MAAM,CAAC,GAAW;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1C,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpF,mEAAmE;AACnE,SAAS,IAAI,CAAC,IAAY,EAAE,KAAc;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IACtH,OAAO,2CAA2C,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,UAAU,CAAC;AACrF,CAAC;AAED,SAAS,SAAS,CAAC,KAA2B;IA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GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAChF,SAAS,EAAE,SAAS;QACpB,4BAA4B,EAAE,4BAA4B;QAC1D,4BAA4B,EAAE,OAAO;QACrC,mBAAmB,EAAE,OAAO;KAC5B,CAAC,CACF,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { createElement, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport type { ForwardedRef } from \"react\";\nimport { Linking, StyleSheet, View } from \"react-native\";\nimport type { StyleProp, ViewStyle } from \"react-native\";\nimport WebView from \"react-native-webview\";\nimport type { WebViewMessageEvent, WebViewProps } from \"react-native-webview\";\nimport { libraryVersion, pageHtml } from \"./generated\";\n\n/**\n * Props of `<AmChart>`.\n */\nexport interface AmChartProps {\n\n\t/**\n\t * The chart as a JSON config: an object, or a JSON string. A config with\n\t * different content makes the chart again.\n\t */\n\tconfig?: object | string;\n\n\t/**\n\t * The chart as code, used when there is no `config`. It runs in the chart's\n\t * page with `root`, `data` and `post`, and the library's globals (`am5`,\n\t * `am5xy`...). A different string makes the chart again. Return a function\n\t * to get new `data` without making the chart again, or a promise for\n\t * `onReady` to wait for.\n\t */\n\tcode?: string;\n\n\t/**\n\t * Data for `code`, as `data`. It must be JSON. New content goes to the\n\t * function `code` returned, or makes the chart again. With a `config` it\n\t * is only there for `run()`.\n\t */\n\tdata?: unknown;\n\n\t/**\n\t * Theme names, e.g. `[\"Animated\", \"Dark\"]`.\n\t */\n\tthemes?: Array<string>;\n\n\t/**\n\t * Draws the chart as SVG instead of canvas.\n\t *\n\t * @default \"canvas\"\n\t */\n\trenderer?: \"canvas\" | \"svg\";\n\n\t/**\n\t * amCharts license keys, which remove the amCharts logo. They are added\n\t * before the chart is made: calling `am5.addLicense()` in `code` would be\n\t * too late.\n\t */\n\tlicenses?: Array<string>;\n\n\t/**\n\t * More script files to load, e.g. `\"locales/de_DE\"`, or a full URL. Chart\n\t * types, themes, plugins and geodata named by their global are loaded\n\t * without this.\n\t */\n\tmodules?: Array<string>;\n\n\t/**\n\t * Where the library's script files are.\n\t *\n\t * @default \"https://cdn.amcharts.com/lib/version/<the library version this package was released with>/\"\n\t */\n\tlibraryUrl?: string;\n\n\t/**\n\t * Where the geodata files are.\n\t *\n\t * @default \"https://cdn.amcharts.com/lib/5/geodata/\", or the `geodata/` folder of a `libraryUrl` that is not on the amCharts CDN\n\t */\n\tgeodataUrl?: string;\n\n\t/**\n\t * Called when the chart is built.\n\t */\n\tonReady?: () => void;\n\n\t/**\n\t * Called when the chart could not be built, or its code failed. Without it\n\t * the error goes to `console.warn`.\n\t */\n\tonError?: (message: string) => void;\n\n\t/**\n\t * Called when the chart's code calls `post(name, value)`.\n\t */\n\tonMessage?: (name: string, value: unknown) => void;\n\n\t/**\n\t * Give the chart a height, or `flex: 1`; without one it is 400 high.\n\t */\n\tstyle?: StyleProp<ViewStyle>;\n\n\t/**\n\t * Props for the WebView the chart is drawn in, except the ones the chart\n\t * needs for itself.\n\t */\n\twebViewProps?: Partial<Omit<WebViewProps, \"source\" | \"onMessage\" | \"onShouldStartLoadWithRequest\" | \"onContentProcessDidTerminate\" | \"onRenderProcessGone\">>;\n\n}\n\n/**\n * What a ref on `<AmChart>` gives.\n */\nexport interface AmChartHandle {\n\n\t/**\n\t * Runs code in the chart's page, with `root`, `chart` (from a config),\n\t * `result` (what `code` returned), `data` and `post`. Before the chart is\n\t * ready, it waits for it.\n\t */\n\trun(code: string): void;\n\n}\n\ninterface Message {\n\ttype: \"loaded\" | \"ready\" | \"error\" | \"message\";\n\tmessage?: string;\n\tname?: string;\n\tvalue?: unknown;\n}\n\nfunction folder(url: string): string {\n\treturn /\\/$/.test(url) ? url : url + \"/\";\n}\n\n// Line separators end a line in older engines, even inside a string\nconst separators = new RegExp(\"[\" + String.fromCharCode(0x2028, 0x2029) + \"]\", \"g\");\n\n// Script for injectJavaScript, with a value that may hold any text\nfunction call(name: string, value: unknown): string {\n\tconst text = JSON.stringify(value);\n\tconst json = text === undefined ? \"undefined\" : text.replace(separators, (c) => \"\\\\u\" + c.charCodeAt(0).toString(16));\n\treturn \"window.amChartPage && window.amChartPage.\" + name + \"(\" + json + \"); true;\";\n}\n\nfunction hasHeight(style: StyleProp<ViewStyle>): boolean {\n\tconst flat = StyleSheet.flatten(style) || {};\n\treturn flat.height != null || flat.minHeight != null || flat.flex != null || flat.flexGrow != null || flat.aspectRatio != null || flat.bottom != null;\n}\n\nconst webViewStyle = { flex: 1, backgroundColor: \"transparent\" };\n\nconst CDN = \"https://cdn.amcharts.com/lib/\";\n\n/**\n * An amCharts 5 chart in a WebView, from a JSON config or from chart code.\n *\n * ```tsx\n * <AmChart config={config} themes={[\"Animated\"]} style={{ height: 300 }} />\n * ```\n */\nexport const AmChart = forwardRef(function AmChart(props: AmChartProps, ref: ForwardedRef<AmChartHandle>) {\n\tconst webView = useRef<WebView>(null);\n\n\t// A new page after the old one's process was lost\n\tconst [page, setPage] = useState(0);\n\n\t// The page that has loaded, with the library address it was given\n\tconst [loaded, setLoaded] = useState<{ url: string } | undefined>(undefined);\n\tconst shown = useRef(loaded);\n\tshown.current = loaded;\n\n\t// The latest callbacks: new ones on every render do not make the chart again\n\tconst latest = useRef(props);\n\tlatest.current = props;\n\n\tconst libraryUrl = folder(props.libraryUrl || CDN + \"version/\" + libraryVersion + \"/\");\n\n\t// Geodata and fonts are not in the CDN's version folders\n\tconst sharedUrl = libraryUrl.indexOf(CDN) === 0 ? CDN + \"5/\" : libraryUrl;\n\tconst geodataUrl = folder(props.geodataUrl || sharedUrl + \"geodata/\");\n\tconst currentUrl = useRef(libraryUrl);\n\tcurrentUrl.current = libraryUrl;\n\n\t// Compared by content: a config or data written inline is a new object on every render\n\tconst config = typeof props.config === \"string\" ? props.config : JSON.stringify(props.config);\n\tconst buildKey = JSON.stringify([config, props.code, props.themes, props.renderer, props.modules, props.licenses, geodataUrl]);\n\tconst dataKey = String(JSON.stringify(props.data));\n\n\tconst sent = useRef<{ build?: string, data?: string }>({});\n\n\t// run() waits for the chart that is being built\n\tconst ready = useRef(false);\n\tconst queue = useRef<Array<string>>([]);\n\n\tuseEffect(() => {\n\t\tconst target = webView.current;\n\t\tif (!loaded || loaded.url !== libraryUrl || !target) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst current = latest.current;\n\n\t\tif (sent.current.build !== buildKey) {\n\t\t\tlet parsed: unknown;\n\t\t\ttry {\n\t\t\t\tparsed = typeof current.config === \"string\" ? JSON.parse(current.config) : current.config;\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\treport(\"config: \" + (error as Error).message);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tready.current = false;\n\t\t\ttarget.injectJavaScript(call(\"build\", {\n\t\t\t\tconfig: parsed,\n\t\t\t\tcode: current.code,\n\t\t\t\tdata: current.data,\n\t\t\t\tthemes: current.themes || [],\n\t\t\t\trenderer: current.renderer || \"canvas\",\n\t\t\t\tlicenses: current.licenses || [],\n\t\t\t\tmodules: current.modules || [],\n\t\t\t\tlibraryUrl: libraryUrl,\n\t\t\t\tgeodataUrl: geodataUrl,\n\t\t\t\tfontsUrl: sharedUrl + \"fonts/\",\n\t\t\t}));\n\t\t\tsent.current = { build: buildKey, data: dataKey };\n\t\t}\n\t\telse if (sent.current.data !== dataKey) {\n\t\t\ttarget.injectJavaScript(call(\"data\", current.data));\n\t\t\tsent.current.data = dataKey;\n\t\t}\n\t}, [loaded, libraryUrl, buildKey, dataKey]);\n\n\tfunction report(message: string): void {\n\t\tconst callback = latest.current.onError;\n\t\tif (callback) {\n\t\t\tcallback(message);\n\t\t}\n\t\telse {\n\t\t\tconsole.warn(\"AmChart: \" + message);\n\t\t}\n\t}\n\n\tconst onMessage = useCallback((event: WebViewMessageEvent) => {\n\t\tlet message: Message;\n\t\ttry {\n\t\t\tmessage = JSON.parse(event.nativeEvent.data);\n\t\t}\n\t\tcatch (error) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst current = latest.current;\n\n\t\tif (message.type === \"loaded\") {\n\t\t\tsent.current = {};\n\t\t\tready.current = false;\n\t\t\tsetLoaded({ url: currentUrl.current });\n\t\t}\n\t\telse if (message.type === \"ready\") {\n\t\t\tready.current = true;\n\t\t\tconst target = webView.current;\n\t\t\tqueue.current.splice(0).forEach((code) => {\n\t\t\t\tif (target) {\n\t\t\t\t\ttarget.injectJavaScript(call(\"run\", code));\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (current.onReady) {\n\t\t\t\tcurrent.onReady();\n\t\t\t}\n\t\t}\n\t\telse if (message.type === \"error\") {\n\t\t\treport(message.message || \"\");\n\t\t}\n\t\telse if (message.type === \"message\") {\n\t\t\tif (current.onMessage) {\n\t\t\t\tcurrent.onMessage(message.name || \"\", message.value);\n\t\t\t}\n\t\t}\n\t}, []);\n\n\t// Links in the chart (its logo, a data item's url) open in the browser\n\t// instead of replacing the chart. Until the page has loaded, it may load\n\tconst onShouldStartLoadWithRequest = useCallback((request: { url: string, isTopFrame?: boolean }) => {\n\t\tconst page = shown.current;\n\t\tif (!page || page.url !== currentUrl.current || request.isTopFrame === false || request.url === \"about:blank\") {\n\t\t\treturn true;\n\t\t}\n\t\tif (/^(https?|mailto|tel):/i.test(request.url)) {\n\t\t\tLinking.openURL(request.url).catch(() => undefined);\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst restart = useCallback(() => {\n\t\tready.current = false;\n\t\tsetLoaded(undefined);\n\t\tsetPage((count) => count + 1);\n\t}, []);\n\n\tuseImperativeHandle(ref, () => ({\n\t\trun(code: string) {\n\t\t\tif (ready.current && webView.current) {\n\t\t\t\twebView.current.injectJavaScript(call(\"run\", code));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tqueue.current.push(code);\n\t\t\t}\n\t\t},\n\t}), []);\n\n\t// A new base URL loads the page again\n\tconst source = useMemo(() => ({ html: pageHtml, baseUrl: libraryUrl }), [libraryUrl]);\n\n\treturn createElement(View, { style: hasHeight(props.style) ? props.style : [{ height: 400 }, props.style] },\n\t\tcreateElement(WebView, {\n\t\t\toriginWhitelist: [\"*\"],\n\t\t\tscrollEnabled: false,\n\t\t\tbounces: false,\n\t\t\toverScrollMode: \"never\",\n\t\t\tshowsHorizontalScrollIndicator: false,\n\t\t\tshowsVerticalScrollIndicator: false,\n\t\t\tsetSupportMultipleWindows: false,\n\t\t\ttextZoom: 100,\n\t\t\t...props.webViewProps,\n\t\t\tkey: page,\n\t\t\tref: webView,\n\t\t\tsource: source,\n\t\t\tstyle: [webViewStyle, props.webViewProps ? props.webViewProps.style : undefined],\n\t\t\tonMessage: onMessage,\n\t\t\tonShouldStartLoadWithRequest: onShouldStartLoadWithRequest,\n\t\t\tonContentProcessDidTerminate: restart,\n\t\t\tonRenderProcessGone: restart,\n\t\t}),\n\t);\n});\n"]}
|
|
1
|
+
{"version":3,"file":"AmChart.js","sourceRoot":"","sources":["../src/AmChart.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA0H;AAE1H,+CAAyD;AAEzD,gFAA2C;AAE3C,2CAAuD;AAwHvD,SAAS,MAAM,CAAC,GAAW;IAC1B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;AAC1C,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;AAEpF,mEAAmE;AACnE,SAAS,IAAI,CAAC,IAAY,EAAE,KAAc;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,CAA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EAAE,EAC1G,IAAA,qBAAa,EAAC,8BAAO,EAAE;QACtB,eAAe,EAAE,CAAC,GAAG,CAAC;QACtB,aAAa,EAAE,KAAK;QACpB,OAAO,EAAE,KAAK;QACd,cAAc,EAAE,OAAO;QACvB,8BAA8B,EAAE,KAAK;QACrC,4BAA4B,EAAE,KAAK;QACnC,yBAAyB,EAAE,KAAK;QAChC,QAAQ,EAAE,GAAG;QACb,GAAG,KAAK,CAAC,YAAY;QACrB,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,OAAO;QACZ,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAChF,SAAS,EAAE,SAAS;QACpB,4BAA4B,EAAE,4BAA4B;QAC1D,4BAA4B,EAAE,OAAO;QACrC,mBAAmB,EAAE,OAAO;KAC5B,CAAC,CACF,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { createElement, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport type { ForwardedRef } from \"react\";\nimport { Linking, StyleSheet, View } from \"react-native\";\nimport type { StyleProp, ViewStyle } from \"react-native\";\nimport WebView from \"react-native-webview\";\nimport type { WebViewMessageEvent, WebViewProps } from \"react-native-webview\";\nimport { libraryVersion, pageHtml } from \"./generated\";\n\n/**\n * Props of `<AmChart>`.\n */\nexport interface AmChartProps {\n\n\t/**\n\t * The chart as a JSON config: an object, or a JSON string. A config with\n\t * different content makes the chart again.\n\t */\n\tconfig?: object | string;\n\n\t/**\n\t * The chart as code, used when there is no `config`. It runs in the chart's\n\t * page with `root`, `data` and `post`, and the library's globals (`am5`,\n\t * `am5xy`...). A different string makes the chart again. Return a function\n\t * to get new `data` without making the chart again, or a promise for\n\t * `onReady` to wait for.\n\t */\n\tcode?: string;\n\n\t/**\n\t * Data for `code`, as `data`. It must be JSON. New content goes to the\n\t * function `code` returned, or makes the chart again. With a `config` it\n\t * is only there for `run()`.\n\t */\n\tdata?: unknown;\n\n\t/**\n\t * Theme names, e.g. `[\"Animated\", \"Dark\"]`, or a name with the theme's\n\t * settings: `[\"Adaptive\", { baseColor: \"#4150a0\" }]`. Settings must be JSON.\n\t */\n\tthemes?: Array<string | [string, object]>;\n\n\t/**\n\t * Draws the chart as SVG instead of canvas.\n\t *\n\t * @default \"canvas\"\n\t */\n\trenderer?: \"canvas\" | \"svg\";\n\n\t/**\n\t * amCharts license keys, which remove the amCharts logo. They are added\n\t * before the chart is made: calling `am5.addLicense()` in `code` would be\n\t * too late.\n\t */\n\tlicenses?: Array<string>;\n\n\t/**\n\t * More script files to load, e.g. `\"locales/de_DE\"`, or a full URL. Chart\n\t * types, themes, plugins and geodata named by their global are loaded\n\t * without this.\n\t */\n\tmodules?: Array<string>;\n\n\t/**\n\t * Where the library's script files are.\n\t *\n\t * @default \"https://cdn.amcharts.com/lib/version/<the library version this package was released with>/\"\n\t */\n\tlibraryUrl?: string;\n\n\t/**\n\t * Where the geodata files are.\n\t *\n\t * @default \"https://cdn.amcharts.com/lib/5/geodata/\", or the `geodata/` folder of a `libraryUrl` that is not on the amCharts CDN\n\t */\n\tgeodataUrl?: string;\n\n\t/**\n\t * Called when the chart is built.\n\t */\n\tonReady?: () => void;\n\n\t/**\n\t * Called when the chart could not be built, or its code failed. Without it\n\t * the error goes to `console.warn`.\n\t */\n\tonError?: (message: string) => void;\n\n\t/**\n\t * Called when the chart's code calls `post(name, value)`.\n\t */\n\tonMessage?: (name: string, value: unknown) => void;\n\n\t/**\n\t * Give the chart a height, or `flex: 1`; without one it is 400 high.\n\t */\n\tstyle?: StyleProp<ViewStyle>;\n\n\t/**\n\t * Props for the WebView the chart is drawn in, except the ones the chart\n\t * needs for itself.\n\t */\n\twebViewProps?: Partial<Omit<WebViewProps, \"source\" | \"onMessage\" | \"onShouldStartLoadWithRequest\" | \"onContentProcessDidTerminate\" | \"onRenderProcessGone\">>;\n\n}\n\n/**\n * What a ref on `<AmChart>` gives.\n */\nexport interface AmChartHandle {\n\n\t/**\n\t * Runs code in the chart's page, with `root`, `chart` (from a config),\n\t * `result` (what `code` returned), `data` and `post`. Before the chart is\n\t * ready, it waits for it.\n\t */\n\trun(code: string): void;\n\n}\n\ninterface Message {\n\ttype: \"loaded\" | \"ready\" | \"error\" | \"message\";\n\tmessage?: string;\n\tname?: string;\n\tvalue?: unknown;\n}\n\nfunction folder(url: string): string {\n\treturn /\\/$/.test(url) ? url : url + \"/\";\n}\n\n// Line separators end a line in older engines, even inside a string\nconst separators = new RegExp(\"[\" + String.fromCharCode(0x2028, 0x2029) + \"]\", \"g\");\n\n// Script for injectJavaScript, with a value that may hold any text\nfunction call(name: string, value: unknown): string {\n\tconst text = JSON.stringify(value);\n\tconst json = text === undefined ? \"undefined\" : text.replace(separators, (c) => \"\\\\u\" + c.charCodeAt(0).toString(16));\n\treturn \"window.amChartPage && window.amChartPage.\" + name + \"(\" + json + \"); true;\";\n}\n\nfunction hasHeight(style: StyleProp<ViewStyle>): boolean {\n\tconst flat = StyleSheet.flatten(style) || {};\n\treturn flat.height != null || flat.minHeight != null || flat.flex != null || flat.flexGrow != null || flat.aspectRatio != null || flat.bottom != null;\n}\n\nconst webViewStyle = { flex: 1, backgroundColor: \"transparent\" };\n\nconst CDN = \"https://cdn.amcharts.com/lib/\";\n\n/**\n * An amCharts 5 chart in a WebView, from a JSON config or from chart code.\n *\n * ```tsx\n * <AmChart config={config} themes={[\"Animated\"]} style={{ height: 300 }} />\n * ```\n */\nexport const AmChart = forwardRef(function AmChart(props: AmChartProps, ref: ForwardedRef<AmChartHandle>) {\n\tconst webView = useRef<WebView>(null);\n\n\t// A new page after the old one's process was lost\n\tconst [page, setPage] = useState(0);\n\n\t// The page that has loaded, with the library address it was given\n\tconst [loaded, setLoaded] = useState<{ url: string } | undefined>(undefined);\n\tconst shown = useRef(loaded);\n\tshown.current = loaded;\n\n\t// The latest callbacks: new ones on every render do not make the chart again\n\tconst latest = useRef(props);\n\tlatest.current = props;\n\n\tconst libraryUrl = folder(props.libraryUrl || CDN + \"version/\" + libraryVersion + \"/\");\n\n\t// Geodata and fonts are not in the CDN's version folders\n\tconst sharedUrl = libraryUrl.indexOf(CDN) === 0 ? CDN + \"5/\" : libraryUrl;\n\tconst geodataUrl = folder(props.geodataUrl || sharedUrl + \"geodata/\");\n\tconst currentUrl = useRef(libraryUrl);\n\tcurrentUrl.current = libraryUrl;\n\n\t// Compared by content: a config or data written inline is a new object on every render\n\tconst config = typeof props.config === \"string\" ? props.config : JSON.stringify(props.config);\n\tconst buildKey = JSON.stringify([config, props.code, props.themes, props.renderer, props.modules, props.licenses, geodataUrl]);\n\tconst dataKey = String(JSON.stringify(props.data));\n\n\tconst sent = useRef<{ build?: string, data?: string }>({});\n\n\t// run() waits for the chart that is being built\n\tconst ready = useRef(false);\n\tconst queue = useRef<Array<string>>([]);\n\n\tuseEffect(() => {\n\t\tconst target = webView.current;\n\t\tif (!loaded || loaded.url !== libraryUrl || !target) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst current = latest.current;\n\n\t\tif (sent.current.build !== buildKey) {\n\t\t\tlet parsed: unknown;\n\t\t\ttry {\n\t\t\t\tparsed = typeof current.config === \"string\" ? JSON.parse(current.config) : current.config;\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\treport(\"config: \" + (error as Error).message);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tready.current = false;\n\t\t\ttarget.injectJavaScript(call(\"build\", {\n\t\t\t\tconfig: parsed,\n\t\t\t\tcode: current.code,\n\t\t\t\tdata: current.data,\n\t\t\t\tthemes: current.themes || [],\n\t\t\t\trenderer: current.renderer || \"canvas\",\n\t\t\t\tlicenses: current.licenses || [],\n\t\t\t\tmodules: current.modules || [],\n\t\t\t\tlibraryUrl: libraryUrl,\n\t\t\t\tgeodataUrl: geodataUrl,\n\t\t\t\tfontsUrl: sharedUrl + \"fonts/\",\n\t\t\t}));\n\t\t\tsent.current = { build: buildKey, data: dataKey };\n\t\t}\n\t\telse if (sent.current.data !== dataKey) {\n\t\t\ttarget.injectJavaScript(call(\"data\", current.data));\n\t\t\tsent.current.data = dataKey;\n\t\t}\n\t}, [loaded, libraryUrl, buildKey, dataKey]);\n\n\tfunction report(message: string): void {\n\t\tconst callback = latest.current.onError;\n\t\tif (callback) {\n\t\t\tcallback(message);\n\t\t}\n\t\telse {\n\t\t\tconsole.warn(\"AmChart: \" + message);\n\t\t}\n\t}\n\n\tconst onMessage = useCallback((event: WebViewMessageEvent) => {\n\t\tlet message: Message;\n\t\ttry {\n\t\t\tmessage = JSON.parse(event.nativeEvent.data);\n\t\t}\n\t\tcatch (error) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst current = latest.current;\n\n\t\tif (message.type === \"loaded\") {\n\t\t\tsent.current = {};\n\t\t\tready.current = false;\n\t\t\tsetLoaded({ url: currentUrl.current });\n\t\t}\n\t\telse if (message.type === \"ready\") {\n\t\t\tready.current = true;\n\t\t\tconst target = webView.current;\n\t\t\tqueue.current.splice(0).forEach((code) => {\n\t\t\t\tif (target) {\n\t\t\t\t\ttarget.injectJavaScript(call(\"run\", code));\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (current.onReady) {\n\t\t\t\tcurrent.onReady();\n\t\t\t}\n\t\t}\n\t\telse if (message.type === \"error\") {\n\t\t\treport(message.message || \"\");\n\t\t}\n\t\telse if (message.type === \"message\") {\n\t\t\tif (current.onMessage) {\n\t\t\t\tcurrent.onMessage(message.name || \"\", message.value);\n\t\t\t}\n\t\t}\n\t}, []);\n\n\t// Links in the chart (its logo, a data item's url) open in the browser\n\t// instead of replacing the chart. Until the page has loaded, it may load\n\tconst onShouldStartLoadWithRequest = useCallback((request: { url: string, isTopFrame?: boolean }) => {\n\t\tconst page = shown.current;\n\t\tif (!page || page.url !== currentUrl.current || request.isTopFrame === false || request.url === \"about:blank\") {\n\t\t\treturn true;\n\t\t}\n\t\tif (/^(https?|mailto|tel):/i.test(request.url)) {\n\t\t\tLinking.openURL(request.url).catch(() => undefined);\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst restart = useCallback(() => {\n\t\tready.current = false;\n\t\tsetLoaded(undefined);\n\t\tsetPage((count) => count + 1);\n\t}, []);\n\n\tuseImperativeHandle(ref, () => ({\n\t\trun(code: string) {\n\t\t\tif (ready.current && webView.current) {\n\t\t\t\twebView.current.injectJavaScript(call(\"run\", code));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tqueue.current.push(code);\n\t\t\t}\n\t\t},\n\t}), []);\n\n\t// A new base URL loads the page again\n\tconst source = useMemo(() => ({ html: pageHtml, baseUrl: libraryUrl }), [libraryUrl]);\n\n\treturn createElement(View, { style: hasHeight(props.style) ? props.style : [{ height: 400 }, props.style] },\n\t\tcreateElement(WebView, {\n\t\t\toriginWhitelist: [\"*\"],\n\t\t\tscrollEnabled: false,\n\t\t\tbounces: false,\n\t\t\toverScrollMode: \"never\",\n\t\t\tshowsHorizontalScrollIndicator: false,\n\t\t\tshowsVerticalScrollIndicator: false,\n\t\t\tsetSupportMultipleWindows: false,\n\t\t\ttextZoom: 100,\n\t\t\t...props.webViewProps,\n\t\t\tkey: page,\n\t\t\tref: webView,\n\t\t\tsource: source,\n\t\t\tstyle: [webViewStyle, props.webViewProps ? props.webViewProps.style : undefined],\n\t\t\tonMessage: onMessage,\n\t\t\tonShouldStartLoadWithRequest: onShouldStartLoadWithRequest,\n\t\t\tonContentProcessDidTerminate: restart,\n\t\t\tonRenderProcessGone: restart,\n\t\t}),\n\t);\n});\n"]}
|
package/dist/generated.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pageHtml = exports.libraryVersion = void 0;
|
|
4
4
|
// Written by scripts/generate.cjs
|
|
5
|
-
exports.libraryVersion = "5.21.
|
|
6
|
-
exports.pageHtml = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n<style>\nhtml, body, #chart {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n\tbackground: transparent;\n}\nbody {\n\t-webkit-tap-highlight-color: transparent;\n\t-webkit-touch-callout: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n</style>\n</head>\n<body>\n<div id=\"chart\"></div>\n<script>\n(function () {\n\t\"use strict\";\n\n\t// Which script file has each class, and which files a file needs first\n\tvar classModules = {\"AccelerationBands\":\"stock\",\"AccumulationDistribution\":\"stock\",\"AccumulativeSwingIndex\":\"stock\",\"Annotator\":\"plugins/exporting\",\"ArcDiagram\":\"flow\",\"ArcDiagramLink\":\"flow\",\"ArcDiagramNodes\":\"flow\",\"Aroon\":\"stock\",\"AverageSeries\":\"stock\",\"AverageTrueRange\":\"stock\",\"AwesomeOscillator\":\"stock\",\"Axis\":\"xy\",\"AxisBullet\":\"xy\",\"AxisLabel\":\"xy\",\"AxisLabelRadial\":\"xy\",\"AxisRenderer\":\"xy\",\"AxisRendererCircular\":\"radar\",\"AxisRendererCurveX\":\"timeline\",\"AxisRendererCurveY\":\"timeline\",\"AxisRendererRadial\":\"radar\",\"AxisRendererX\":\"xy\",\"AxisRendererY\":\"xy\",\"AxisTick\":\"xy\",\"BaseColumnSeries\":\"xy\",\"BollingerBands\":\"stock\",\"BreadcrumbBar\":\"hierarchy\",\"BullBearPower\":\"stock\",\"CalloutSeries\":\"stock\",\"Candlestick\":\"xy\",\"CandlestickSeries\":\"xy\",\"CategoryAxis\":\"xy\",\"CategoryDateAxis\":\"xy\",\"ChaikinMoneyFlow\":\"stock\",\"ChaikinOscillator\":\"stock\",\"ChartIndicator\":\"stock\",\"ChartSerializer\":\"plugins/json\",\"Chord\":\"flow\",\"ChordDirected\":\"flow\",\"ChordLink\":\"flow\",\"ChordLinkDirected\":\"flow\",\"ChordNodes\":\"flow\",\"ChordNonRibbon\":\"flow\",\"ClockHand\":\"radar\",\"ClusteredPointSeries\":\"map\",\"ColorControl\":\"stock\",\"ColorPicker\":\"plugins/colorPicker\",\"ColorPickerButton\":\"plugins/colorPicker\",\"ColumnSeries\":\"xy\",\"CommodityChannelIndex\":\"stock\",\"ComparisonControl\":\"stock\",\"CurveChart\":\"timeline\",\"CurveColumnSeries\":\"timeline\",\"CurveCursor\":\"timeline\",\"CurveLineSeries\":\"timeline\",\"DataSaveControl\":\"stock\",\"DateAxis\":\"xy\",\"DateRangeSelector\":\"stock\",\"DisparityIndex\":\"stock\",\"DoodleSeries\":\"stock\",\"DrawingControl\":\"stock\",\"DrawingSeries\":\"stock\",\"DrawingToolControl\":\"stock\",\"Dropdown\":\"stock\",\"DropdownColors\":\"stock\",\"DropdownControl\":\"stock\",\"DropdownList\":\"stock\",\"DropdownListControl\":\"stock\",\"DurationAxis\":\"xy\",\"EditableAxisLabel\":\"xy\",\"EllipseSeries\":\"stock\",\"Exporting\":\"plugins/exporting\",\"ExportingMenu\":\"plugins/exporting\",\"FibonacciSeries\":\"stock\",\"FibonacciTimezoneSeries\":\"stock\",\"Flow\":\"flow\",\"FlowLink\":\"flow\",\"FlowNode\":\"flow\",\"FlowNodes\":\"flow\",\"ForceDirected\":\"hierarchy\",\"FunnelSeries\":\"percent\",\"FunnelSlice\":\"percent\",\"Gantt\":\"gantt\",\"GanttCategoryAxis\":\"gantt\",\"GanttCategoryAxisRenderer\":\"gantt\",\"GanttDateAxis\":\"gantt\",\"GanttDateAxisRenderer\":\"gantt\",\"GanttSeries\":\"gantt\",\"GaplessDateAxis\":\"xy\",\"GraticuleSeries\":\"map\",\"Grid\":\"xy\",\"HeikinAshi\":\"stock\",\"Hierarchy\":\"hierarchy\",\"HierarchyLink\":\"hierarchy\",\"HierarchyNode\":\"hierarchy\",\"HorizontalLineSeries\":\"stock\",\"HorizontalRaySeries\":\"stock\",\"IconControl\":\"stock\",\"IconSeries\":\"stock\",\"Indicator\":\"stock\",\"IndicatorControl\":\"stock\",\"IntervalControl\":\"stock\",\"LabelSeries\":\"stock\",\"LineArrowSeries\":\"stock\",\"LineSeries\":\"xy\",\"LinkedHierarchy\":\"hierarchy\",\"LinkedHierarchyNode\":\"hierarchy\",\"MACD\":\"stock\",\"MACross\":\"stock\",\"MapChart\":\"map\",\"MapLine\":\"map\",\"MapLineSeries\":\"map\",\"MapPointSeries\":\"map\",\"MapPolygon\":\"map\",\"MapPolygonSeries\":\"map\",\"MapRasterSeries\":\"map\",\"MapSankeyNodes\":\"map\",\"MapSankeySeries\":\"map\",\"MapSeries\":\"map\",\"Measure\":\"stock\",\"MedianPrice\":\"stock\",\"Momentum\":\"stock\",\"MovingAverage\":\"stock\",\"MovingAverageDeviation\":\"stock\",\"MovingAverageEnvelope\":\"stock\",\"NightSeries\":\"map\",\"OHLC\":\"xy\",\"OHLCSeries\":\"xy\",\"OnBalanceVolume\":\"stock\",\"OverboughtOversold\":\"stock\",\"PVT\":\"stock\",\"Pack\":\"hierarchy\",\"PanelControls\":\"stock\",\"ParallelChannelSeries\":\"stock\",\"Partition\":\"hierarchy\",\"PercentChart\":\"percent\",\"PercentSeries\":\"percent\",\"PeriodSelector\":\"stock\",\"PictorialStackedSeries\":\"percent\",\"PieChart\":\"percent\",\"PieSeries\":\"percent\",\"PixelMapSeries\":\"map\",\"PolylineSeries\":\"stock\",\"PyramidSeries\":\"percent\",\"QuadrantLineSeries\":\"stock\",\"RadarChart\":\"radar\",\"RadarColumnSeries\":\"radar\",\"RadarCursor\":\"radar\",\"RadarLineSeries\":\"radar\",\"RectangleSeries\":\"stock\",\"RegressionSeries\":\"stock\",\"RelativeStrengthIndex\":\"stock\",\"ResetControl\":\"stock\",\"Sankey\":\"flow\",\"SankeyLink\":\"flow\",\"SankeyNodes\":\"flow\",\"Serializer\":\"plugins/json\",\"SeriesTypeControl\":\"stock\",\"SerpentineChart\":\"timeline\",\"SettingsControl\":\"stock\",\"SettingsModal\":\"stock\",\"SimpleLineSeries\":\"stock\",\"SliceGrouper\":\"plugins/sliceGrouper\",\"SlicedChart\":\"percent\",\"SmoothedRadarLineSeries\":\"radar\",\"SmoothedXLineSeries\":\"xy\",\"SmoothedXYLineSeries\":\"xy\",\"SmoothedYLineSeries\":\"xy\",\"SpiralChart\":\"timeline\",\"StandardDeviation\":\"stock\",\"StepLineSeries\":\"xy\",\"StochasticMomentumIndex\":\"stock\",\"StochasticOscillator\":\"stock\",\"StockChart\":\"stock\",\"StockControl\":\"stock\",\"StockLegend\":\"stock\",\"StockPanel\":\"stock\",\"StockToolbar\":\"stock\",\"Sunburst\":\"hierarchy\",\"SuperTrend\":\"stock\",\"Tree\":\"hierarchy\",\"Treemap\":\"hierarchy\",\"TrendLineSeries\":\"stock\",\"Trix\":\"stock\",\"TypicalPrice\":\"stock\",\"VWAP\":\"stock\",\"ValueAxis\":\"xy\",\"Venn\":\"venn\",\"VerticalLineSeries\":\"stock\",\"Volume\":\"stock\",\"VolumeProfile\":\"stock\",\"VoronoiTreemap\":\"hierarchy\",\"WilliamsR\":\"stock\",\"WordCloud\":\"wc\",\"XYChart\":\"xy\",\"XYChartScrollbar\":\"xy\",\"XYCursor\":\"xy\",\"XYSeries\":\"xy\",\"ZigZag\":\"stock\",\"ZoomControl\":\"map\"};\n\tvar scriptDependencies = {\"pie\":[\"percent\"],\"funnel\":[\"percent\"],\"radar\":[\"xy\"],\"gantt\":[\"xy\",\"plugins/colorPicker\"],\"stock\":[\"xy\"],\"timeline\":[\"xy\"],\"element\":[\"index\",\"plugins/json\"]};\n\tvar modules = {};\n\tObject.keys(classModules).forEach(function (name) {\n\t\tmodules[classModules[name]] = true;\n\t});\n\n\tvar current = 0;\n\tvar options;\n\tvar root;\n\tvar chart;\n\tvar result;\n\tvar update;\n\tvar scripts = {};\n\n\tfunction send(message) {\n\t\tvar text;\n\t\ttry {\n\t\t\ttext = JSON.stringify(message);\n\t\t} catch (error) {\n\t\t\ttext = JSON.stringify({ type: \"error\", message: \"Could not send \" + message.name + \": \" + error.message });\n\t\t}\n\t\twindow.ReactNativeWebView.postMessage(text);\n\t}\n\n\tfunction post(name, value) {\n\t\tsend({ type: \"message\", name: String(name), value: value });\n\t}\n\n\tfunction fail(error) {\n\t\tsend({ type: \"error\", message: String(error && error.message ? error.message : error) });\n\t}\n\n\twindow.addEventListener(\"error\", function (event) {\n\t\tfail(event.error || event.message);\n\t});\n\n\twindow.addEventListener(\"unhandledrejection\", function (event) {\n\t\tfail(event.reason);\n\t});\n\n\t// A geodata global's file: am5geodata_region_world_europeLow > geodata/region/world/europeLow\n\tfunction geodataModule(name) {\n\t\treturn \"geodata/\" + (/^lang_/.test(name) ? \"lang/\" + name.slice(5) : name.replace(/_/g, \"/\"));\n\t}\n\n\t// A global's file: am5xy > xy, am5plugins_exporting > plugins/exporting,\n\t// am5fonts_notosans_sc > fonts/notosans-sc\n\tfunction globalModule(name) {\n\t\tvar rest = name.slice(3);\n\t\tvar match = /^(themes|plugins|locales)_(.+)$/.exec(rest);\n\t\tif (match) {\n\t\t\treturn match[1] + \"/\" + match[2];\n\t\t}\n\t\tif (/^fonts_./.test(rest)) {\n\t\t\treturn \"fonts/\" + rest.slice(6).replace(/_/g, \"-\");\n\t\t}\n\t\tif (/^geodata_./.test(rest)) {\n\t\t\treturn geodataModule(rest.slice(8));\n\t\t}\n\t\treturn modules[rest] ? rest : undefined;\n\t}\n\n\tfunction add(list, name) {\n\t\tif (!name || name === \"index\" || list.indexOf(name) !== -1) {\n\t\t\treturn;\n\t\t}\n\t\t(scriptDependencies[name] || []).forEach(function (dependency) {\n\t\t\tadd(list, dependency);\n\t\t});\n\t\tlist.push(name);\n\t}\n\n\t// The files a config needs: its classes, and geodata named by its global\n\tfunction addConfig(list, value) {\n\t\tif (typeof value === \"string\") {\n\t\t\tif (/^am5geodata_[A-Za-z0-9_]+$/.test(value)) {\n\t\t\t\tadd(list, geodataModule(value.slice(11)));\n\t\t\t}\n\t\t}\n\t\telse if (Array.isArray(value)) {\n\t\t\tvalue.forEach(function (item) {\n\t\t\t\taddConfig(list, item);\n\t\t\t});\n\t\t}\n\t\telse if (value && typeof value === \"object\") {\n\t\t\tif (typeof value.type === \"string\") {\n\t\t\t\tadd(list, classModules[value.type]);\n\t\t\t}\n\t\t\tObject.keys(value).forEach(function (key) {\n\t\t\t\taddConfig(list, value[key]);\n\t\t\t});\n\t\t}\n\t}\n\n\t// The files code needs, from the globals it uses, and the classes of a\n\t// config it gives the JSON parser\n\tfunction addCode(list, code) {\n\t\t(code.match(/\\bam5[A-Za-z0-9_]*/g) || []).forEach(function (name) {\n\t\t\tadd(list, globalModule(name));\n\t\t});\n\t\tif (code.indexOf(\"am5plugins_json\") !== -1) {\n\t\t\t(code.match(/\\btype[\"']?\\s*:\\s*[\"'][A-Za-z0-9_]+[\"']/g) || []).forEach(function (match) {\n\t\t\t\tadd(list, classModules[/[\"']([A-Za-z0-9_]+)[\"']$/.exec(match)[1]]);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Its own scope, so that it may declare `data` or `root` itself\n\tfunction compile(names, code) {\n\t\treturn new Function(names.join(\",\"), \"return (function () {\\n\" + code + \"\\n})();\");\n\t}\n\n\tfunction url(name) {\n\t\tif (/^[a-z]+:/i.test(name)) {\n\t\t\treturn name;\n\t\t}\n\t\tif (name.indexOf(\"geodata/\") === 0) {\n\t\t\treturn options.geodataUrl + name.slice(8) + \".js\";\n\t\t}\n\t\tif (name.indexOf(\"fonts/\") === 0) {\n\t\t\treturn options.fontsUrl + name.slice(6) + \".js\";\n\t\t}\n\t\treturn options.libraryUrl + name + \".js\";\n\t}\n\n\t// Downloaded side by side, run in order\n\tfunction load(src) {\n\t\tif (!scripts[src]) {\n\t\t\tscripts[src] = new Promise(function (resolve, reject) {\n\t\t\t\tvar script = document.createElement(\"script\");\n\t\t\t\tscript.src = src;\n\t\t\t\tscript.async = false;\n\t\t\t\tscript.onload = function () {\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\t\t\t\tscript.onerror = function () {\n\t\t\t\t\tdelete scripts[src];\n\t\t\t\t\treject(new Error(\"Could not load \" + src));\n\t\t\t\t};\n\t\t\t\tdocument.head.appendChild(script);\n\t\t\t});\n\t\t}\n\t\treturn scripts[src];\n\t}\n\n\tfunction dispose() {\n\t\tif (root) {\n\t\t\troot.dispose();\n\t\t}\n\t\troot = undefined;\n\t\tchart = undefined;\n\t\tresult = undefined;\n\t\tupdate = undefined;\n\t}\n\n\tfunction build(next) {\n\t\tvar id = ++current;\n\t\toptions = next;\n\t\tdispose();\n\n\t\tvar list = [];\n\t\tif (next.config !== undefined) {\n\t\t\tadd(list, \"plugins/json\");\n\t\t\taddConfig(list, next.config);\n\t\t}\n\t\telse {\n\t\t\taddCode(list, next.code || \"\");\n\t\t}\n\t\tnext.themes.forEach(function (name) {\n\t\t\tadd(list, \"themes/\" + name);\n\t\t});\n\t\tnext.modules.forEach(function (name) {\n\t\t\tadd(list, name);\n\t\t});\n\n\t\treturn Promise.all([\"index\"].concat(list).map(function (name) {\n\t\t\treturn load(url(name));\n\t\t})).then(function () {\n\t\t\tif (id !== current) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar am5 = window.am5;\n\t\t\tvar settings = {};\n\t\t\tif (next.renderer === \"svg\") {\n\t\t\t\tif (!am5.SVGRenderer) {\n\t\t\t\t\tthrow new Error(\"renderer=\\\"svg\\\" needs amCharts 5.21.0 or later\");\n\t\t\t\t}\n\t\t\t\tsettings.renderer = am5.SVGRenderer;\n\t\t\t}\n\n\t\t\tvar themes = next.themes.map(function (name) {\n\t\t\t\tvar theme = window[\"am5themes_\" + name];\n\t\t\t\tif (!theme) {\n\t\t\t\t\tthrow new Error(\"No theme \" + name);\n\t\t\t\t}\n\t\t\t\treturn theme;\n\t\t\t});\n\n\t\t\t// Before the root: it decides on the logo when it is made\n\t\t\t(next.licenses || []).forEach(function (license) {\n\t\t\t\tif (am5.registry.licenses.indexOf(license) === -1) {\n\t\t\t\t\tam5.addLicense(license);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\troot = am5.Root.new(\"chart\", settings);\n\t\t\troot.setThemes(themes.map(function (theme) {\n\t\t\t\treturn theme.new(root);\n\t\t\t}));\n\n\t\t\tif (next.config !== undefined) {\n\t\t\t\treturn window.am5plugins_json.JsonParser.new(root).parse(next.config, { parent: root.container }).then(function (parsed) {\n\t\t\t\t\tif (id === current) {\n\t\t\t\t\t\tchart = parsed;\n\t\t\t\t\t\tsend({ type: \"ready\" });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// A promise it returns is waited for\n\t\t\treturn Promise.resolve(compile([\"root\", \"data\", \"post\"], next.code || \"\")(root, next.data, post)).then(function (value) {\n\t\t\t\tif (id === current) {\n\t\t\t\t\tresult = value;\n\t\t\t\t\tif (typeof value === \"function\") {\n\t\t\t\t\t\tupdate = value;\n\t\t\t\t\t}\n\t\t\t\t\tsend({ type: \"ready\" });\n\t\t\t\t}\n\t\t\t});\n\n\t\t}).catch(function (error) {\n\t\t\tif (id === current) {\n\t\t\t\tdispose();\n\t\t\t\tfail(error);\n\t\t\t}\n\t\t});\n\t}\n\n\twindow.amChartPage = {\n\t\tbuild: build,\n\n\t\t// New data: to the function the code returned, or the chart is made\n\t\t// again. A config chart only keeps it, for run()\n\t\tdata: function (data) {\n\t\t\tif (!options) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\toptions.data = data;\n\t\t\tif (options.config !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (update) {\n\t\t\t\ttry {\n\t\t\t\t\tupdate(data);\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tfail(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbuild(options);\n\t\t\t}\n\t\t},\n\n\t\trun: function (code) {\n\t\t\ttry {\n\t\t\t\tcompile([\"root\", \"chart\", \"result\", \"data\", \"post\"], code)(root, chart, result, options ? options.data : undefined, post);\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\tfail(error);\n\t\t\t}\n\t\t}\n\t};\n\n\tsend({ type: \"loaded\" });\n})();\n</script>\n</body>\n</html>\n";
|
|
5
|
+
exports.libraryVersion = "5.21.5";
|
|
6
|
+
exports.pageHtml = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\">\n<style>\nhtml, body, #chart {\n\tmargin: 0;\n\tpadding: 0;\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n\tbackground: transparent;\n}\nbody {\n\t-webkit-tap-highlight-color: transparent;\n\t-webkit-touch-callout: none;\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n</style>\n</head>\n<body>\n<div id=\"chart\"></div>\n<script>\n(function () {\n\t\"use strict\";\n\n\t// Which script file has each class, and which files a file needs first\n\tvar classModules = {\"AccelerationBands\":\"stock\",\"AccumulationDistribution\":\"stock\",\"AccumulativeSwingIndex\":\"stock\",\"Annotator\":\"plugins/exporting\",\"ArcDiagram\":\"flow\",\"ArcDiagramLink\":\"flow\",\"ArcDiagramNodes\":\"flow\",\"Aroon\":\"stock\",\"AverageSeries\":\"stock\",\"AverageTrueRange\":\"stock\",\"AwesomeOscillator\":\"stock\",\"Axis\":\"xy\",\"AxisBullet\":\"xy\",\"AxisLabel\":\"xy\",\"AxisLabelRadial\":\"xy\",\"AxisRenderer\":\"xy\",\"AxisRendererCircular\":\"radar\",\"AxisRendererCurveX\":\"timeline\",\"AxisRendererCurveY\":\"timeline\",\"AxisRendererRadial\":\"radar\",\"AxisRendererX\":\"xy\",\"AxisRendererY\":\"xy\",\"AxisTick\":\"xy\",\"BaseColumnSeries\":\"xy\",\"BollingerBands\":\"stock\",\"BreadcrumbBar\":\"hierarchy\",\"BullBearPower\":\"stock\",\"CalloutSeries\":\"stock\",\"Candlestick\":\"xy\",\"CandlestickSeries\":\"xy\",\"CategoryAxis\":\"xy\",\"CategoryDateAxis\":\"xy\",\"ChaikinMoneyFlow\":\"stock\",\"ChaikinOscillator\":\"stock\",\"ChartIndicator\":\"stock\",\"ChartSerializer\":\"plugins/json\",\"Chord\":\"flow\",\"ChordDirected\":\"flow\",\"ChordLink\":\"flow\",\"ChordLinkDirected\":\"flow\",\"ChordNodes\":\"flow\",\"ChordNonRibbon\":\"flow\",\"ClockHand\":\"radar\",\"ClusteredPointSeries\":\"map\",\"ColorControl\":\"stock\",\"ColorPicker\":\"plugins/colorPicker\",\"ColorPickerButton\":\"plugins/colorPicker\",\"ColumnSeries\":\"xy\",\"CommodityChannelIndex\":\"stock\",\"ComparisonControl\":\"stock\",\"CurveChart\":\"timeline\",\"CurveColumnSeries\":\"timeline\",\"CurveCursor\":\"timeline\",\"CurveLineSeries\":\"timeline\",\"DataSaveControl\":\"stock\",\"DateAxis\":\"xy\",\"DateRangeSelector\":\"stock\",\"DisparityIndex\":\"stock\",\"DoodleSeries\":\"stock\",\"DrawingControl\":\"stock\",\"DrawingSeries\":\"stock\",\"DrawingToolControl\":\"stock\",\"Dropdown\":\"stock\",\"DropdownColors\":\"stock\",\"DropdownControl\":\"stock\",\"DropdownList\":\"stock\",\"DropdownListControl\":\"stock\",\"DurationAxis\":\"xy\",\"EditableAxisLabel\":\"xy\",\"EllipseSeries\":\"stock\",\"Exporting\":\"plugins/exporting\",\"ExportingMenu\":\"plugins/exporting\",\"FibonacciSeries\":\"stock\",\"FibonacciTimezoneSeries\":\"stock\",\"Flow\":\"flow\",\"FlowLink\":\"flow\",\"FlowNode\":\"flow\",\"FlowNodes\":\"flow\",\"ForceDirected\":\"hierarchy\",\"FunnelSeries\":\"percent\",\"FunnelSlice\":\"percent\",\"Gantt\":\"gantt\",\"GanttCategoryAxis\":\"gantt\",\"GanttCategoryAxisRenderer\":\"gantt\",\"GanttDateAxis\":\"gantt\",\"GanttDateAxisRenderer\":\"gantt\",\"GanttSeries\":\"gantt\",\"GaplessDateAxis\":\"xy\",\"GraticuleSeries\":\"map\",\"Grid\":\"xy\",\"HeikinAshi\":\"stock\",\"Hierarchy\":\"hierarchy\",\"HierarchyLink\":\"hierarchy\",\"HierarchyNode\":\"hierarchy\",\"HorizontalLineSeries\":\"stock\",\"HorizontalRaySeries\":\"stock\",\"IconControl\":\"stock\",\"IconSeries\":\"stock\",\"Indicator\":\"stock\",\"IndicatorControl\":\"stock\",\"IntervalControl\":\"stock\",\"LabelSeries\":\"stock\",\"LineArrowSeries\":\"stock\",\"LineSeries\":\"xy\",\"LinkedHierarchy\":\"hierarchy\",\"LinkedHierarchyNode\":\"hierarchy\",\"MACD\":\"stock\",\"MACross\":\"stock\",\"MapChart\":\"map\",\"MapLine\":\"map\",\"MapLineSeries\":\"map\",\"MapPointSeries\":\"map\",\"MapPolygon\":\"map\",\"MapPolygonSeries\":\"map\",\"MapRasterSeries\":\"map\",\"MapSankeyNodes\":\"map\",\"MapSankeySeries\":\"map\",\"MapSeries\":\"map\",\"Measure\":\"stock\",\"MedianPrice\":\"stock\",\"Momentum\":\"stock\",\"MovingAverage\":\"stock\",\"MovingAverageDeviation\":\"stock\",\"MovingAverageEnvelope\":\"stock\",\"NightSeries\":\"map\",\"OHLC\":\"xy\",\"OHLCSeries\":\"xy\",\"OnBalanceVolume\":\"stock\",\"OverboughtOversold\":\"stock\",\"PVT\":\"stock\",\"Pack\":\"hierarchy\",\"PanelControls\":\"stock\",\"ParallelChannelSeries\":\"stock\",\"Partition\":\"hierarchy\",\"PercentChart\":\"percent\",\"PercentSeries\":\"percent\",\"PeriodSelector\":\"stock\",\"PictorialStackedSeries\":\"percent\",\"PieChart\":\"percent\",\"PieSeries\":\"percent\",\"PixelMapSeries\":\"map\",\"PolylineSeries\":\"stock\",\"PyramidSeries\":\"percent\",\"QuadrantLineSeries\":\"stock\",\"RadarChart\":\"radar\",\"RadarColumnSeries\":\"radar\",\"RadarCursor\":\"radar\",\"RadarLineSeries\":\"radar\",\"RectangleSeries\":\"stock\",\"RegressionSeries\":\"stock\",\"RelativeStrengthIndex\":\"stock\",\"ResetControl\":\"stock\",\"Sankey\":\"flow\",\"SankeyLink\":\"flow\",\"SankeyNodes\":\"flow\",\"Serializer\":\"plugins/json\",\"SeriesTypeControl\":\"stock\",\"SerpentineChart\":\"timeline\",\"SettingsControl\":\"stock\",\"SettingsModal\":\"stock\",\"SimpleLineSeries\":\"stock\",\"SliceGrouper\":\"plugins/sliceGrouper\",\"SlicedChart\":\"percent\",\"SmoothedRadarLineSeries\":\"radar\",\"SmoothedXLineSeries\":\"xy\",\"SmoothedXYLineSeries\":\"xy\",\"SmoothedYLineSeries\":\"xy\",\"SpiralChart\":\"timeline\",\"StandardDeviation\":\"stock\",\"StepLineSeries\":\"xy\",\"StochasticMomentumIndex\":\"stock\",\"StochasticOscillator\":\"stock\",\"StockChart\":\"stock\",\"StockControl\":\"stock\",\"StockLegend\":\"stock\",\"StockPanel\":\"stock\",\"StockToolbar\":\"stock\",\"Sunburst\":\"hierarchy\",\"SuperTrend\":\"stock\",\"Tree\":\"hierarchy\",\"Treemap\":\"hierarchy\",\"TrendLineSeries\":\"stock\",\"Trix\":\"stock\",\"TypicalPrice\":\"stock\",\"VWAP\":\"stock\",\"ValueAxis\":\"xy\",\"Venn\":\"venn\",\"VerticalLineSeries\":\"stock\",\"Volume\":\"stock\",\"VolumeProfile\":\"stock\",\"VoronoiTreemap\":\"hierarchy\",\"WilliamsR\":\"stock\",\"WordCloud\":\"wc\",\"XYChart\":\"xy\",\"XYChartScrollbar\":\"xy\",\"XYCursor\":\"xy\",\"XYSeries\":\"xy\",\"ZigZag\":\"stock\",\"ZoomControl\":\"map\"};\n\tvar scriptDependencies = {\"pie\":[\"percent\"],\"funnel\":[\"percent\"],\"radar\":[\"xy\"],\"gantt\":[\"xy\",\"plugins/colorPicker\"],\"stock\":[\"xy\"],\"timeline\":[\"xy\"],\"element\":[\"index\",\"plugins/json\"]};\n\tvar modules = {};\n\tObject.keys(classModules).forEach(function (name) {\n\t\tmodules[classModules[name]] = true;\n\t});\n\n\tvar current = 0;\n\tvar options;\n\tvar root;\n\tvar chart;\n\tvar result;\n\tvar update;\n\tvar scripts = {};\n\n\tfunction send(message) {\n\t\tvar text;\n\t\ttry {\n\t\t\ttext = JSON.stringify(message);\n\t\t} catch (error) {\n\t\t\ttext = JSON.stringify({ type: \"error\", message: \"Could not send \" + message.name + \": \" + error.message });\n\t\t}\n\t\twindow.ReactNativeWebView.postMessage(text);\n\t}\n\n\tfunction post(name, value) {\n\t\tsend({ type: \"message\", name: String(name), value: value });\n\t}\n\n\tfunction fail(error) {\n\t\tsend({ type: \"error\", message: String(error && error.message ? error.message : error) });\n\t}\n\n\twindow.addEventListener(\"error\", function (event) {\n\t\tfail(event.error || event.message);\n\t});\n\n\twindow.addEventListener(\"unhandledrejection\", function (event) {\n\t\tfail(event.reason);\n\t});\n\n\t// A geodata global's file: am5geodata_region_world_europeLow > geodata/region/world/europeLow\n\tfunction geodataModule(name) {\n\t\treturn \"geodata/\" + (/^lang_/.test(name) ? \"lang/\" + name.slice(5) : name.replace(/_/g, \"/\"));\n\t}\n\n\t// A global's file: am5xy > xy, am5plugins_exporting > plugins/exporting,\n\t// am5fonts_notosans_sc > fonts/notosans-sc\n\tfunction globalModule(name) {\n\t\tvar rest = name.slice(3);\n\t\tvar match = /^(themes|plugins|locales)_(.+)$/.exec(rest);\n\t\tif (match) {\n\t\t\treturn match[1] + \"/\" + match[2];\n\t\t}\n\t\tif (/^fonts_./.test(rest)) {\n\t\t\treturn \"fonts/\" + rest.slice(6).replace(/_/g, \"-\");\n\t\t}\n\t\tif (/^geodata_./.test(rest)) {\n\t\t\treturn geodataModule(rest.slice(8));\n\t\t}\n\t\treturn modules[rest] ? rest : undefined;\n\t}\n\n\t// A theme is a name, or [name, settings]\n\tfunction themeName(theme) {\n\t\treturn Array.isArray(theme) ? theme[0] : theme;\n\t}\n\n\tfunction add(list, name) {\n\t\tif (!name || name === \"index\" || list.indexOf(name) !== -1) {\n\t\t\treturn;\n\t\t}\n\t\t(scriptDependencies[name] || []).forEach(function (dependency) {\n\t\t\tadd(list, dependency);\n\t\t});\n\t\tlist.push(name);\n\t}\n\n\t// The files a config needs: its classes, and geodata named by its global\n\tfunction addConfig(list, value) {\n\t\tif (typeof value === \"string\") {\n\t\t\tif (/^am5geodata_[A-Za-z0-9_]+$/.test(value)) {\n\t\t\t\tadd(list, geodataModule(value.slice(11)));\n\t\t\t}\n\t\t}\n\t\telse if (Array.isArray(value)) {\n\t\t\tvalue.forEach(function (item) {\n\t\t\t\taddConfig(list, item);\n\t\t\t});\n\t\t}\n\t\telse if (value && typeof value === \"object\") {\n\t\t\tif (typeof value.type === \"string\") {\n\t\t\t\tadd(list, classModules[value.type]);\n\t\t\t}\n\t\t\tObject.keys(value).forEach(function (key) {\n\t\t\t\taddConfig(list, value[key]);\n\t\t\t});\n\t\t}\n\t}\n\n\t// The files code needs, from the globals it uses, and the classes of a\n\t// config it gives the JSON parser\n\tfunction addCode(list, code) {\n\t\t(code.match(/\\bam5[A-Za-z0-9_]*/g) || []).forEach(function (name) {\n\t\t\tadd(list, globalModule(name));\n\t\t});\n\t\tif (code.indexOf(\"am5plugins_json\") !== -1) {\n\t\t\t(code.match(/\\btype[\"']?\\s*:\\s*[\"'][A-Za-z0-9_]+[\"']/g) || []).forEach(function (match) {\n\t\t\t\tadd(list, classModules[/[\"']([A-Za-z0-9_]+)[\"']$/.exec(match)[1]]);\n\t\t\t});\n\t\t}\n\t}\n\n\t// Its own scope, so that it may declare `data` or `root` itself\n\tfunction compile(names, code) {\n\t\treturn new Function(names.join(\",\"), \"return (function () {\\n\" + code + \"\\n})();\");\n\t}\n\n\tfunction url(name) {\n\t\tif (/^[a-z]+:/i.test(name)) {\n\t\t\treturn name;\n\t\t}\n\t\tif (name.indexOf(\"geodata/\") === 0) {\n\t\t\treturn options.geodataUrl + name.slice(8) + \".js\";\n\t\t}\n\t\tif (name.indexOf(\"fonts/\") === 0) {\n\t\t\treturn options.fontsUrl + name.slice(6) + \".js\";\n\t\t}\n\t\treturn options.libraryUrl + name + \".js\";\n\t}\n\n\t// Downloaded side by side, run in order\n\tfunction load(src) {\n\t\tif (!scripts[src]) {\n\t\t\tscripts[src] = new Promise(function (resolve, reject) {\n\t\t\t\tvar script = document.createElement(\"script\");\n\t\t\t\tscript.src = src;\n\t\t\t\tscript.async = false;\n\t\t\t\tscript.onload = function () {\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\t\t\t\tscript.onerror = function () {\n\t\t\t\t\tdelete scripts[src];\n\t\t\t\t\treject(new Error(\"Could not load \" + src));\n\t\t\t\t};\n\t\t\t\tdocument.head.appendChild(script);\n\t\t\t});\n\t\t}\n\t\treturn scripts[src];\n\t}\n\n\tfunction dispose() {\n\t\tif (root) {\n\t\t\troot.dispose();\n\t\t}\n\t\troot = undefined;\n\t\tchart = undefined;\n\t\tresult = undefined;\n\t\tupdate = undefined;\n\t}\n\n\tfunction build(next) {\n\t\tvar id = ++current;\n\t\toptions = next;\n\t\tdispose();\n\n\t\tvar list = [];\n\t\tif (next.config !== undefined) {\n\t\t\tadd(list, \"plugins/json\");\n\t\t\taddConfig(list, next.config);\n\t\t}\n\t\telse {\n\t\t\taddCode(list, next.code || \"\");\n\t\t}\n\t\tnext.themes.forEach(function (theme) {\n\t\t\tadd(list, \"themes/\" + themeName(theme));\n\t\t});\n\t\tnext.modules.forEach(function (name) {\n\t\t\tadd(list, name);\n\t\t});\n\n\t\treturn Promise.all([\"index\"].concat(list).map(function (name) {\n\t\t\treturn load(url(name));\n\t\t})).then(function () {\n\t\t\tif (id !== current) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar am5 = window.am5;\n\t\t\tvar settings = {};\n\t\t\tif (next.renderer === \"svg\") {\n\t\t\t\tif (!am5.SVGRenderer) {\n\t\t\t\t\tthrow new Error(\"renderer=\\\"svg\\\" needs amCharts 5.21.0 or later\");\n\t\t\t\t}\n\t\t\t\tsettings.renderer = am5.SVGRenderer;\n\t\t\t}\n\n\t\t\tvar themes = next.themes.map(function (entry) {\n\t\t\t\tvar name = themeName(entry);\n\t\t\t\tvar theme = window[\"am5themes_\" + name];\n\t\t\t\tif (!theme) {\n\t\t\t\t\tthrow new Error(\"No theme \" + name);\n\t\t\t\t}\n\t\t\t\treturn { theme: theme, settings: Array.isArray(entry) ? entry[1] : undefined };\n\t\t\t});\n\n\t\t\t// Before the root: it decides on the logo when it is made\n\t\t\t(next.licenses || []).forEach(function (license) {\n\t\t\t\tif (am5.registry.licenses.indexOf(license) === -1) {\n\t\t\t\t\tam5.addLicense(license);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\troot = am5.Root.new(\"chart\", settings);\n\t\t\troot.setThemes(themes.map(function (entry) {\n\t\t\t\treturn entry.settings ? entry.theme.new(root, entry.settings) : entry.theme.new(root);\n\t\t\t}));\n\n\t\t\tif (next.config !== undefined) {\n\t\t\t\treturn window.am5plugins_json.JsonParser.new(root).parse(next.config, { parent: root.container }).then(function (parsed) {\n\t\t\t\t\tif (id === current) {\n\t\t\t\t\t\tchart = parsed;\n\t\t\t\t\t\tsend({ type: \"ready\" });\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// A promise it returns is waited for\n\t\t\treturn Promise.resolve(compile([\"root\", \"data\", \"post\"], next.code || \"\")(root, next.data, post)).then(function (value) {\n\t\t\t\tif (id === current) {\n\t\t\t\t\tresult = value;\n\t\t\t\t\tif (typeof value === \"function\") {\n\t\t\t\t\t\tupdate = value;\n\t\t\t\t\t}\n\t\t\t\t\tsend({ type: \"ready\" });\n\t\t\t\t}\n\t\t\t});\n\n\t\t}).catch(function (error) {\n\t\t\tif (id === current) {\n\t\t\t\tdispose();\n\t\t\t\tfail(error);\n\t\t\t}\n\t\t});\n\t}\n\n\twindow.amChartPage = {\n\t\tbuild: build,\n\n\t\t// New data: to the function the code returned, or the chart is made\n\t\t// again. A config chart only keeps it, for run()\n\t\tdata: function (data) {\n\t\t\tif (!options) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\toptions.data = data;\n\t\t\tif (options.config !== undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (update) {\n\t\t\t\ttry {\n\t\t\t\t\tupdate(data);\n\t\t\t\t}\n\t\t\t\tcatch (error) {\n\t\t\t\t\tfail(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbuild(options);\n\t\t\t}\n\t\t},\n\n\t\trun: function (code) {\n\t\t\ttry {\n\t\t\t\tcompile([\"root\", \"chart\", \"result\", \"data\", \"post\"], code)(root, chart, result, options ? options.data : undefined, post);\n\t\t\t}\n\t\t\tcatch (error) {\n\t\t\t\tfail(error);\n\t\t\t}\n\t\t}\n\t};\n\n\tsend({ type: \"loaded\" });\n})();\n</script>\n</body>\n</html>\n";
|
|
7
7
|
//# sourceMappingURL=generated.js.map
|
package/dist/generated.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../src/generated.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AACrB,QAAA,cAAc,GAAW,QAAQ,CAAC;AAClC,QAAA,QAAQ,GAAW,4+bAA4+b,CAAC","sourcesContent":["// Written by scripts/generate.cjs\nexport const libraryVersion: string = \"5.21.3\";\nexport const pageHtml: string = \"<!DOCTYPE html>\\n<html>\\n<head>\\n<meta charset=\\\"utf-8\\\">\\n<meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\\\">\\n<style>\\nhtml, body, #chart {\\n\\tmargin: 0;\\n\\tpadding: 0;\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\toverflow: hidden;\\n\\tbackground: transparent;\\n}\\nbody {\\n\\t-webkit-tap-highlight-color: transparent;\\n\\t-webkit-touch-callout: none;\\n\\t-webkit-user-select: none;\\n\\tuser-select: none;\\n}\\n</style>\\n</head>\\n<body>\\n<div id=\\\"chart\\\"></div>\\n<script>\\n(function () {\\n\\t\\\"use strict\\\";\\n\\n\\t// Which script file has each class, and which files a file needs first\\n\\tvar classModules = {\\\"AccelerationBands\\\":\\\"stock\\\",\\\"AccumulationDistribution\\\":\\\"stock\\\",\\\"AccumulativeSwingIndex\\\":\\\"stock\\\",\\\"Annotator\\\":\\\"plugins/exporting\\\",\\\"ArcDiagram\\\":\\\"flow\\\",\\\"ArcDiagramLink\\\":\\\"flow\\\",\\\"ArcDiagramNodes\\\":\\\"flow\\\",\\\"Aroon\\\":\\\"stock\\\",\\\"AverageSeries\\\":\\\"stock\\\",\\\"AverageTrueRange\\\":\\\"stock\\\",\\\"AwesomeOscillator\\\":\\\"stock\\\",\\\"Axis\\\":\\\"xy\\\",\\\"AxisBullet\\\":\\\"xy\\\",\\\"AxisLabel\\\":\\\"xy\\\",\\\"AxisLabelRadial\\\":\\\"xy\\\",\\\"AxisRenderer\\\":\\\"xy\\\",\\\"AxisRendererCircular\\\":\\\"radar\\\",\\\"AxisRendererCurveX\\\":\\\"timeline\\\",\\\"AxisRendererCurveY\\\":\\\"timeline\\\",\\\"AxisRendererRadial\\\":\\\"radar\\\",\\\"AxisRendererX\\\":\\\"xy\\\",\\\"AxisRendererY\\\":\\\"xy\\\",\\\"AxisTick\\\":\\\"xy\\\",\\\"BaseColumnSeries\\\":\\\"xy\\\",\\\"BollingerBands\\\":\\\"stock\\\",\\\"BreadcrumbBar\\\":\\\"hierarchy\\\",\\\"BullBearPower\\\":\\\"stock\\\",\\\"CalloutSeries\\\":\\\"stock\\\",\\\"Candlestick\\\":\\\"xy\\\",\\\"CandlestickSeries\\\":\\\"xy\\\",\\\"CategoryAxis\\\":\\\"xy\\\",\\\"CategoryDateAxis\\\":\\\"xy\\\",\\\"ChaikinMoneyFlow\\\":\\\"stock\\\",\\\"ChaikinOscillator\\\":\\\"stock\\\",\\\"ChartIndicator\\\":\\\"stock\\\",\\\"ChartSerializer\\\":\\\"plugins/json\\\",\\\"Chord\\\":\\\"flow\\\",\\\"ChordDirected\\\":\\\"flow\\\",\\\"ChordLink\\\":\\\"flow\\\",\\\"ChordLinkDirected\\\":\\\"flow\\\",\\\"ChordNodes\\\":\\\"flow\\\",\\\"ChordNonRibbon\\\":\\\"flow\\\",\\\"ClockHand\\\":\\\"radar\\\",\\\"ClusteredPointSeries\\\":\\\"map\\\",\\\"ColorControl\\\":\\\"stock\\\",\\\"ColorPicker\\\":\\\"plugins/colorPicker\\\",\\\"ColorPickerButton\\\":\\\"plugins/colorPicker\\\",\\\"ColumnSeries\\\":\\\"xy\\\",\\\"CommodityChannelIndex\\\":\\\"stock\\\",\\\"ComparisonControl\\\":\\\"stock\\\",\\\"CurveChart\\\":\\\"timeline\\\",\\\"CurveColumnSeries\\\":\\\"timeline\\\",\\\"CurveCursor\\\":\\\"timeline\\\",\\\"CurveLineSeries\\\":\\\"timeline\\\",\\\"DataSaveControl\\\":\\\"stock\\\",\\\"DateAxis\\\":\\\"xy\\\",\\\"DateRangeSelector\\\":\\\"stock\\\",\\\"DisparityIndex\\\":\\\"stock\\\",\\\"DoodleSeries\\\":\\\"stock\\\",\\\"DrawingControl\\\":\\\"stock\\\",\\\"DrawingSeries\\\":\\\"stock\\\",\\\"DrawingToolControl\\\":\\\"stock\\\",\\\"Dropdown\\\":\\\"stock\\\",\\\"DropdownColors\\\":\\\"stock\\\",\\\"DropdownControl\\\":\\\"stock\\\",\\\"DropdownList\\\":\\\"stock\\\",\\\"DropdownListControl\\\":\\\"stock\\\",\\\"DurationAxis\\\":\\\"xy\\\",\\\"EditableAxisLabel\\\":\\\"xy\\\",\\\"EllipseSeries\\\":\\\"stock\\\",\\\"Exporting\\\":\\\"plugins/exporting\\\",\\\"ExportingMenu\\\":\\\"plugins/exporting\\\",\\\"FibonacciSeries\\\":\\\"stock\\\",\\\"FibonacciTimezoneSeries\\\":\\\"stock\\\",\\\"Flow\\\":\\\"flow\\\",\\\"FlowLink\\\":\\\"flow\\\",\\\"FlowNode\\\":\\\"flow\\\",\\\"FlowNodes\\\":\\\"flow\\\",\\\"ForceDirected\\\":\\\"hierarchy\\\",\\\"FunnelSeries\\\":\\\"percent\\\",\\\"FunnelSlice\\\":\\\"percent\\\",\\\"Gantt\\\":\\\"gantt\\\",\\\"GanttCategoryAxis\\\":\\\"gantt\\\",\\\"GanttCategoryAxisRenderer\\\":\\\"gantt\\\",\\\"GanttDateAxis\\\":\\\"gantt\\\",\\\"GanttDateAxisRenderer\\\":\\\"gantt\\\",\\\"GanttSeries\\\":\\\"gantt\\\",\\\"GaplessDateAxis\\\":\\\"xy\\\",\\\"GraticuleSeries\\\":\\\"map\\\",\\\"Grid\\\":\\\"xy\\\",\\\"HeikinAshi\\\":\\\"stock\\\",\\\"Hierarchy\\\":\\\"hierarchy\\\",\\\"HierarchyLink\\\":\\\"hierarchy\\\",\\\"HierarchyNode\\\":\\\"hierarchy\\\",\\\"HorizontalLineSeries\\\":\\\"stock\\\",\\\"HorizontalRaySeries\\\":\\\"stock\\\",\\\"IconControl\\\":\\\"stock\\\",\\\"IconSeries\\\":\\\"stock\\\",\\\"Indicator\\\":\\\"stock\\\",\\\"IndicatorControl\\\":\\\"stock\\\",\\\"IntervalControl\\\":\\\"stock\\\",\\\"LabelSeries\\\":\\\"stock\\\",\\\"LineArrowSeries\\\":\\\"stock\\\",\\\"LineSeries\\\":\\\"xy\\\",\\\"LinkedHierarchy\\\":\\\"hierarchy\\\",\\\"LinkedHierarchyNode\\\":\\\"hierarchy\\\",\\\"MACD\\\":\\\"stock\\\",\\\"MACross\\\":\\\"stock\\\",\\\"MapChart\\\":\\\"map\\\",\\\"MapLine\\\":\\\"map\\\",\\\"MapLineSeries\\\":\\\"map\\\",\\\"MapPointSeries\\\":\\\"map\\\",\\\"MapPolygon\\\":\\\"map\\\",\\\"MapPolygonSeries\\\":\\\"map\\\",\\\"MapRasterSeries\\\":\\\"map\\\",\\\"MapSankeyNodes\\\":\\\"map\\\",\\\"MapSankeySeries\\\":\\\"map\\\",\\\"MapSeries\\\":\\\"map\\\",\\\"Measure\\\":\\\"stock\\\",\\\"MedianPrice\\\":\\\"stock\\\",\\\"Momentum\\\":\\\"stock\\\",\\\"MovingAverage\\\":\\\"stock\\\",\\\"MovingAverageDeviation\\\":\\\"stock\\\",\\\"MovingAverageEnvelope\\\":\\\"stock\\\",\\\"NightSeries\\\":\\\"map\\\",\\\"OHLC\\\":\\\"xy\\\",\\\"OHLCSeries\\\":\\\"xy\\\",\\\"OnBalanceVolume\\\":\\\"stock\\\",\\\"OverboughtOversold\\\":\\\"stock\\\",\\\"PVT\\\":\\\"stock\\\",\\\"Pack\\\":\\\"hierarchy\\\",\\\"PanelControls\\\":\\\"stock\\\",\\\"ParallelChannelSeries\\\":\\\"stock\\\",\\\"Partition\\\":\\\"hierarchy\\\",\\\"PercentChart\\\":\\\"percent\\\",\\\"PercentSeries\\\":\\\"percent\\\",\\\"PeriodSelector\\\":\\\"stock\\\",\\\"PictorialStackedSeries\\\":\\\"percent\\\",\\\"PieChart\\\":\\\"percent\\\",\\\"PieSeries\\\":\\\"percent\\\",\\\"PixelMapSeries\\\":\\\"map\\\",\\\"PolylineSeries\\\":\\\"stock\\\",\\\"PyramidSeries\\\":\\\"percent\\\",\\\"QuadrantLineSeries\\\":\\\"stock\\\",\\\"RadarChart\\\":\\\"radar\\\",\\\"RadarColumnSeries\\\":\\\"radar\\\",\\\"RadarCursor\\\":\\\"radar\\\",\\\"RadarLineSeries\\\":\\\"radar\\\",\\\"RectangleSeries\\\":\\\"stock\\\",\\\"RegressionSeries\\\":\\\"stock\\\",\\\"RelativeStrengthIndex\\\":\\\"stock\\\",\\\"ResetControl\\\":\\\"stock\\\",\\\"Sankey\\\":\\\"flow\\\",\\\"SankeyLink\\\":\\\"flow\\\",\\\"SankeyNodes\\\":\\\"flow\\\",\\\"Serializer\\\":\\\"plugins/json\\\",\\\"SeriesTypeControl\\\":\\\"stock\\\",\\\"SerpentineChart\\\":\\\"timeline\\\",\\\"SettingsControl\\\":\\\"stock\\\",\\\"SettingsModal\\\":\\\"stock\\\",\\\"SimpleLineSeries\\\":\\\"stock\\\",\\\"SliceGrouper\\\":\\\"plugins/sliceGrouper\\\",\\\"SlicedChart\\\":\\\"percent\\\",\\\"SmoothedRadarLineSeries\\\":\\\"radar\\\",\\\"SmoothedXLineSeries\\\":\\\"xy\\\",\\\"SmoothedXYLineSeries\\\":\\\"xy\\\",\\\"SmoothedYLineSeries\\\":\\\"xy\\\",\\\"SpiralChart\\\":\\\"timeline\\\",\\\"StandardDeviation\\\":\\\"stock\\\",\\\"StepLineSeries\\\":\\\"xy\\\",\\\"StochasticMomentumIndex\\\":\\\"stock\\\",\\\"StochasticOscillator\\\":\\\"stock\\\",\\\"StockChart\\\":\\\"stock\\\",\\\"StockControl\\\":\\\"stock\\\",\\\"StockLegend\\\":\\\"stock\\\",\\\"StockPanel\\\":\\\"stock\\\",\\\"StockToolbar\\\":\\\"stock\\\",\\\"Sunburst\\\":\\\"hierarchy\\\",\\\"SuperTrend\\\":\\\"stock\\\",\\\"Tree\\\":\\\"hierarchy\\\",\\\"Treemap\\\":\\\"hierarchy\\\",\\\"TrendLineSeries\\\":\\\"stock\\\",\\\"Trix\\\":\\\"stock\\\",\\\"TypicalPrice\\\":\\\"stock\\\",\\\"VWAP\\\":\\\"stock\\\",\\\"ValueAxis\\\":\\\"xy\\\",\\\"Venn\\\":\\\"venn\\\",\\\"VerticalLineSeries\\\":\\\"stock\\\",\\\"Volume\\\":\\\"stock\\\",\\\"VolumeProfile\\\":\\\"stock\\\",\\\"VoronoiTreemap\\\":\\\"hierarchy\\\",\\\"WilliamsR\\\":\\\"stock\\\",\\\"WordCloud\\\":\\\"wc\\\",\\\"XYChart\\\":\\\"xy\\\",\\\"XYChartScrollbar\\\":\\\"xy\\\",\\\"XYCursor\\\":\\\"xy\\\",\\\"XYSeries\\\":\\\"xy\\\",\\\"ZigZag\\\":\\\"stock\\\",\\\"ZoomControl\\\":\\\"map\\\"};\\n\\tvar scriptDependencies = {\\\"pie\\\":[\\\"percent\\\"],\\\"funnel\\\":[\\\"percent\\\"],\\\"radar\\\":[\\\"xy\\\"],\\\"gantt\\\":[\\\"xy\\\",\\\"plugins/colorPicker\\\"],\\\"stock\\\":[\\\"xy\\\"],\\\"timeline\\\":[\\\"xy\\\"],\\\"element\\\":[\\\"index\\\",\\\"plugins/json\\\"]};\\n\\tvar modules = {};\\n\\tObject.keys(classModules).forEach(function (name) {\\n\\t\\tmodules[classModules[name]] = true;\\n\\t});\\n\\n\\tvar current = 0;\\n\\tvar options;\\n\\tvar root;\\n\\tvar chart;\\n\\tvar result;\\n\\tvar update;\\n\\tvar scripts = {};\\n\\n\\tfunction send(message) {\\n\\t\\tvar text;\\n\\t\\ttry {\\n\\t\\t\\ttext = JSON.stringify(message);\\n\\t\\t} catch (error) {\\n\\t\\t\\ttext = JSON.stringify({ type: \\\"error\\\", message: \\\"Could not send \\\" + message.name + \\\": \\\" + error.message });\\n\\t\\t}\\n\\t\\twindow.ReactNativeWebView.postMessage(text);\\n\\t}\\n\\n\\tfunction post(name, value) {\\n\\t\\tsend({ type: \\\"message\\\", name: String(name), value: value });\\n\\t}\\n\\n\\tfunction fail(error) {\\n\\t\\tsend({ type: \\\"error\\\", message: String(error && error.message ? error.message : error) });\\n\\t}\\n\\n\\twindow.addEventListener(\\\"error\\\", function (event) {\\n\\t\\tfail(event.error || event.message);\\n\\t});\\n\\n\\twindow.addEventListener(\\\"unhandledrejection\\\", function (event) {\\n\\t\\tfail(event.reason);\\n\\t});\\n\\n\\t// A geodata global's file: am5geodata_region_world_europeLow > geodata/region/world/europeLow\\n\\tfunction geodataModule(name) {\\n\\t\\treturn \\\"geodata/\\\" + (/^lang_/.test(name) ? \\\"lang/\\\" + name.slice(5) : name.replace(/_/g, \\\"/\\\"));\\n\\t}\\n\\n\\t// A global's file: am5xy > xy, am5plugins_exporting > plugins/exporting,\\n\\t// am5fonts_notosans_sc > fonts/notosans-sc\\n\\tfunction globalModule(name) {\\n\\t\\tvar rest = name.slice(3);\\n\\t\\tvar match = /^(themes|plugins|locales)_(.+)$/.exec(rest);\\n\\t\\tif (match) {\\n\\t\\t\\treturn match[1] + \\\"/\\\" + match[2];\\n\\t\\t}\\n\\t\\tif (/^fonts_./.test(rest)) {\\n\\t\\t\\treturn \\\"fonts/\\\" + rest.slice(6).replace(/_/g, \\\"-\\\");\\n\\t\\t}\\n\\t\\tif (/^geodata_./.test(rest)) {\\n\\t\\t\\treturn geodataModule(rest.slice(8));\\n\\t\\t}\\n\\t\\treturn modules[rest] ? rest : undefined;\\n\\t}\\n\\n\\tfunction add(list, name) {\\n\\t\\tif (!name || name === \\\"index\\\" || list.indexOf(name) !== -1) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t(scriptDependencies[name] || []).forEach(function (dependency) {\\n\\t\\t\\tadd(list, dependency);\\n\\t\\t});\\n\\t\\tlist.push(name);\\n\\t}\\n\\n\\t// The files a config needs: its classes, and geodata named by its global\\n\\tfunction addConfig(list, value) {\\n\\t\\tif (typeof value === \\\"string\\\") {\\n\\t\\t\\tif (/^am5geodata_[A-Za-z0-9_]+$/.test(value)) {\\n\\t\\t\\t\\tadd(list, geodataModule(value.slice(11)));\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\telse if (Array.isArray(value)) {\\n\\t\\t\\tvalue.forEach(function (item) {\\n\\t\\t\\t\\taddConfig(list, item);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\telse if (value && typeof value === \\\"object\\\") {\\n\\t\\t\\tif (typeof value.type === \\\"string\\\") {\\n\\t\\t\\t\\tadd(list, classModules[value.type]);\\n\\t\\t\\t}\\n\\t\\t\\tObject.keys(value).forEach(function (key) {\\n\\t\\t\\t\\taddConfig(list, value[key]);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t}\\n\\n\\t// The files code needs, from the globals it uses, and the classes of a\\n\\t// config it gives the JSON parser\\n\\tfunction addCode(list, code) {\\n\\t\\t(code.match(/\\\\bam5[A-Za-z0-9_]*/g) || []).forEach(function (name) {\\n\\t\\t\\tadd(list, globalModule(name));\\n\\t\\t});\\n\\t\\tif (code.indexOf(\\\"am5plugins_json\\\") !== -1) {\\n\\t\\t\\t(code.match(/\\\\btype[\\\"']?\\\\s*:\\\\s*[\\\"'][A-Za-z0-9_]+[\\\"']/g) || []).forEach(function (match) {\\n\\t\\t\\t\\tadd(list, classModules[/[\\\"']([A-Za-z0-9_]+)[\\\"']$/.exec(match)[1]]);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t}\\n\\n\\t// Its own scope, so that it may declare `data` or `root` itself\\n\\tfunction compile(names, code) {\\n\\t\\treturn new Function(names.join(\\\",\\\"), \\\"return (function () {\\\\n\\\" + code + \\\"\\\\n})();\\\");\\n\\t}\\n\\n\\tfunction url(name) {\\n\\t\\tif (/^[a-z]+:/i.test(name)) {\\n\\t\\t\\treturn name;\\n\\t\\t}\\n\\t\\tif (name.indexOf(\\\"geodata/\\\") === 0) {\\n\\t\\t\\treturn options.geodataUrl + name.slice(8) + \\\".js\\\";\\n\\t\\t}\\n\\t\\tif (name.indexOf(\\\"fonts/\\\") === 0) {\\n\\t\\t\\treturn options.fontsUrl + name.slice(6) + \\\".js\\\";\\n\\t\\t}\\n\\t\\treturn options.libraryUrl + name + \\\".js\\\";\\n\\t}\\n\\n\\t// Downloaded side by side, run in order\\n\\tfunction load(src) {\\n\\t\\tif (!scripts[src]) {\\n\\t\\t\\tscripts[src] = new Promise(function (resolve, reject) {\\n\\t\\t\\t\\tvar script = document.createElement(\\\"script\\\");\\n\\t\\t\\t\\tscript.src = src;\\n\\t\\t\\t\\tscript.async = false;\\n\\t\\t\\t\\tscript.onload = function () {\\n\\t\\t\\t\\t\\tresolve();\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tscript.onerror = function () {\\n\\t\\t\\t\\t\\tdelete scripts[src];\\n\\t\\t\\t\\t\\treject(new Error(\\\"Could not load \\\" + src));\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tdocument.head.appendChild(script);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\treturn scripts[src];\\n\\t}\\n\\n\\tfunction dispose() {\\n\\t\\tif (root) {\\n\\t\\t\\troot.dispose();\\n\\t\\t}\\n\\t\\troot = undefined;\\n\\t\\tchart = undefined;\\n\\t\\tresult = undefined;\\n\\t\\tupdate = undefined;\\n\\t}\\n\\n\\tfunction build(next) {\\n\\t\\tvar id = ++current;\\n\\t\\toptions = next;\\n\\t\\tdispose();\\n\\n\\t\\tvar list = [];\\n\\t\\tif (next.config !== undefined) {\\n\\t\\t\\tadd(list, \\\"plugins/json\\\");\\n\\t\\t\\taddConfig(list, next.config);\\n\\t\\t}\\n\\t\\telse {\\n\\t\\t\\taddCode(list, next.code || \\\"\\\");\\n\\t\\t}\\n\\t\\tnext.themes.forEach(function (name) {\\n\\t\\t\\tadd(list, \\\"themes/\\\" + name);\\n\\t\\t});\\n\\t\\tnext.modules.forEach(function (name) {\\n\\t\\t\\tadd(list, name);\\n\\t\\t});\\n\\n\\t\\treturn Promise.all([\\\"index\\\"].concat(list).map(function (name) {\\n\\t\\t\\treturn load(url(name));\\n\\t\\t})).then(function () {\\n\\t\\t\\tif (id !== current) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tvar am5 = window.am5;\\n\\t\\t\\tvar settings = {};\\n\\t\\t\\tif (next.renderer === \\\"svg\\\") {\\n\\t\\t\\t\\tif (!am5.SVGRenderer) {\\n\\t\\t\\t\\t\\tthrow new Error(\\\"renderer=\\\\\\\"svg\\\\\\\" needs amCharts 5.21.0 or later\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tsettings.renderer = am5.SVGRenderer;\\n\\t\\t\\t}\\n\\n\\t\\t\\tvar themes = next.themes.map(function (name) {\\n\\t\\t\\t\\tvar theme = window[\\\"am5themes_\\\" + name];\\n\\t\\t\\t\\tif (!theme) {\\n\\t\\t\\t\\t\\tthrow new Error(\\\"No theme \\\" + name);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn theme;\\n\\t\\t\\t});\\n\\n\\t\\t\\t// Before the root: it decides on the logo when it is made\\n\\t\\t\\t(next.licenses || []).forEach(function (license) {\\n\\t\\t\\t\\tif (am5.registry.licenses.indexOf(license) === -1) {\\n\\t\\t\\t\\t\\tam5.addLicense(license);\\n\\t\\t\\t\\t}\\n\\t\\t\\t});\\n\\n\\t\\t\\troot = am5.Root.new(\\\"chart\\\", settings);\\n\\t\\t\\troot.setThemes(themes.map(function (theme) {\\n\\t\\t\\t\\treturn theme.new(root);\\n\\t\\t\\t}));\\n\\n\\t\\t\\tif (next.config !== undefined) {\\n\\t\\t\\t\\treturn window.am5plugins_json.JsonParser.new(root).parse(next.config, { parent: root.container }).then(function (parsed) {\\n\\t\\t\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\t\\t\\tchart = parsed;\\n\\t\\t\\t\\t\\t\\tsend({ type: \\\"ready\\\" });\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\n\\t\\t\\t// A promise it returns is waited for\\n\\t\\t\\treturn Promise.resolve(compile([\\\"root\\\", \\\"data\\\", \\\"post\\\"], next.code || \\\"\\\")(root, next.data, post)).then(function (value) {\\n\\t\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\t\\tresult = value;\\n\\t\\t\\t\\t\\tif (typeof value === \\\"function\\\") {\\n\\t\\t\\t\\t\\t\\tupdate = value;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tsend({ type: \\\"ready\\\" });\\n\\t\\t\\t\\t}\\n\\t\\t\\t});\\n\\n\\t\\t}).catch(function (error) {\\n\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\tdispose();\\n\\t\\t\\t\\tfail(error);\\n\\t\\t\\t}\\n\\t\\t});\\n\\t}\\n\\n\\twindow.amChartPage = {\\n\\t\\tbuild: build,\\n\\n\\t\\t// New data: to the function the code returned, or the chart is made\\n\\t\\t// again. A config chart only keeps it, for run()\\n\\t\\tdata: function (data) {\\n\\t\\t\\tif (!options) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\toptions.data = data;\\n\\t\\t\\tif (options.config !== undefined) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\tif (update) {\\n\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\tupdate(data);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tcatch (error) {\\n\\t\\t\\t\\t\\tfail(error);\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\telse {\\n\\t\\t\\t\\tbuild(options);\\n\\t\\t\\t}\\n\\t\\t},\\n\\n\\t\\trun: function (code) {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tcompile([\\\"root\\\", \\\"chart\\\", \\\"result\\\", \\\"data\\\", \\\"post\\\"], code)(root, chart, result, options ? options.data : undefined, post);\\n\\t\\t\\t}\\n\\t\\t\\tcatch (error) {\\n\\t\\t\\t\\tfail(error);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n\\n\\tsend({ type: \\\"loaded\\\" });\\n})();\\n</script>\\n</body>\\n</html>\\n\";\n"]}
|
|
1
|
+
{"version":3,"file":"generated.js","sourceRoot":"","sources":["../src/generated.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AACrB,QAAA,cAAc,GAAW,QAAQ,CAAC;AAClC,QAAA,QAAQ,GAAW,yycAAyyc,CAAC","sourcesContent":["// Written by scripts/generate.cjs\nexport const libraryVersion: string = \"5.21.5\";\nexport const pageHtml: string = \"<!DOCTYPE html>\\n<html>\\n<head>\\n<meta charset=\\\"utf-8\\\">\\n<meta name=\\\"viewport\\\" content=\\\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\\\">\\n<style>\\nhtml, body, #chart {\\n\\tmargin: 0;\\n\\tpadding: 0;\\n\\twidth: 100%;\\n\\theight: 100%;\\n\\toverflow: hidden;\\n\\tbackground: transparent;\\n}\\nbody {\\n\\t-webkit-tap-highlight-color: transparent;\\n\\t-webkit-touch-callout: none;\\n\\t-webkit-user-select: none;\\n\\tuser-select: none;\\n}\\n</style>\\n</head>\\n<body>\\n<div id=\\\"chart\\\"></div>\\n<script>\\n(function () {\\n\\t\\\"use strict\\\";\\n\\n\\t// Which script file has each class, and which files a file needs first\\n\\tvar classModules = {\\\"AccelerationBands\\\":\\\"stock\\\",\\\"AccumulationDistribution\\\":\\\"stock\\\",\\\"AccumulativeSwingIndex\\\":\\\"stock\\\",\\\"Annotator\\\":\\\"plugins/exporting\\\",\\\"ArcDiagram\\\":\\\"flow\\\",\\\"ArcDiagramLink\\\":\\\"flow\\\",\\\"ArcDiagramNodes\\\":\\\"flow\\\",\\\"Aroon\\\":\\\"stock\\\",\\\"AverageSeries\\\":\\\"stock\\\",\\\"AverageTrueRange\\\":\\\"stock\\\",\\\"AwesomeOscillator\\\":\\\"stock\\\",\\\"Axis\\\":\\\"xy\\\",\\\"AxisBullet\\\":\\\"xy\\\",\\\"AxisLabel\\\":\\\"xy\\\",\\\"AxisLabelRadial\\\":\\\"xy\\\",\\\"AxisRenderer\\\":\\\"xy\\\",\\\"AxisRendererCircular\\\":\\\"radar\\\",\\\"AxisRendererCurveX\\\":\\\"timeline\\\",\\\"AxisRendererCurveY\\\":\\\"timeline\\\",\\\"AxisRendererRadial\\\":\\\"radar\\\",\\\"AxisRendererX\\\":\\\"xy\\\",\\\"AxisRendererY\\\":\\\"xy\\\",\\\"AxisTick\\\":\\\"xy\\\",\\\"BaseColumnSeries\\\":\\\"xy\\\",\\\"BollingerBands\\\":\\\"stock\\\",\\\"BreadcrumbBar\\\":\\\"hierarchy\\\",\\\"BullBearPower\\\":\\\"stock\\\",\\\"CalloutSeries\\\":\\\"stock\\\",\\\"Candlestick\\\":\\\"xy\\\",\\\"CandlestickSeries\\\":\\\"xy\\\",\\\"CategoryAxis\\\":\\\"xy\\\",\\\"CategoryDateAxis\\\":\\\"xy\\\",\\\"ChaikinMoneyFlow\\\":\\\"stock\\\",\\\"ChaikinOscillator\\\":\\\"stock\\\",\\\"ChartIndicator\\\":\\\"stock\\\",\\\"ChartSerializer\\\":\\\"plugins/json\\\",\\\"Chord\\\":\\\"flow\\\",\\\"ChordDirected\\\":\\\"flow\\\",\\\"ChordLink\\\":\\\"flow\\\",\\\"ChordLinkDirected\\\":\\\"flow\\\",\\\"ChordNodes\\\":\\\"flow\\\",\\\"ChordNonRibbon\\\":\\\"flow\\\",\\\"ClockHand\\\":\\\"radar\\\",\\\"ClusteredPointSeries\\\":\\\"map\\\",\\\"ColorControl\\\":\\\"stock\\\",\\\"ColorPicker\\\":\\\"plugins/colorPicker\\\",\\\"ColorPickerButton\\\":\\\"plugins/colorPicker\\\",\\\"ColumnSeries\\\":\\\"xy\\\",\\\"CommodityChannelIndex\\\":\\\"stock\\\",\\\"ComparisonControl\\\":\\\"stock\\\",\\\"CurveChart\\\":\\\"timeline\\\",\\\"CurveColumnSeries\\\":\\\"timeline\\\",\\\"CurveCursor\\\":\\\"timeline\\\",\\\"CurveLineSeries\\\":\\\"timeline\\\",\\\"DataSaveControl\\\":\\\"stock\\\",\\\"DateAxis\\\":\\\"xy\\\",\\\"DateRangeSelector\\\":\\\"stock\\\",\\\"DisparityIndex\\\":\\\"stock\\\",\\\"DoodleSeries\\\":\\\"stock\\\",\\\"DrawingControl\\\":\\\"stock\\\",\\\"DrawingSeries\\\":\\\"stock\\\",\\\"DrawingToolControl\\\":\\\"stock\\\",\\\"Dropdown\\\":\\\"stock\\\",\\\"DropdownColors\\\":\\\"stock\\\",\\\"DropdownControl\\\":\\\"stock\\\",\\\"DropdownList\\\":\\\"stock\\\",\\\"DropdownListControl\\\":\\\"stock\\\",\\\"DurationAxis\\\":\\\"xy\\\",\\\"EditableAxisLabel\\\":\\\"xy\\\",\\\"EllipseSeries\\\":\\\"stock\\\",\\\"Exporting\\\":\\\"plugins/exporting\\\",\\\"ExportingMenu\\\":\\\"plugins/exporting\\\",\\\"FibonacciSeries\\\":\\\"stock\\\",\\\"FibonacciTimezoneSeries\\\":\\\"stock\\\",\\\"Flow\\\":\\\"flow\\\",\\\"FlowLink\\\":\\\"flow\\\",\\\"FlowNode\\\":\\\"flow\\\",\\\"FlowNodes\\\":\\\"flow\\\",\\\"ForceDirected\\\":\\\"hierarchy\\\",\\\"FunnelSeries\\\":\\\"percent\\\",\\\"FunnelSlice\\\":\\\"percent\\\",\\\"Gantt\\\":\\\"gantt\\\",\\\"GanttCategoryAxis\\\":\\\"gantt\\\",\\\"GanttCategoryAxisRenderer\\\":\\\"gantt\\\",\\\"GanttDateAxis\\\":\\\"gantt\\\",\\\"GanttDateAxisRenderer\\\":\\\"gantt\\\",\\\"GanttSeries\\\":\\\"gantt\\\",\\\"GaplessDateAxis\\\":\\\"xy\\\",\\\"GraticuleSeries\\\":\\\"map\\\",\\\"Grid\\\":\\\"xy\\\",\\\"HeikinAshi\\\":\\\"stock\\\",\\\"Hierarchy\\\":\\\"hierarchy\\\",\\\"HierarchyLink\\\":\\\"hierarchy\\\",\\\"HierarchyNode\\\":\\\"hierarchy\\\",\\\"HorizontalLineSeries\\\":\\\"stock\\\",\\\"HorizontalRaySeries\\\":\\\"stock\\\",\\\"IconControl\\\":\\\"stock\\\",\\\"IconSeries\\\":\\\"stock\\\",\\\"Indicator\\\":\\\"stock\\\",\\\"IndicatorControl\\\":\\\"stock\\\",\\\"IntervalControl\\\":\\\"stock\\\",\\\"LabelSeries\\\":\\\"stock\\\",\\\"LineArrowSeries\\\":\\\"stock\\\",\\\"LineSeries\\\":\\\"xy\\\",\\\"LinkedHierarchy\\\":\\\"hierarchy\\\",\\\"LinkedHierarchyNode\\\":\\\"hierarchy\\\",\\\"MACD\\\":\\\"stock\\\",\\\"MACross\\\":\\\"stock\\\",\\\"MapChart\\\":\\\"map\\\",\\\"MapLine\\\":\\\"map\\\",\\\"MapLineSeries\\\":\\\"map\\\",\\\"MapPointSeries\\\":\\\"map\\\",\\\"MapPolygon\\\":\\\"map\\\",\\\"MapPolygonSeries\\\":\\\"map\\\",\\\"MapRasterSeries\\\":\\\"map\\\",\\\"MapSankeyNodes\\\":\\\"map\\\",\\\"MapSankeySeries\\\":\\\"map\\\",\\\"MapSeries\\\":\\\"map\\\",\\\"Measure\\\":\\\"stock\\\",\\\"MedianPrice\\\":\\\"stock\\\",\\\"Momentum\\\":\\\"stock\\\",\\\"MovingAverage\\\":\\\"stock\\\",\\\"MovingAverageDeviation\\\":\\\"stock\\\",\\\"MovingAverageEnvelope\\\":\\\"stock\\\",\\\"NightSeries\\\":\\\"map\\\",\\\"OHLC\\\":\\\"xy\\\",\\\"OHLCSeries\\\":\\\"xy\\\",\\\"OnBalanceVolume\\\":\\\"stock\\\",\\\"OverboughtOversold\\\":\\\"stock\\\",\\\"PVT\\\":\\\"stock\\\",\\\"Pack\\\":\\\"hierarchy\\\",\\\"PanelControls\\\":\\\"stock\\\",\\\"ParallelChannelSeries\\\":\\\"stock\\\",\\\"Partition\\\":\\\"hierarchy\\\",\\\"PercentChart\\\":\\\"percent\\\",\\\"PercentSeries\\\":\\\"percent\\\",\\\"PeriodSelector\\\":\\\"stock\\\",\\\"PictorialStackedSeries\\\":\\\"percent\\\",\\\"PieChart\\\":\\\"percent\\\",\\\"PieSeries\\\":\\\"percent\\\",\\\"PixelMapSeries\\\":\\\"map\\\",\\\"PolylineSeries\\\":\\\"stock\\\",\\\"PyramidSeries\\\":\\\"percent\\\",\\\"QuadrantLineSeries\\\":\\\"stock\\\",\\\"RadarChart\\\":\\\"radar\\\",\\\"RadarColumnSeries\\\":\\\"radar\\\",\\\"RadarCursor\\\":\\\"radar\\\",\\\"RadarLineSeries\\\":\\\"radar\\\",\\\"RectangleSeries\\\":\\\"stock\\\",\\\"RegressionSeries\\\":\\\"stock\\\",\\\"RelativeStrengthIndex\\\":\\\"stock\\\",\\\"ResetControl\\\":\\\"stock\\\",\\\"Sankey\\\":\\\"flow\\\",\\\"SankeyLink\\\":\\\"flow\\\",\\\"SankeyNodes\\\":\\\"flow\\\",\\\"Serializer\\\":\\\"plugins/json\\\",\\\"SeriesTypeControl\\\":\\\"stock\\\",\\\"SerpentineChart\\\":\\\"timeline\\\",\\\"SettingsControl\\\":\\\"stock\\\",\\\"SettingsModal\\\":\\\"stock\\\",\\\"SimpleLineSeries\\\":\\\"stock\\\",\\\"SliceGrouper\\\":\\\"plugins/sliceGrouper\\\",\\\"SlicedChart\\\":\\\"percent\\\",\\\"SmoothedRadarLineSeries\\\":\\\"radar\\\",\\\"SmoothedXLineSeries\\\":\\\"xy\\\",\\\"SmoothedXYLineSeries\\\":\\\"xy\\\",\\\"SmoothedYLineSeries\\\":\\\"xy\\\",\\\"SpiralChart\\\":\\\"timeline\\\",\\\"StandardDeviation\\\":\\\"stock\\\",\\\"StepLineSeries\\\":\\\"xy\\\",\\\"StochasticMomentumIndex\\\":\\\"stock\\\",\\\"StochasticOscillator\\\":\\\"stock\\\",\\\"StockChart\\\":\\\"stock\\\",\\\"StockControl\\\":\\\"stock\\\",\\\"StockLegend\\\":\\\"stock\\\",\\\"StockPanel\\\":\\\"stock\\\",\\\"StockToolbar\\\":\\\"stock\\\",\\\"Sunburst\\\":\\\"hierarchy\\\",\\\"SuperTrend\\\":\\\"stock\\\",\\\"Tree\\\":\\\"hierarchy\\\",\\\"Treemap\\\":\\\"hierarchy\\\",\\\"TrendLineSeries\\\":\\\"stock\\\",\\\"Trix\\\":\\\"stock\\\",\\\"TypicalPrice\\\":\\\"stock\\\",\\\"VWAP\\\":\\\"stock\\\",\\\"ValueAxis\\\":\\\"xy\\\",\\\"Venn\\\":\\\"venn\\\",\\\"VerticalLineSeries\\\":\\\"stock\\\",\\\"Volume\\\":\\\"stock\\\",\\\"VolumeProfile\\\":\\\"stock\\\",\\\"VoronoiTreemap\\\":\\\"hierarchy\\\",\\\"WilliamsR\\\":\\\"stock\\\",\\\"WordCloud\\\":\\\"wc\\\",\\\"XYChart\\\":\\\"xy\\\",\\\"XYChartScrollbar\\\":\\\"xy\\\",\\\"XYCursor\\\":\\\"xy\\\",\\\"XYSeries\\\":\\\"xy\\\",\\\"ZigZag\\\":\\\"stock\\\",\\\"ZoomControl\\\":\\\"map\\\"};\\n\\tvar scriptDependencies = {\\\"pie\\\":[\\\"percent\\\"],\\\"funnel\\\":[\\\"percent\\\"],\\\"radar\\\":[\\\"xy\\\"],\\\"gantt\\\":[\\\"xy\\\",\\\"plugins/colorPicker\\\"],\\\"stock\\\":[\\\"xy\\\"],\\\"timeline\\\":[\\\"xy\\\"],\\\"element\\\":[\\\"index\\\",\\\"plugins/json\\\"]};\\n\\tvar modules = {};\\n\\tObject.keys(classModules).forEach(function (name) {\\n\\t\\tmodules[classModules[name]] = true;\\n\\t});\\n\\n\\tvar current = 0;\\n\\tvar options;\\n\\tvar root;\\n\\tvar chart;\\n\\tvar result;\\n\\tvar update;\\n\\tvar scripts = {};\\n\\n\\tfunction send(message) {\\n\\t\\tvar text;\\n\\t\\ttry {\\n\\t\\t\\ttext = JSON.stringify(message);\\n\\t\\t} catch (error) {\\n\\t\\t\\ttext = JSON.stringify({ type: \\\"error\\\", message: \\\"Could not send \\\" + message.name + \\\": \\\" + error.message });\\n\\t\\t}\\n\\t\\twindow.ReactNativeWebView.postMessage(text);\\n\\t}\\n\\n\\tfunction post(name, value) {\\n\\t\\tsend({ type: \\\"message\\\", name: String(name), value: value });\\n\\t}\\n\\n\\tfunction fail(error) {\\n\\t\\tsend({ type: \\\"error\\\", message: String(error && error.message ? error.message : error) });\\n\\t}\\n\\n\\twindow.addEventListener(\\\"error\\\", function (event) {\\n\\t\\tfail(event.error || event.message);\\n\\t});\\n\\n\\twindow.addEventListener(\\\"unhandledrejection\\\", function (event) {\\n\\t\\tfail(event.reason);\\n\\t});\\n\\n\\t// A geodata global's file: am5geodata_region_world_europeLow > geodata/region/world/europeLow\\n\\tfunction geodataModule(name) {\\n\\t\\treturn \\\"geodata/\\\" + (/^lang_/.test(name) ? \\\"lang/\\\" + name.slice(5) : name.replace(/_/g, \\\"/\\\"));\\n\\t}\\n\\n\\t// A global's file: am5xy > xy, am5plugins_exporting > plugins/exporting,\\n\\t// am5fonts_notosans_sc > fonts/notosans-sc\\n\\tfunction globalModule(name) {\\n\\t\\tvar rest = name.slice(3);\\n\\t\\tvar match = /^(themes|plugins|locales)_(.+)$/.exec(rest);\\n\\t\\tif (match) {\\n\\t\\t\\treturn match[1] + \\\"/\\\" + match[2];\\n\\t\\t}\\n\\t\\tif (/^fonts_./.test(rest)) {\\n\\t\\t\\treturn \\\"fonts/\\\" + rest.slice(6).replace(/_/g, \\\"-\\\");\\n\\t\\t}\\n\\t\\tif (/^geodata_./.test(rest)) {\\n\\t\\t\\treturn geodataModule(rest.slice(8));\\n\\t\\t}\\n\\t\\treturn modules[rest] ? rest : undefined;\\n\\t}\\n\\n\\t// A theme is a name, or [name, settings]\\n\\tfunction themeName(theme) {\\n\\t\\treturn Array.isArray(theme) ? theme[0] : theme;\\n\\t}\\n\\n\\tfunction add(list, name) {\\n\\t\\tif (!name || name === \\\"index\\\" || list.indexOf(name) !== -1) {\\n\\t\\t\\treturn;\\n\\t\\t}\\n\\t\\t(scriptDependencies[name] || []).forEach(function (dependency) {\\n\\t\\t\\tadd(list, dependency);\\n\\t\\t});\\n\\t\\tlist.push(name);\\n\\t}\\n\\n\\t// The files a config needs: its classes, and geodata named by its global\\n\\tfunction addConfig(list, value) {\\n\\t\\tif (typeof value === \\\"string\\\") {\\n\\t\\t\\tif (/^am5geodata_[A-Za-z0-9_]+$/.test(value)) {\\n\\t\\t\\t\\tadd(list, geodataModule(value.slice(11)));\\n\\t\\t\\t}\\n\\t\\t}\\n\\t\\telse if (Array.isArray(value)) {\\n\\t\\t\\tvalue.forEach(function (item) {\\n\\t\\t\\t\\taddConfig(list, item);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\telse if (value && typeof value === \\\"object\\\") {\\n\\t\\t\\tif (typeof value.type === \\\"string\\\") {\\n\\t\\t\\t\\tadd(list, classModules[value.type]);\\n\\t\\t\\t}\\n\\t\\t\\tObject.keys(value).forEach(function (key) {\\n\\t\\t\\t\\taddConfig(list, value[key]);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t}\\n\\n\\t// The files code needs, from the globals it uses, and the classes of a\\n\\t// config it gives the JSON parser\\n\\tfunction addCode(list, code) {\\n\\t\\t(code.match(/\\\\bam5[A-Za-z0-9_]*/g) || []).forEach(function (name) {\\n\\t\\t\\tadd(list, globalModule(name));\\n\\t\\t});\\n\\t\\tif (code.indexOf(\\\"am5plugins_json\\\") !== -1) {\\n\\t\\t\\t(code.match(/\\\\btype[\\\"']?\\\\s*:\\\\s*[\\\"'][A-Za-z0-9_]+[\\\"']/g) || []).forEach(function (match) {\\n\\t\\t\\t\\tadd(list, classModules[/[\\\"']([A-Za-z0-9_]+)[\\\"']$/.exec(match)[1]]);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t}\\n\\n\\t// Its own scope, so that it may declare `data` or `root` itself\\n\\tfunction compile(names, code) {\\n\\t\\treturn new Function(names.join(\\\",\\\"), \\\"return (function () {\\\\n\\\" + code + \\\"\\\\n})();\\\");\\n\\t}\\n\\n\\tfunction url(name) {\\n\\t\\tif (/^[a-z]+:/i.test(name)) {\\n\\t\\t\\treturn name;\\n\\t\\t}\\n\\t\\tif (name.indexOf(\\\"geodata/\\\") === 0) {\\n\\t\\t\\treturn options.geodataUrl + name.slice(8) + \\\".js\\\";\\n\\t\\t}\\n\\t\\tif (name.indexOf(\\\"fonts/\\\") === 0) {\\n\\t\\t\\treturn options.fontsUrl + name.slice(6) + \\\".js\\\";\\n\\t\\t}\\n\\t\\treturn options.libraryUrl + name + \\\".js\\\";\\n\\t}\\n\\n\\t// Downloaded side by side, run in order\\n\\tfunction load(src) {\\n\\t\\tif (!scripts[src]) {\\n\\t\\t\\tscripts[src] = new Promise(function (resolve, reject) {\\n\\t\\t\\t\\tvar script = document.createElement(\\\"script\\\");\\n\\t\\t\\t\\tscript.src = src;\\n\\t\\t\\t\\tscript.async = false;\\n\\t\\t\\t\\tscript.onload = function () {\\n\\t\\t\\t\\t\\tresolve();\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tscript.onerror = function () {\\n\\t\\t\\t\\t\\tdelete scripts[src];\\n\\t\\t\\t\\t\\treject(new Error(\\\"Could not load \\\" + src));\\n\\t\\t\\t\\t};\\n\\t\\t\\t\\tdocument.head.appendChild(script);\\n\\t\\t\\t});\\n\\t\\t}\\n\\t\\treturn scripts[src];\\n\\t}\\n\\n\\tfunction dispose() {\\n\\t\\tif (root) {\\n\\t\\t\\troot.dispose();\\n\\t\\t}\\n\\t\\troot = undefined;\\n\\t\\tchart = undefined;\\n\\t\\tresult = undefined;\\n\\t\\tupdate = undefined;\\n\\t}\\n\\n\\tfunction build(next) {\\n\\t\\tvar id = ++current;\\n\\t\\toptions = next;\\n\\t\\tdispose();\\n\\n\\t\\tvar list = [];\\n\\t\\tif (next.config !== undefined) {\\n\\t\\t\\tadd(list, \\\"plugins/json\\\");\\n\\t\\t\\taddConfig(list, next.config);\\n\\t\\t}\\n\\t\\telse {\\n\\t\\t\\taddCode(list, next.code || \\\"\\\");\\n\\t\\t}\\n\\t\\tnext.themes.forEach(function (theme) {\\n\\t\\t\\tadd(list, \\\"themes/\\\" + themeName(theme));\\n\\t\\t});\\n\\t\\tnext.modules.forEach(function (name) {\\n\\t\\t\\tadd(list, name);\\n\\t\\t});\\n\\n\\t\\treturn Promise.all([\\\"index\\\"].concat(list).map(function (name) {\\n\\t\\t\\treturn load(url(name));\\n\\t\\t})).then(function () {\\n\\t\\t\\tif (id !== current) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tvar am5 = window.am5;\\n\\t\\t\\tvar settings = {};\\n\\t\\t\\tif (next.renderer === \\\"svg\\\") {\\n\\t\\t\\t\\tif (!am5.SVGRenderer) {\\n\\t\\t\\t\\t\\tthrow new Error(\\\"renderer=\\\\\\\"svg\\\\\\\" needs amCharts 5.21.0 or later\\\");\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tsettings.renderer = am5.SVGRenderer;\\n\\t\\t\\t}\\n\\n\\t\\t\\tvar themes = next.themes.map(function (entry) {\\n\\t\\t\\t\\tvar name = themeName(entry);\\n\\t\\t\\t\\tvar theme = window[\\\"am5themes_\\\" + name];\\n\\t\\t\\t\\tif (!theme) {\\n\\t\\t\\t\\t\\tthrow new Error(\\\"No theme \\\" + name);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\treturn { theme: theme, settings: Array.isArray(entry) ? entry[1] : undefined };\\n\\t\\t\\t});\\n\\n\\t\\t\\t// Before the root: it decides on the logo when it is made\\n\\t\\t\\t(next.licenses || []).forEach(function (license) {\\n\\t\\t\\t\\tif (am5.registry.licenses.indexOf(license) === -1) {\\n\\t\\t\\t\\t\\tam5.addLicense(license);\\n\\t\\t\\t\\t}\\n\\t\\t\\t});\\n\\n\\t\\t\\troot = am5.Root.new(\\\"chart\\\", settings);\\n\\t\\t\\troot.setThemes(themes.map(function (entry) {\\n\\t\\t\\t\\treturn entry.settings ? entry.theme.new(root, entry.settings) : entry.theme.new(root);\\n\\t\\t\\t}));\\n\\n\\t\\t\\tif (next.config !== undefined) {\\n\\t\\t\\t\\treturn window.am5plugins_json.JsonParser.new(root).parse(next.config, { parent: root.container }).then(function (parsed) {\\n\\t\\t\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\t\\t\\tchart = parsed;\\n\\t\\t\\t\\t\\t\\tsend({ type: \\\"ready\\\" });\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t});\\n\\t\\t\\t}\\n\\n\\t\\t\\t// A promise it returns is waited for\\n\\t\\t\\treturn Promise.resolve(compile([\\\"root\\\", \\\"data\\\", \\\"post\\\"], next.code || \\\"\\\")(root, next.data, post)).then(function (value) {\\n\\t\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\t\\tresult = value;\\n\\t\\t\\t\\t\\tif (typeof value === \\\"function\\\") {\\n\\t\\t\\t\\t\\t\\tupdate = value;\\n\\t\\t\\t\\t\\t}\\n\\t\\t\\t\\t\\tsend({ type: \\\"ready\\\" });\\n\\t\\t\\t\\t}\\n\\t\\t\\t});\\n\\n\\t\\t}).catch(function (error) {\\n\\t\\t\\tif (id === current) {\\n\\t\\t\\t\\tdispose();\\n\\t\\t\\t\\tfail(error);\\n\\t\\t\\t}\\n\\t\\t});\\n\\t}\\n\\n\\twindow.amChartPage = {\\n\\t\\tbuild: build,\\n\\n\\t\\t// New data: to the function the code returned, or the chart is made\\n\\t\\t// again. A config chart only keeps it, for run()\\n\\t\\tdata: function (data) {\\n\\t\\t\\tif (!options) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\toptions.data = data;\\n\\t\\t\\tif (options.config !== undefined) {\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\t\\t\\tif (update) {\\n\\t\\t\\t\\ttry {\\n\\t\\t\\t\\t\\tupdate(data);\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\tcatch (error) {\\n\\t\\t\\t\\t\\tfail(error);\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t\\telse {\\n\\t\\t\\t\\tbuild(options);\\n\\t\\t\\t}\\n\\t\\t},\\n\\n\\t\\trun: function (code) {\\n\\t\\t\\ttry {\\n\\t\\t\\t\\tcompile([\\\"root\\\", \\\"chart\\\", \\\"result\\\", \\\"data\\\", \\\"post\\\"], code)(root, chart, result, options ? options.data : undefined, post);\\n\\t\\t\\t}\\n\\t\\t\\tcatch (error) {\\n\\t\\t\\t\\tfail(error);\\n\\t\\t\\t}\\n\\t\\t}\\n\\t};\\n\\n\\tsend({ type: \\\"loaded\\\" });\\n})();\\n</script>\\n</body>\\n</html>\\n\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amcharts/amcharts5-react-native",
|
|
3
|
-
"version": "5.0.
|
|
4
|
-
"libraryVersion": "5.21.
|
|
3
|
+
"version": "5.0.2",
|
|
4
|
+
"libraryVersion": "5.21.5",
|
|
5
5
|
"description": "A React Native component for amCharts 5: charts from a JSON config or from chart code, drawn in a WebView",
|
|
6
6
|
"author": "amCharts <contact@amcharts.com> (https://www.amcharts.com/)",
|
|
7
7
|
"homepage": "https://github.com/amcharts/amcharts5/tree/master/integrations/react-native#readme",
|