forked from wever-ko/wever-UI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·184 lines (158 loc) · 5.91 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
<!DOCTYPE html>
<html>
<head>
<title> Circular Percentage Bar</title>
<script type="text/javascript" src = "circleGauge.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<style type="text/css">
html {
font-size: 12px;
font-family: 'Roboto', sans-serif;
}
.attrName {
display: inline-block;
width: 100px;
}
#test {
padding:4px; margin: 0 auto; width: 200px; height: 250px; border-style: solid; border-width: 1px 1px 1px 1px; border-color: black;
}
</style>
</head>
<body>
<div id='test'></div>
<div style="margin: 0 auto; background-color: #d7d7d7; padding: 10px; border-radius: 10px; width: 400px;">
<div>
<div class="attrName"> value (%): </div>
<input type="range" id="value" name="value" min = "0" max ="100">
<a id="valueA"></a>
</div>
<div>
<div class="attrName"> radius: </div>
<input type="range" id = "radius" name="radius" min = "0" max ="100" value="50">
<a id="radiusA"></a>
</div>
<div>
<div class="attrName"> line width: </div>
<input type="range" id="lineWidth" name="lineWidth" min = "0" max ="50">
<a id="lineWidthA"></a>
</div>
<div>
<div class="attrName"> empty line width: </div>
<input type="range" id="emptyLineWidth" name="emptyLineWidth" min = "0" max ="50">
<a id="emptyLineWidthA"></a>
</div>
<div>
<div class="attrName"> text size: </div>
<input type="range" id="textSize" name="emptyLineWidth" min = "0" max ="50">
<a id="textSizeA"></a>
</div>
<div>
<div class="attrName"> background color: </div>
<input id = "bgColor" type="color" name="color" value="#3f87a6">
</div>
<div>
<div class="attrName"> line color: </div>
<input id= "lineColor" type="color" name="color" value="#d500f9">
</div>
<div>
<div class="attrName"> empty line color: </div>
<input id = "emptyLineColor" type="color" name="color" value="#3f87a6">
</div>
<div>
<div class="attrName"> text color: </div>
<input id = "textColor" type="color" name="color" value="#3f87a6">
</div>
<div>
<div class="attrName"> animation: </div>
<input id ="animTo" type ="text" name ="num" value="100" size ="10">
<button onclick="animStart();"> Start! </button>
</div>
</div>
</body>
<script type="text/javascript">
var target = document.getElementById('test');
var circularBar = new CircleGauge({
lineWidth : 5,
value: 65,
radius : 25,
lineColor: '#e65348',
emptyLineColor: '#eaeaea',
showText: true,
emptyLineWidth: 2,
textColor : '#878787',
textSize:12,
text: function(value) {
return (parseFloat(value) |0 ) + "%";
}
}).create(target);
// Value
var pvalue = document.getElementById('value');
pvalue.value = circularBar.val();
var valueA = document.getElementById('valueA');
valueA.innerHTML = circularBar.val();
pvalue.addEventListener('input', function() {
circularBar.val(parseFloat(pvalue.value));
valueA.innerHTML = pvalue.value;
});
// line width
var lineWidth = document.getElementById('lineWidth');
lineWidth.value = circularBar.lineWidth();
var lineWidthA = document.getElementById('lineWidthA');
lineWidthA.innerHTML = lineWidth.value;
lineWidth.addEventListener('input', function() {
circularBar.lineWidth(lineWidth.value);
lineWidthA.innerHTML = lineWidth.value;
});
// empty line width
var emptyLineWidth = document.getElementById('emptyLineWidth');
emptyLineWidth.value = circularBar.emptyLineWidth();
var emptyLineWidthA = document.getElementById('emptyLineWidthA');
emptyLineWidthA.innerHTML = emptyLineWidth.value;
emptyLineWidth.addEventListener('input', function(){
circularBar.emptyLineWidth(emptyLineWidth.value);
emptyLineWidthA.innerHTML = emptyLineWidth.value;
});
// radius
var radius = document.getElementById('radius');
radius.value = circularBar.radius();
var radiusA = document.getElementById('radiusA');
radiusA.innerHTML = radius.value;
radius.addEventListener('input', function(){
circularBar.radius(radius.value);
radiusA.innerHTML = radius.value;
});
// line Color
var lineColor = document.getElementById('lineColor');
lineColor.value = circularBar.lineColor();
lineColor.addEventListener("change", function(){
circularBar.lineColor(lineColor.value);
});
// empty line color
var emptyLineColor = document.getElementById('emptyLineColor');
emptyLineColor.value = circularBar.emptyLineColor();
emptyLineColor.addEventListener("change", function (){
circularBar.emptyLineColor(emptyLineColor.value);
})
//text Color
var textColor = document.getElementById('textColor');
textColor.value = circularBar.textColor();
textColor.addEventListener("change", function(){
circularBar.textColor(textColor.value);
});
//text Size
var textSize = document.getElementById('textSize');
textSize.value = circularBar.textSize();
var textSizeA = document.getElementById('textSizeA');
textSizeA.innerHTML = circularBar.textSize();
textSize.addEventListener("input", function (){
circularBar.textSize(textSize.value);
textSizeA.value = textSize.value;
});
var animValue = document.getElementById('animTo');
function animStart ()
{
circularBar.val(animValue.value, true, 100, function(){
});
}
</script>
</html>