forked from rakannimer/react-google-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (65 loc) · 1.63 KB
/
index.js
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
import React from "react";
import ReactDOM from "react-dom";
import Chart from "react-google-charts";
// Ref : https://developers.google.com/chart/interactive/docs/gallery/histogram
const data = [
[
"Location",
"Parent",
"Market trade volume (size)",
"Market increase/decrease (color)"
],
["Global", null, 0, 0],
["America", "Global", 0, 0],
["Europe", "Global", 0, 0],
["Asia", "Global", 0, 0],
["Australia", "Global", 0, 0],
["Africa", "Global", 0, 0],
["Brazil", "America", 11, 10],
["USA", "America", 52, 31],
["Mexico", "America", 24, 12],
["Canada", "America", 16, -23],
["France", "Europe", 42, -11],
["Germany", "Europe", 31, -2],
["Sweden", "Europe", 22, -13],
["Italy", "Europe", 17, 4],
["UK", "Europe", 21, -5],
["China", "Asia", 36, 4],
["Japan", "Asia", 20, -12],
["India", "Asia", 40, 63],
["Laos", "Asia", 4, 34],
["Mongolia", "Asia", 1, -5],
["Israel", "Asia", 12, 24],
["Iran", "Asia", 18, 13],
["Pakistan", "Asia", 11, -52],
["Egypt", "Africa", 21, 0],
["S. Africa", "Africa", 30, 43],
["Sudan", "Africa", 12, 2],
["Congo", "Africa", 10, 12],
["Zaire", "Africa", 8, 10]
];
const options = {
minColor: "#f00",
midColor: "#ddd",
maxColor: "#0d0",
headerHeight: 15,
fontColor: "black",
showScale: true
};
class App extends React.Component {
render() {
return (
<div className="App">
<Chart
chartType="TreeMap"
width="100%"
height="400px"
data={data}
options={options}
/>
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);