/
29_dataGroup.html
142 lines (89 loc) 路 2.46 KB
/
29_dataGroup.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Use data group to switch data set in globe / Gio.js</title>
<script src="js/three.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="../build/gio.min.js"></script>
<link rel="stylesheet" href="css/common.css">
<style>
#globalArea {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
#mini, #small, #large, #color {
position: absolute;
left: 100px;
width: 150px;
height: 40px;
color: #cbcbcb;
text-align: center;
line-height: 40px;
cursor: pointer;
user-select: none;
box-sizing: border-box;
transition: 1s;
border-radius: 5px;
background-color: rgba(110, 110, 110, 0.8);
}
#mini:hover, #small:hover, #large:hover, #color:hover {
color: #fff;
background-color: #929292;
}
#mini {
top: 200px;
}
#small {
top: 300px;
}
#large {
top: 400px;
}
#color {
top: 500px;
}
</style>
</head>
<body>
<header>Use data group to add multiple data sets to globe and switch data set presented on globe</header>
<div id="globalArea"></div>
<div id="mini">Mini Set</div>
<div id="small">Small Set</div>
<div id="large">Large Set</div>
<div id="color">Color Set</div>
<div class="view_source">
<a href="https://github.com/syt123450/Gio.js/blob/master/examples/29_dataGroup.html">View Source</a>
</div>
<script>
var container = document.getElementById( "globalArea" );
var controller = new GIO.Controller( container );
$.ajax( {
url: "data/groupData.json",
type: "GET",
contentType: "application/json; charset=utf-8",
async: true,
dataType: "json",
success: function ( inputData ) {
controller.addData( inputData );
controller.init();
}
} );
// Use switchDataSet API to switch data set presented on globe
$( "#mini" ).click( function () {
controller.switchDataSet("mini");
} );
$( "#small" ).click( function () {
controller.switchDataSet("small");
} );
$( "#large" ).click( function () {
controller.switchDataSet("large");
} );
$( "#color" ).click( function () {
controller.switchDataSet("color");
} );
</script>
</body>
</html>