-
Notifications
You must be signed in to change notification settings - Fork 1
/
index_v4.html
157 lines (152 loc) · 3.3 KB
/
index_v4.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
<!DOCTYPE html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1">
<script src="http://d3js.org/d3.v4.min.js"></script>
<script src="../../dev/lexiconRainbow.d3v4.dev.js"></script>
<script src="./loadData.js"></script>
<style type ="text/css">
html {
background-color:White;
}
html * {
box-sizing:border-box;
}
body{
margin: 0px;
background-color:White;
}
body:after{
content:"";
display:block;
clear:both;
}
.row {
float:left;
width:100%;
font-size:16px;
position:relative;
overflow:hidden;
background-color:transparent;
}
.row:after{
content:"";
display:block;
clear:both;
}
.row:first-child, .row:last-of-type {
min-height:300px;
text-align:center;
font-size:30px;
font-family:advent-pro,Sans Serif,Arial;
}
.row:first-child span {
display:inline-block;
width:90%;
position:absolute;
left:0;
right:0;
bottom:20px;
margin-left:auto;
margin-right:auto;
}
.row:first-child span:first-child {
bottom:100px;
white-space:pre;
}
.row:last-of-type span {
display:inline-block;
width:90%;
position:absolute;
left:0;
right:0;
top:20px;
margin-left:auto;
margin-right:auto;
}
#containerDiv {
width:70%;
margin:auto;
position:relative;
}
#containerDiv>canvas {
width:100%;
height:auto;
visibility:hidden;
}
#containerDiv>svg {
position:absolute !important;
top:0;
left:0;
width:100%;
}
</style>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="./IE.css"></link>
<![endif]-->
</head>
<body>
<div class="row">
<span id="moverSpan"> </span>
<span id="topSpan"></span>
</div>
<div class="row">
<div id="containerDiv">
<canvas width="600" height="200"></canvas>
</div>
</div>
<div class="row">
<span id="botSpan"></span>
</div>
<script type="text/javascript">
!function(){
////////////////////////////////////////////////////////////////////
/////////////////CREATE INSTANCE OF LEXICON RAINBOW/////////////////
////////////////////////////////////////////////////////////////////
(new LexiconRainbow)
.container("#containerDiv")
.dispersion(0)
.forceStyle()
.w(600).h(200)
.sW("100%").sH("auto")
.position("relative")
.sTop("0px")
.sLeft("0px")
.sMargin("0px auto 0px auto")
.handleEvent(handleEvent)
.lexID("lexiconRainbow")
.input(sample)
.append()
.render();
////////////////////////////////////////////////////////////////////
/////////////////////////ATTACH THE HANDLER/////////////////////////
////////////////////////////////////////////////////////////////////
var topspan = document.getElementById("topSpan");
var botspan = document.getElementById("botSpan");
var moverspan = document.getElementById("moverSpan");
function handleEvent (data,type,eventType) {
switch (type) {
case "onload":
topSpan.textContent = data.ordinal.Info;
botSpan.textContent = data.linear.Info;
return;
case "onhighlight":
if(eventType==="mouseover") {
var dd = typeof data.item === "object" ? "Value: "+Math.abs(data.item[1]-data.item[0]) : "Value: "+dd;
var name = typeof data.name !== undefined ? "Name: "+data.name+", " : "";
moverspan.textContent = name+dd;
} else {
moverspan.textContent = " ";
}
return;
case "onrenderLinear":
botSpan.textContent = data.Info;
return;
case "onrenderOrdinal":
topSpan.textContent = data.Info;
return;
}
}
}()
</script>
</body>
</html>