-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
197 lines (175 loc) · 4.93 KB
/
index.html
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE html>
<html>
<head>
<title>Creating a Simple Dashboard with FusionCharts & React</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="css/style.css">
<!-- including React -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-with-addons.min.js"></script>
<!-- JSX Transformer -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<!-- FusionCharts Package Files -->
<script type="text/javascript" src="js/fusioncharts.js"></script>
<script type="text/javascript" src="js/fusioncharts.charts.js"></script>
<script type="text/javascript" src="js/fusioncharts.powercharts.js"></script>
<!-- FC React plugin -->
<script type="text/javascript" src="js/react-fusioncharts.min.js"></script>
<!-- theme file - carbon -->
<script type="text/javascript" src="js/fusioncharts.theme.carbon.js"></script>
</head>
<body>
<div id="dashboard"></div>
<script type="text/jsx">
var MyApp = React.createClass({
render: function() {
var that = this,
rows = [];
var countryDataSource = {
"chart": {
// caption options
"caption": "Top Revenue Earning Countries",
"xAxisName": "Country",
"yAxisName": "Revenue (In USD)",
"theme": "carbon"
},
"data": [{
"label": "United States",
"value": "920000"
}, {
"label": "China",
"value": "730000"
}, {
"label": "Germany",
"value": "680000"
}, {
"label": "United Kingdom",
"value": "670000"
}, {
"label": "Australia",
"value": "639000"
}, {
"label": "Canada",
"value": "590000"
}]
};
var countryChartConfigs = {
type: "column2d",
renderAt: "country-revenue",
width: '100%',
height: 400,
dataFormat: "json",
dataSource: countryDataSource
};
var monthlyDataSource = {
chart: {
// caption options
"caption": "Monthly Revenue Trend",
"xAxisName": "Month",
"yAxisName": "Revenue (In USD)",
"theme": "carbon"
},
data: [{
"label": "Jan",
"value": "657000"
}, {
"label": "Feb",
"value": "138000"
}, {
"label": "Mar",
"value": "192000"
}, {
"label": "Apr",
"value": "111000"
}, {
"label": "May",
"value": "438000"
}, {
"label": "Jun",
"value": "292000"
}, {
"label": "Jul",
"value": "365000"
}, {
"label": "Aug",
"value": "649000"
}, {
"label": "Sep",
"value": "746000"
}, {
"label": "Oct",
"value": "803000"
}, {
"label": "Nov",
"value": "876000"
}, {
"label": "Dec",
"value": "730000"
}]
};
var monthlyChartConfigs = {
type: "spline",
renderAt: "monthly-revenue",
width: '100%',
height: 350,
dataFormat: "json",
dataSource: monthlyDataSource
};
var productDataSource = {
chart: {
// caption options
"caption": "Split of Revnue by Products",
"theme": "carbon"
},
data: [{
"label": "Product 1",
"value": "1460000"
}, {
"label": "Product 2",
"value": "2190000"
}, {
"label": "Product 3",
"value": "1095000"
}, {
"label": "Product 4",
"value": "1095000"
}, {
"label": "Product 5",
"value": "1460000"
}]
};
var productChartConfigs = {
type: "doughnut2d",
renderAt: "product-revenue",
width: '100%',
height: 350,
dataFormat: "json",
dataSource: productDataSource
};
return (
<div>
<h1 className="main-title">Acme Inc. Revenue Analysis for 2015</h1>
<div id="interactive-dashbaord"></div>
<div className="chart-row">
<div id="country-revenue">
<react_fc.FusionCharts {...countryChartConfigs} />
</div>
</div>
<div className="chart-row">
<div id="monthly-revenue" className="inline-chart">
<react_fc.FusionCharts {...monthlyChartConfigs} />
</div>
<div id="product-revenue" className="inline-chart">
<react_fc.FusionCharts {...productChartConfigs} />
</div>
</div>
</div>
);
}
});
React.render(
<MyApp />,
document.getElementById("dashboard")
);
</script>
</body>
</html>