-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
182 lines (174 loc) · 4.1 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
<!DOCTYPE HTML>
<html>
<head>
<title>Dynamic Chart</title>
<meta name="renderer" content="webkit">
<link type="text/css" rel="stylesheet" href="/public/Chart.css">
<style type="text/css">
body {
margin: 0;
background: rgb(0, 191, 165);
color: #fff;
}
header {
height: 80px;
background: rgb(0, 140, 121);
margin-bottom: 10px
}
header .name {
margin-left: auto;
margin-right: auto;
width: 920px;
font-size: 2rem;
font-weight: bold;
line-height: 80px;
text-shadow: 1px 1px 5px rgba(0,0,0,0.5);
}
header .name::after {
content:'alpha';
position: relative;
top: -1rem;
padding: 5px;
margin-left: 5px;
font-size: 1rem;
border-radius: 2px;
background: #DD6568;
}
.addition-info {
margin: 5px auto;
display: block;
width: 920px;
color: rgb(0, 93, 80);
}
#container {
width: 920px;
height: 510px;
margin: 0 auto;
}
#container::after {
content: '';
display: block;
clear: both;
}
#chart-container {
float: left;
width: 800px;
height: 500px;
border: 5px rgb(0, 140, 121) solid;
}
#data-control {
float: left;
margin: 5px;
}
#data-control .btn {
width: 90px;
height: 90px;
text-align: center;
line-height: 90px;
border-width: 5px;
border-style: solid;
border-radius: 50px;
transition: 0.5s;
}
#data-control .btn:hover {
cursor: pointer;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
#data-control #btn-load-data {
display: table-cell;
vertical-align: middle;
line-height: 1em;
background: rgb(235, 136, 138);
border-color: rgb(221, 101, 104);
color: rgb(205, 60, 63);
}
#data-control #btn-load-data:hover {
background: rgb(221, 101, 104);
border-color: rgb(235, 136, 138);
color: rgb(205, 60, 63);
}
#data-control #btn-clear {
margin-top: 10px;
background: rgb(255, 206, 0);
border-color: rgb(255, 191, 0);
color: rgb(255, 153, 0);
}
#data-control #btn-clear:hover {
background: rgb(255, 191, 0);
border-color: rgb(255, 206, 0);
color: rgb(255, 153, 0);
}
#install {
width: 920px;
margin: 60px auto;
}
.code {
display: block;
background: rgb(40, 44, 52);
color: rgb(217, 217, 217);
padding: 10px;
margin: 10px 0;
}
#usage {
width: 920px;
margin: 0 auto;
}
</style>
<!-- <script src="/socket.io/socket.io.js"></script> -->
<script src="/public/Chart.js"></script>
<script src="/public/index.js"></script>
<!-- <script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?b6b8be38c464ab52345e1fbb4057c80a";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script> -->
</head>
<body>
<header>
<div class="name">dynamic chart</div>
</header>
<span class="addition-info">请用Chrome或Safari打开,抱歉暂时未兼容更多浏览器。</span>
<span class="addition-info">可以在图表中选择一段数据,或使用鼠标滚轮放大,试试看~ 本页未使用任何插件。</span>
<div id="container">
<div id="chart-container" class="chart">
</div>
<div id="data-control">
<div id="btn-load-data" class="btn">
load data</br>
<span style="font-size:0.5em">(120 random)</span>
</div>
<div id="btn-clear" class="btn">clear data</div>
</div>
</div>
<div id="install">
<h1>Install is every easy</h1>
<h2>Step 1: add script</h2>
<span class="code">https://raw.githubusercontent.com/yuqianma/dynamicChart/master/public/Chart.js</span>
<h2>Step 2: add style</h2>
<span class="code">https://raw.githubusercontent.com/yuqianma/dynamicChart/master/public/Chart.css</span>
</div>
<div id="usage">
<h1>Usage:</h1>
<div class="code">
<p>var chart = Chart('chart-container', [</p>
<p>{x: 1, y: 2, z: 3},</p>
<p>{x: 4, y: 5, z: 6}</p>
<p>]);</p>
<p>// chart-container is a target div</p>
<p>// take in an array contains points</p>
<p>chart.register(['peek', 'select', 'wheel']);</p>
<p>// register or deregister event(s)</p>
<p>chart.addPoint({x: 7, y: 8, z: 9});</p>
<p>// add a point</p>
<p></p>
<p></p>
<p></p>
</div>
<h1>ongoing...</h1>
</div>
</body>
</html>