-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.html
161 lines (153 loc) · 5.77 KB
/
test.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
<!--Copyright (c) 2011 LectureTools Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.-->
<html>
<head>
<script src='jquery-1.7.min.js'></script>
<script src='jquery.jbargraph.js'></script>
<link href='jBarGraphStyles.css' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="graph_container" id="graph_container1"></div>
<br />
<br />
<br />
<br />
<!--<div class="graph_container" id="graph_container2"></div>-->
<br />
<h3>Use</h3>
Create a bar graph using the default options:
<pre>
jQuery("#graph_container_element").bar_graph({
data:[1,2,3,4],
labels:["A","B","C","D"]
});
</pre>
Create a bar graph using some non-default options:
<pre>
jQuery("#graph_container_element").bar_graph({
style:"vertical",
vAxis:true,
data:[1,2,3,4],
labels:["A","B","C","D"],
correct:["C"],
colorByCorrect:true
});
</pre>
<hr>
<h3>Options</h3>
<table id='options-table'>
<tr>
<th>Option Name</th><th>Default Value</th><th>Other Accepted Values</th><th>Notes</th>
</tr>
<tr>
<td>data</td><td>[ ]</td><td>N/A</td><td>An array of the raw data values to graph</td>
</tr>
<tr>
<td>labels</td><td>[ ]</td><td>N/A</td><td>An array of strings to use as labels</td>
</tr>
<tr>
<td>labelStyle</td><td>"split"</td><td>"text","value","full"</td><td>'text' => Just the label text is displayed. <br>'value' => Just the data value is displayed.<br>"full" => both text and value are displayed as "text (value)"</td>
</tr>
<tr>
<td>labelDisplay</td><td>"scale"</td><td>"hover","static"</td><td>"hover" => label shown as alt text/title attribute of each bar.<br>"scale" => label shown on bar, and font-size scales as barwidth / 4.</td>
</tr>
<tr>
<td>labelPos</td><td>"inside"</td><td>"outside"</td><td>"inside" => labels are shown inside of the colored bars.<br>"outside" => labels are shown outside of the colored bars.</td>
</tr>
<tr>
<td>colorByCorrect</td><td>false</td><td>true</td><td>If true, bars corresponding to incorrect options are blue and bars corresponding to correct options are lime</td>
</tr>
<tr>
<td>correct</td><td>[ ] </td><td>N/A</td><td>An array of the labels of the bars that are correct options</td>
</tr>
<tr>
<td>barStyle</td><td>"fancy"</td><td>"plain"</td><td>"fancy" => rounded corners on bars.<br>"plain" => square corners on bars.</td>
</tr>
<tr>
<td>style</td><td>"horizontal"</td><td>"vertical"</td><td>"horizontal" => bar graph where the bars are horizontal.<br>"vertical" => bar graph where the bars are vertical.</td>
</tr>
<tr>
<td>vAxis</td><td>false</td><td>true</td><td>If true, shows a scale on the vertical axis. Only applicable if style == 'vertical'</td>
</tr>
<tr>
<td>vAxisStepDivisor</td><td>5</td><td></td><td></td>
</tr>
<tr>
<td>vAxisSteps</td><td>10</td><td></td><td>The number of steps to display from 0 to max(data)</td>
</tr>
</table>
<hr />
<h3>Methods</h3>
<table>
<tr>
<th>Method Name</th><th>Description</th><th>Example Call</th>
</tr>
<tr>
<td>init</td><td>Creates and displays the bar graph</td><td></td>
</tr>
<tr>
<td>hide</td><td>Hides the bar graph</td><td>jQuery("#graph_container").bar_graph("hide");</td>
</tr>
<tr>
<td>showCorrect</td><td>Shows colored boxes around the bars that correspond to entries in the <em>options.correct</em> array.</td><td>jQuery("#graph_container").bar_graph("showCorrect");</td>
</tr>
</table>
</body>
</html>
<script>
jQuery("#graph_container1").bar_graph({
data:[8,5,8,11,10],
labels: ["Mon","Tue","Wed","Thr","Fri"],
labelStyle:"split",
labelDisplay:"scale",
labelPos:"inside",
correct:["Mon"],
style:"vertical",
barStyle:"fancy",
colorByCorrect:false,
vAxis:true
});
jQuery("#graph_container1").bar_graph("showCorrect");
//jQuery("#graph_container1").bar_graph("hideCorrect");
jQuery("#graph_container1").bar_graph("markChoice","Tue");
</script>
<!--<script>
jQuery("#graph_container2").bar_graph({
data:[8,5,8,11],
labels: ["Mon","Tue","Wed","Thr"],
labelStyle:"split",
labelDisplay:"scale",
labelPos:"inside",
correct:["Wed"],
style:"vertical",
barStyle:"fancy",
colorByCorrect:false,
vAxis:false
});
jQuery("#graph_container2").bar_graph("showCorrect");
//jQuery("#graph_container2").bar_graph("markChoice","A");
</script>-->
<!--<script>
jQuery("#graph_container2").bar_graph({
labelStyle:"full",
labelDisplay:"scale",
correct:[],
style:"horizontal",
barStyle:"fancy",
colorByCorrect:false
});
//jQuery("#graph_container2").bar_graph("hide");
</script>-->