-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.xml
83 lines (75 loc) · 3.63 KB
/
index.xml
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
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Piechart" height="250" description="Piechart Gadget">
<Require feature="dynamic-height"/>
</ModulePrefs>
<Content type="html">
<![CDATA[
<head>
<style type="text/css">
</style>
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.4/Chart.bundle.min.js"></script>
<script>
$(function(){
$.ajax({
dataType: "json",
url: "https://localhost:9443/analytics/tables/DUSANTESTSTREAM",
"headers": {
"authorization": "Basic YWRtaW46YWRtaW4=",
"cache-control": "no-cache",
},
success: function(data){
var dasData = [];
$.each(data, function(i, val){
dasData.push({ "city" : val.values.city, "population" : val.values.population });
});
var myLabels = [];
var myValues = [];
$.each(dasData, function(i, v){
myLabels.push(v.city);
})
$.each(dasData, function(i, v){
myValues.push(v.population);
})
var pieData = {
labels: myLabels,
datasets: [
{
data: myValues,
backgroundColor: [
"red",
"#36A2EB",
"#FFCE56",
"green",
"blue",
"gold",
"silver",
"#FF6384",
"yellow",
"darkred"
],
}]
};
var ctx = $("#pieChart");
var myPieChart = new Chart(ctx,{
type: 'doughnut',
data: pieData,
options: {
title: {
display: true,
text: 'Custom WSO2 Pie Chart'
}
}
});
}
});
});
</script>
<head>
<body>
<canvas id="pieChart" width="400" height="400"></canvas>
</body>
]]>
</Content>
</Module>