index.js
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import React, { useState } from "react";
import ReactDOM from "react-dom";
import ReactTooltip from "react-tooltip";
import './i18n';
import MapChart from "./MapChart";
import GraphChart from "./GraphChart";
import PiChart from './PiChart';
import CBVBars from './BarChart';
import ProgressionChart from './ProgressionChart';
import ProgressionChart2021 from './ProgressionChart2021';
import ProgressionChart2022 from './ProgressionChart2022';
import CBVBars2021 from './BarChart2021';
function CBVGlobe(props) {
const [content, setContent] = useState("");
const [countries] = useState(props.countries);
return (
<div>
<MapChart setTooltipContent={setContent} countries={countries} />
<ReactTooltip backgroundColor="#715f8a" textColor="white">{content}</ReactTooltip>
</div>
);
}
window.renderGlobe = (el) => {
ReactDOM.render(<CBVGlobe countries={JSON.parse(el.dataset.countries)} />, el);
}
function CBVGraph(props) {
const [data] = useState(props.data);
return (
<div>
<GraphChart data={data} />
</div>
);
}
window.renderGraph = (el) => {
ReactDOM.render(<CBVGraph data={JSON.parse(el.dataset.points)} />, el);
}
function CBVPI(props) {
const [data] = useState(props.data);
const [color] = useState(props.color);
return (
<PiChart data={data} color={color} />
);
}
window.renderPI = (el) => {
ReactDOM.render(<CBVPI color={el.dataset.color} data={JSON.parse(el.dataset.points)} />, el);
}
function CBVBarChart2021(props) {
const [data] = useState(props.data);
return (
<CBVBars2021 data={data} />
);
}
window.renderBarChart2021 = (el) => {
ReactDOM.render(<CBVBarChart2021 data={JSON.parse(el.dataset.points)} />, el);
}
function CBVBarChart(props) {
const [data] = useState(props.data);
return (
<CBVBars data={data} />
);
}
window.renderBarChart = (el) => {
ReactDOM.render(<CBVBarChart data={JSON.parse(el.dataset.points)} />, el);
}
function CBVProgression(props) {
return (
<ProgressionChart />
);
}
window.renderProgression = (el) => {
ReactDOM.render(<CBVProgression />, el);
}
function CBVProgression2021(props) {
return (
<ProgressionChart2021 />
);
}
window.renderProgression2021 = (el) => {
ReactDOM.render(<CBVProgression2021 />, el);
}
function CBVProgression2022(props) {
return (
<ProgressionChart2022 />
);
}
window.renderProgression2022 = (el) => {
ReactDOM.render(<CBVProgression2022 />, el);
}