react-native-bundle-discovery 1.0.0-rc.10

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.
@@ -0,0 +1,46 @@
1
+ const Highcharts = require("highcharts");
2
+
3
+ require("highcharts/modules/heatmap");
4
+ require("highcharts/modules/treemap");
5
+ require("highcharts/modules/networkgraph");
6
+ require("highcharts/modules/exporting");
7
+
8
+ const { doTheming } = require("./_theme");
9
+
10
+ discovery.view.define("highcharts", function (el, config, rawData, context) {
11
+ doTheming(el);
12
+
13
+ if (Array.isArray(rawData?.options?.series)) {
14
+ rawData.options.series.forEach((e) => {
15
+ if (e.data?.[0]?.value !== undefined) {
16
+ // mutate data by link
17
+ e.data = e.data.map((d) => d.value ?? null);
18
+ }
19
+ });
20
+ }
21
+
22
+ // console.log({ rawData });
23
+
24
+ try {
25
+ Highcharts.chart(
26
+ el,
27
+ Highcharts.merge(
28
+ {
29
+ // default options
30
+ },
31
+ rawData.options,
32
+ ),
33
+ );
34
+ } catch (e) {
35
+ console.error(e, rawData);
36
+ discovery.view.render(
37
+ el,
38
+ {
39
+ view: "alert-danger",
40
+ data: '"Error rendering chart, please check the console for more information."',
41
+ },
42
+ rawData,
43
+ context,
44
+ );
45
+ }
46
+ });