sunrise-votes 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -4
- data/Rakefile +0 -22
- data/app/controllers/manage/ballot_box/votes_controller.rb +4 -0
- data/app/views/manage/ballot_box/votes/show.html.erb +211 -81
- data/lib/generators/sunrise/votes/install_generator.rb +1 -1
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/highcharts.js +170 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/highcharts.src.js +11428 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/modules/exporting.js +22 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/modules/exporting.src.js +711 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/dark-blue.js +263 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/dark-green.js +263 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/gray.js +262 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/grid.js +96 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/skies.js +89 -0
- data/lib/sunrise/votes/version.rb +1 -1
- metadata +33 -79
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/excanvas.min.js +0 -35
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.css +0 -226
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.js +0 -312
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.js +0 -702
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.js +0 -234
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.js +0 -748
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.js +0 -199
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.js +0 -238
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.js +0 -614
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.js +0 -420
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.js +0 -634
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.js +0 -115
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.js +0 -1002
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.js +0 -439
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.js +0 -904
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.js +0 -218
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.js +0 -199
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.js +0 -932
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.js +0 -406
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.js +0 -475
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.js +0 -446
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.js +0 -607
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.js +0 -432
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.js +0 -1142
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.js +0 -372
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.js +0 -797
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.js +0 -337
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.js +0 -220
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.min.js +0 -30
@@ -1,312 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jqPlot
|
3
|
-
* Pure JavaScript plotting plugin using jQuery
|
4
|
-
*
|
5
|
-
* Version: 1.0.0b1_r746
|
6
|
-
*
|
7
|
-
* Copyright (c) 2009-2011 Chris Leonello
|
8
|
-
* jqPlot is currently available for use in all personal or commercial projects
|
9
|
-
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
10
|
-
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
11
|
-
* choose the license that best suits your project and use it accordingly.
|
12
|
-
*
|
13
|
-
* Although not required, the author would appreciate an email letting him
|
14
|
-
* know of any substantial use of jqPlot. You can reach the author at:
|
15
|
-
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
16
|
-
*
|
17
|
-
* If you are feeling kind and generous, consider supporting the project by
|
18
|
-
* making a donation at: http://www.jqplot.com/donate.php .
|
19
|
-
*
|
20
|
-
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
21
|
-
*
|
22
|
-
* version 2007.04.27
|
23
|
-
* author Ash Searle
|
24
|
-
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
25
|
-
* http://hexmen.com/js/sprintf.js
|
26
|
-
* The author (Ash Searle) has placed this code in the public domain:
|
27
|
-
* "This code is unrestricted: you are free to use it however you like."
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
(function($) {
|
31
|
-
// Class: $.jqplot.BezierCurveRenderer.js
|
32
|
-
// Renderer which draws lines as stacked bezier curves.
|
33
|
-
// Data for the line will not be specified as an array of
|
34
|
-
// [x, y] data point values, but as a an array of [start piont, bezier curve]
|
35
|
-
// So, the line is specified as: [[xstart, ystart], [cp1x, cp1y, cp2x, cp2y, xend, yend]].
|
36
|
-
$.jqplot.BezierCurveRenderer = function(){
|
37
|
-
$.jqplot.LineRenderer.call(this);
|
38
|
-
};
|
39
|
-
|
40
|
-
$.jqplot.BezierCurveRenderer.prototype = new $.jqplot.LineRenderer();
|
41
|
-
$.jqplot.BezierCurveRenderer.prototype.constructor = $.jqplot.BezierCurveRenderer;
|
42
|
-
|
43
|
-
|
44
|
-
// Method: setGridData
|
45
|
-
// converts the user data values to grid coordinates and stores them
|
46
|
-
// in the gridData array.
|
47
|
-
// Called with scope of a series.
|
48
|
-
$.jqplot.BezierCurveRenderer.prototype.setGridData = function(plot) {
|
49
|
-
// recalculate the grid data
|
50
|
-
var xp = this._xaxis.series_u2p;
|
51
|
-
var yp = this._yaxis.series_u2p;
|
52
|
-
// this._plotData should be same as this.data
|
53
|
-
var data = this.data;
|
54
|
-
this.gridData = [];
|
55
|
-
this._prevGridData = [];
|
56
|
-
// if seriesIndex = 0, fill to x axis.
|
57
|
-
// if seriesIndex > 0, fill to previous series data.
|
58
|
-
var idx = this.index;
|
59
|
-
if (data.length == 2) {
|
60
|
-
if (idx == 0) {
|
61
|
-
this.gridData = [
|
62
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
63
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
64
|
-
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
65
|
-
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
66
|
-
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
67
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
68
|
-
];
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
var psd = plot.series[idx-1].data;
|
72
|
-
this.gridData = [
|
73
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
74
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
75
|
-
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
76
|
-
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
77
|
-
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
78
|
-
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
79
|
-
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
80
|
-
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
81
|
-
];
|
82
|
-
}
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
if (idx == 0) {
|
86
|
-
this.gridData = [
|
87
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
88
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
89
|
-
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
90
|
-
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
91
|
-
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
92
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
93
|
-
];
|
94
|
-
}
|
95
|
-
else {
|
96
|
-
var psd = plot.series[idx-1].data;
|
97
|
-
this.gridData = [
|
98
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
99
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
100
|
-
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
101
|
-
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
102
|
-
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
103
|
-
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
104
|
-
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
105
|
-
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
106
|
-
];
|
107
|
-
}
|
108
|
-
}
|
109
|
-
};
|
110
|
-
|
111
|
-
// Method: makeGridData
|
112
|
-
// converts any arbitrary data values to grid coordinates and
|
113
|
-
// returns them. This method exists so that plugins can use a series'
|
114
|
-
// linerenderer to generate grid data points without overwriting the
|
115
|
-
// grid data associated with that series.
|
116
|
-
// Called with scope of a series.
|
117
|
-
$.jqplot.BezierCurveRenderer.prototype.makeGridData = function(data, plot) {
|
118
|
-
// recalculate the grid data
|
119
|
-
var xp = this._xaxis.series_u2p;
|
120
|
-
var yp = this._yaxis.series_u2p;
|
121
|
-
var gd = [];
|
122
|
-
var pgd = [];
|
123
|
-
// if seriesIndex = 0, fill to x axis.
|
124
|
-
// if seriesIndex > 0, fill to previous series data.
|
125
|
-
var idx = this.index;
|
126
|
-
if (data.length == 2) {
|
127
|
-
if (idx == 0) {
|
128
|
-
gd = [
|
129
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
130
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
131
|
-
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
132
|
-
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
133
|
-
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
134
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
135
|
-
];
|
136
|
-
}
|
137
|
-
else {
|
138
|
-
var psd = plot.series[idx-1].data;
|
139
|
-
gd = [
|
140
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
141
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
142
|
-
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
143
|
-
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
144
|
-
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
145
|
-
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
146
|
-
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
147
|
-
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
148
|
-
];
|
149
|
-
}
|
150
|
-
}
|
151
|
-
else {
|
152
|
-
if (idx == 0) {
|
153
|
-
gd = [
|
154
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
155
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
156
|
-
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
157
|
-
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
158
|
-
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
159
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
160
|
-
];
|
161
|
-
}
|
162
|
-
else {
|
163
|
-
var psd = plot.series[idx-1].data;
|
164
|
-
gd = [
|
165
|
-
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
166
|
-
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
167
|
-
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
168
|
-
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
169
|
-
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
170
|
-
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
171
|
-
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
172
|
-
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
173
|
-
];
|
174
|
-
}
|
175
|
-
}
|
176
|
-
return gd;
|
177
|
-
};
|
178
|
-
|
179
|
-
|
180
|
-
// called within scope of series.
|
181
|
-
$.jqplot.BezierCurveRenderer.prototype.draw = function(ctx, gd, options) {
|
182
|
-
var i;
|
183
|
-
ctx.save();
|
184
|
-
if (gd.length) {
|
185
|
-
if (this.showLine) {
|
186
|
-
ctx.save();
|
187
|
-
var opts = (options != null) ? options : {};
|
188
|
-
ctx.fillStyle = opts.fillStyle || this.color;
|
189
|
-
ctx.beginPath();
|
190
|
-
ctx.moveTo(gd[0][0], gd[0][1]);
|
191
|
-
ctx.bezierCurveTo(gd[1][0], gd[1][1], gd[1][2], gd[1][3], gd[1][4], gd[1][5]);
|
192
|
-
ctx.lineTo(gd[2][0], gd[2][1]);
|
193
|
-
if (gd[3].length == 2) {
|
194
|
-
ctx.lineTo(gd[3][0], gd[3][1]);
|
195
|
-
}
|
196
|
-
else {
|
197
|
-
ctx.bezierCurveTo(gd[3][0], gd[3][1], gd[3][2], gd[3][3], gd[3][4], gd[3][5]);
|
198
|
-
}
|
199
|
-
ctx.closePath();
|
200
|
-
ctx.fill();
|
201
|
-
ctx.restore();
|
202
|
-
}
|
203
|
-
}
|
204
|
-
|
205
|
-
ctx.restore();
|
206
|
-
};
|
207
|
-
|
208
|
-
$.jqplot.BezierCurveRenderer.prototype.drawShadow = function(ctx, gd, options) {
|
209
|
-
// This is a no-op, shadows drawn with lines.
|
210
|
-
};
|
211
|
-
|
212
|
-
$.jqplot.BezierAxisRenderer = function() {
|
213
|
-
$.jqplot.LinearAxisRenderer.call(this);
|
214
|
-
};
|
215
|
-
|
216
|
-
$.jqplot.BezierAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
217
|
-
$.jqplot.BezierAxisRenderer.prototype.constructor = $.jqplot.BezierAxisRenderer;
|
218
|
-
|
219
|
-
|
220
|
-
// Axes on a plot with Bezier Curves
|
221
|
-
$.jqplot.BezierAxisRenderer.prototype.init = function(options){
|
222
|
-
$.extend(true, this, options);
|
223
|
-
var db = this._dataBounds;
|
224
|
-
// Go through all the series attached to this axis and find
|
225
|
-
// the min/max bounds for this axis.
|
226
|
-
for (var i=0; i<this._series.length; i++) {
|
227
|
-
var s = this._series[i];
|
228
|
-
var d = s.data;
|
229
|
-
if (d.length == 4) {
|
230
|
-
for (var j=0; j<d.length; j++) {
|
231
|
-
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
232
|
-
if (d[j][0] < db.min || db.min == null) {
|
233
|
-
db.min = d[j][0];
|
234
|
-
}
|
235
|
-
if (d[j][0] > db.max || db.max == null) {
|
236
|
-
db.max = d[j][0];
|
237
|
-
}
|
238
|
-
}
|
239
|
-
else {
|
240
|
-
if (d[j][1] < db.min || db.min == null) {
|
241
|
-
db.min = d[j][1];
|
242
|
-
}
|
243
|
-
if (d[j][1] > db.max || db.max == null) {
|
244
|
-
db.max = d[j][1];
|
245
|
-
}
|
246
|
-
}
|
247
|
-
}
|
248
|
-
}
|
249
|
-
else {
|
250
|
-
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
251
|
-
if (d[0][0] < db.min || db.min == null) {
|
252
|
-
db.min = d[0][0];
|
253
|
-
}
|
254
|
-
if (d[0][0] > db.max || db.max == null) {
|
255
|
-
db.max = d[0][0];
|
256
|
-
}
|
257
|
-
for (var j=0; j<5; j+=2) {
|
258
|
-
if (d[1][j] < db.min || db.min == null) {
|
259
|
-
db.min = d[1][j];
|
260
|
-
}
|
261
|
-
if (d[1][j] > db.max || db.max == null) {
|
262
|
-
db.max = d[1][j];
|
263
|
-
}
|
264
|
-
}
|
265
|
-
}
|
266
|
-
else {
|
267
|
-
if (d[0][1] < db.min || db.min == null) {
|
268
|
-
db.min = d[0][1];
|
269
|
-
}
|
270
|
-
if (d[0][1] > db.max || db.max == null) {
|
271
|
-
db.max = d[0][1];
|
272
|
-
}
|
273
|
-
for (var j=1; j<6; j+=2) {
|
274
|
-
if (d[1][j] < db.min || db.min == null) {
|
275
|
-
db.min = d[1][j];
|
276
|
-
}
|
277
|
-
if (d[1][j] > db.max || db.max == null) {
|
278
|
-
db.max = d[1][j];
|
279
|
-
}
|
280
|
-
}
|
281
|
-
}
|
282
|
-
}
|
283
|
-
}
|
284
|
-
};
|
285
|
-
|
286
|
-
// setup default renderers for axes and legend so user doesn't have to
|
287
|
-
// called with scope of plot
|
288
|
-
function preInit(target, data, options) {
|
289
|
-
options = options || {};
|
290
|
-
options.axesDefaults = $.extend(true, {pad:0}, options.axesDefaults);
|
291
|
-
options.legend = $.extend(true, {placement:'outside'}, options.legend);
|
292
|
-
// only set these if there is a pie series
|
293
|
-
var setopts = false;
|
294
|
-
if (options.seriesDefaults.renderer == $.jqplot.BezierCurveRenderer) {
|
295
|
-
setopts = true;
|
296
|
-
}
|
297
|
-
else if (options.series) {
|
298
|
-
for (var i=0; i < options.series.length; i++) {
|
299
|
-
if (options.series[i].renderer == $.jqplot.BezierCurveRenderer) {
|
300
|
-
setopts = true;
|
301
|
-
}
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
if (setopts) {
|
306
|
-
options.axesDefaults.renderer = $.jqplot.BezierAxisRenderer;
|
307
|
-
}
|
308
|
-
}
|
309
|
-
|
310
|
-
$.jqplot.preInitHooks.push(preInit);
|
311
|
-
|
312
|
-
})(jQuery);
|
@@ -1,30 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jqPlot
|
3
|
-
* Pure JavaScript plotting plugin using jQuery
|
4
|
-
*
|
5
|
-
* Version: 1.0.0b1_r746
|
6
|
-
*
|
7
|
-
* Copyright (c) 2009-2011 Chris Leonello
|
8
|
-
* jqPlot is currently available for use in all personal or commercial projects
|
9
|
-
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
10
|
-
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
11
|
-
* choose the license that best suits your project and use it accordingly.
|
12
|
-
*
|
13
|
-
* Although not required, the author would appreciate an email letting him
|
14
|
-
* know of any substantial use of jqPlot. You can reach the author at:
|
15
|
-
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
16
|
-
*
|
17
|
-
* If you are feeling kind and generous, consider supporting the project by
|
18
|
-
* making a donation at: http://www.jqplot.com/donate.php .
|
19
|
-
*
|
20
|
-
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
21
|
-
*
|
22
|
-
* version 2007.04.27
|
23
|
-
* author Ash Searle
|
24
|
-
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
25
|
-
* http://hexmen.com/js/sprintf.js
|
26
|
-
* The author (Ash Searle) has placed this code in the public domain:
|
27
|
-
* "This code is unrestricted: you are free to use it however you like."
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
(function(b){b.jqplot.BezierCurveRenderer=function(){b.jqplot.LineRenderer.call(this)};b.jqplot.BezierCurveRenderer.prototype=new b.jqplot.LineRenderer();b.jqplot.BezierCurveRenderer.prototype.constructor=b.jqplot.BezierCurveRenderer;b.jqplot.BezierCurveRenderer.prototype.setGridData=function(h){var e=this._xaxis.series_u2p;var g=this._yaxis.series_u2p;var f=this.data;this.gridData=[];this._prevGridData=[];var d=this.index;if(f.length==2){if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,f[1][4]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,c[1][4]),g.call(this._yaxis,c[1][5])],[e.call(this._xaxis,c[1][2]),g.call(this._yaxis,c[1][3]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}else{if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,f[3][1]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,c[3][0]),g.call(this._yaxis,c[3][1])],[e.call(this._xaxis,c[2][0]),g.call(this._yaxis,c[2][1]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}};b.jqplot.BezierCurveRenderer.prototype.makeGridData=function(g,i){var f=this._xaxis.series_u2p;var h=this._yaxis.series_u2p;var e=[];var j=[];var d=this.index;if(g.length==2){if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,g[1][4]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,c[1][4]),h.call(this._yaxis,c[1][5])],[f.call(this._xaxis,c[1][2]),h.call(this._yaxis,c[1][3]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}else{if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,g[3][1]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,c[3][0]),h.call(this._yaxis,c[3][1])],[f.call(this._xaxis,c[2][0]),h.call(this._yaxis,c[2][1]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}return e};b.jqplot.BezierCurveRenderer.prototype.draw=function(c,g,d){var e;c.save();if(g.length){if(this.showLine){c.save();var f=(d!=null)?d:{};c.fillStyle=f.fillStyle||this.color;c.beginPath();c.moveTo(g[0][0],g[0][1]);c.bezierCurveTo(g[1][0],g[1][1],g[1][2],g[1][3],g[1][4],g[1][5]);c.lineTo(g[2][0],g[2][1]);if(g[3].length==2){c.lineTo(g[3][0],g[3][1])}else{c.bezierCurveTo(g[3][0],g[3][1],g[3][2],g[3][3],g[3][4],g[3][5])}c.closePath();c.fill();c.restore()}}c.restore()};b.jqplot.BezierCurveRenderer.prototype.drawShadow=function(c,e,d){};b.jqplot.BezierAxisRenderer=function(){b.jqplot.LinearAxisRenderer.call(this)};b.jqplot.BezierAxisRenderer.prototype=new b.jqplot.LinearAxisRenderer();b.jqplot.BezierAxisRenderer.prototype.constructor=b.jqplot.BezierAxisRenderer;b.jqplot.BezierAxisRenderer.prototype.init=function(f){b.extend(true,this,f);var c=this._dataBounds;for(var g=0;g<this._series.length;g++){var h=this._series[g];var k=h.data;if(k.length==4){for(var e=0;e<k.length;e++){if(this.name=="xaxis"||this.name=="x2axis"){if(k[e][0]<c.min||c.min==null){c.min=k[e][0]}if(k[e][0]>c.max||c.max==null){c.max=k[e][0]}}else{if(k[e][1]<c.min||c.min==null){c.min=k[e][1]}if(k[e][1]>c.max||c.max==null){c.max=k[e][1]}}}}else{if(this.name=="xaxis"||this.name=="x2axis"){if(k[0][0]<c.min||c.min==null){c.min=k[0][0]}if(k[0][0]>c.max||c.max==null){c.max=k[0][0]}for(var e=0;e<5;e+=2){if(k[1][e]<c.min||c.min==null){c.min=k[1][e]}if(k[1][e]>c.max||c.max==null){c.max=k[1][e]}}}else{if(k[0][1]<c.min||c.min==null){c.min=k[0][1]}if(k[0][1]>c.max||c.max==null){c.max=k[0][1]}for(var e=1;e<6;e+=2){if(k[1][e]<c.min||c.min==null){c.min=k[1][e]}if(k[1][e]>c.max||c.max==null){c.max=k[1][e]}}}}}};function a(g,f,d){d=d||{};d.axesDefaults=b.extend(true,{pad:0},d.axesDefaults);d.legend=b.extend(true,{placement:"outside"},d.legend);var c=false;if(d.seriesDefaults.renderer==b.jqplot.BezierCurveRenderer){c=true}else{if(d.series){for(var e=0;e<d.series.length;e++){if(d.series[e].renderer==b.jqplot.BezierCurveRenderer){c=true}}}}if(c){d.axesDefaults.renderer=b.jqplot.BezierAxisRenderer}}b.jqplot.preInitHooks.push(a)})(jQuery);
|
data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.js
DELETED
@@ -1,702 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* jqPlot
|
3
|
-
* Pure JavaScript plotting plugin using jQuery
|
4
|
-
*
|
5
|
-
* Version: 1.0.0b1_r746
|
6
|
-
*
|
7
|
-
* Copyright (c) 2009-2011 Chris Leonello
|
8
|
-
* jqPlot is currently available for use in all personal or commercial projects
|
9
|
-
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
10
|
-
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
11
|
-
* choose the license that best suits your project and use it accordingly.
|
12
|
-
*
|
13
|
-
* Although not required, the author would appreciate an email letting him
|
14
|
-
* know of any substantial use of jqPlot. You can reach the author at:
|
15
|
-
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
16
|
-
*
|
17
|
-
* If you are feeling kind and generous, consider supporting the project by
|
18
|
-
* making a donation at: http://www.jqplot.com/donate.php .
|
19
|
-
*
|
20
|
-
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
21
|
-
*
|
22
|
-
* version 2007.04.27
|
23
|
-
* author Ash Searle
|
24
|
-
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
25
|
-
* http://hexmen.com/js/sprintf.js
|
26
|
-
* The author (Ash Searle) has placed this code in the public domain:
|
27
|
-
* "This code is unrestricted: you are free to use it however you like."
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
(function($) {
|
31
|
-
|
32
|
-
// Class: $.jqplot.BarRenderer
|
33
|
-
// A plugin renderer for jqPlot to draw a bar plot.
|
34
|
-
// Draws series as a line.
|
35
|
-
|
36
|
-
$.jqplot.BarRenderer = function(){
|
37
|
-
$.jqplot.LineRenderer.call(this);
|
38
|
-
};
|
39
|
-
|
40
|
-
$.jqplot.BarRenderer.prototype = new $.jqplot.LineRenderer();
|
41
|
-
$.jqplot.BarRenderer.prototype.constructor = $.jqplot.BarRenderer;
|
42
|
-
|
43
|
-
// called with scope of series.
|
44
|
-
$.jqplot.BarRenderer.prototype.init = function(options, plot) {
|
45
|
-
// Group: Properties
|
46
|
-
//
|
47
|
-
// prop: barPadding
|
48
|
-
// Number of pixels between adjacent bars at the same axis value.
|
49
|
-
this.barPadding = 8;
|
50
|
-
// prop: barMargin
|
51
|
-
// Number of pixels between groups of bars at adjacent axis values.
|
52
|
-
this.barMargin = 10;
|
53
|
-
// prop: barDirection
|
54
|
-
// 'vertical' = up and down bars, 'horizontal' = side to side bars
|
55
|
-
this.barDirection = 'vertical';
|
56
|
-
// prop: barWidth
|
57
|
-
// Width of the bar in pixels (auto by devaul). null = calculated automatically.
|
58
|
-
this.barWidth = null;
|
59
|
-
// prop: shadowOffset
|
60
|
-
// offset of the shadow from the slice and offset of
|
61
|
-
// each succesive stroke of the shadow from the last.
|
62
|
-
this.shadowOffset = 2;
|
63
|
-
// prop: shadowDepth
|
64
|
-
// number of strokes to apply to the shadow,
|
65
|
-
// each stroke offset shadowOffset from the last.
|
66
|
-
this.shadowDepth = 5;
|
67
|
-
// prop: shadowAlpha
|
68
|
-
// transparency of the shadow (0 = transparent, 1 = opaque)
|
69
|
-
this.shadowAlpha = 0.08;
|
70
|
-
// prop: waterfall
|
71
|
-
// true to enable waterfall plot.
|
72
|
-
this.waterfall = false;
|
73
|
-
// prop: groups
|
74
|
-
// group bars into this many groups
|
75
|
-
this.groups = 1;
|
76
|
-
// prop: varyBarColor
|
77
|
-
// true to color each bar of a series separately rather than
|
78
|
-
// have every bar of a given series the same color.
|
79
|
-
// If used for non-stacked multiple series bar plots, user should
|
80
|
-
// specify a separate 'seriesColors' array for each series.
|
81
|
-
// Otherwise, each series will set their bars to the same color array.
|
82
|
-
// This option has no Effect for stacked bar charts and is disabled.
|
83
|
-
this.varyBarColor = false;
|
84
|
-
// prop: highlightMouseOver
|
85
|
-
// True to highlight slice when moused over.
|
86
|
-
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
87
|
-
this.highlightMouseOver = true;
|
88
|
-
// prop: highlightMouseDown
|
89
|
-
// True to highlight when a mouse button is pressed over a slice.
|
90
|
-
// This will be disabled if highlightMouseOver is true.
|
91
|
-
this.highlightMouseDown = false;
|
92
|
-
// prop: highlightColors
|
93
|
-
// an array of colors to use when highlighting a bar.
|
94
|
-
this.highlightColors = [];
|
95
|
-
this._type = 'bar';
|
96
|
-
|
97
|
-
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
98
|
-
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
99
|
-
options.highlightMouseOver = false;
|
100
|
-
}
|
101
|
-
|
102
|
-
$.extend(true, this, options);
|
103
|
-
// fill is still needed to properly draw the legend.
|
104
|
-
// bars have to be filled.
|
105
|
-
this.fill = true;
|
106
|
-
|
107
|
-
if (this.waterfall) {
|
108
|
-
this.fillToZero = false;
|
109
|
-
this.disableStack = true;
|
110
|
-
}
|
111
|
-
|
112
|
-
if (this.barDirection == 'vertical' ) {
|
113
|
-
this._primaryAxis = '_xaxis';
|
114
|
-
this._stackAxis = 'y';
|
115
|
-
this.fillAxis = 'y';
|
116
|
-
}
|
117
|
-
else {
|
118
|
-
this._primaryAxis = '_yaxis';
|
119
|
-
this._stackAxis = 'x';
|
120
|
-
this.fillAxis = 'x';
|
121
|
-
}
|
122
|
-
// index of the currenty highlighted point, if any
|
123
|
-
this._highlightedPoint = null;
|
124
|
-
// total number of values for all bar series, total number of bar series, and position of this series
|
125
|
-
this._plotSeriesInfo = null;
|
126
|
-
// Array of actual data colors used for each data point.
|
127
|
-
this._dataColors = [];
|
128
|
-
this._barPoints = [];
|
129
|
-
|
130
|
-
// set the shape renderer options
|
131
|
-
var opts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill};
|
132
|
-
this.renderer.shapeRenderer.init(opts);
|
133
|
-
// set the shadow renderer options
|
134
|
-
var sopts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill};
|
135
|
-
this.renderer.shadowRenderer.init(sopts);
|
136
|
-
|
137
|
-
plot.postInitHooks.addOnce(postInit);
|
138
|
-
plot.postDrawHooks.addOnce(postPlotDraw);
|
139
|
-
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
140
|
-
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
141
|
-
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
142
|
-
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
143
|
-
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
144
|
-
};
|
145
|
-
|
146
|
-
// called with scope of series
|
147
|
-
function barPreInit(target, data, seriesDefaults, options) {
|
148
|
-
if (this.rendererOptions.barDirection == 'horizontal') {
|
149
|
-
this._stackAxis = 'x';
|
150
|
-
this._primaryAxis = '_yaxis';
|
151
|
-
}
|
152
|
-
if (this.rendererOptions.waterfall == true) {
|
153
|
-
this._data = $.extend(true, [], this.data);
|
154
|
-
var sum = 0;
|
155
|
-
var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection == 'vertical') ? 1 : 0;
|
156
|
-
for(var i=0; i<this.data.length; i++) {
|
157
|
-
sum += this.data[i][pos];
|
158
|
-
if (i>0) {
|
159
|
-
this.data[i][pos] += this.data[i-1][pos];
|
160
|
-
}
|
161
|
-
}
|
162
|
-
this.data[this.data.length] = (pos == 1) ? [this.data.length+1, sum] : [sum, this.data.length+1];
|
163
|
-
this._data[this._data.length] = (pos == 1) ? [this._data.length+1, sum] : [sum, this._data.length+1];
|
164
|
-
}
|
165
|
-
if (this.rendererOptions.groups > 1) {
|
166
|
-
this.breakOnNull = true;
|
167
|
-
var l = this.data.length;
|
168
|
-
var skip = parseInt(l/this.rendererOptions.groups, 10);
|
169
|
-
var count = 0;
|
170
|
-
for (var i=skip; i<l; i+=skip) {
|
171
|
-
this.data.splice(i+count, 0, [null, null]);
|
172
|
-
count++;
|
173
|
-
}
|
174
|
-
for (i=0; i<this.data.length; i++) {
|
175
|
-
if (this._primaryAxis == '_xaxis') {
|
176
|
-
this.data[i][0] = i+1;
|
177
|
-
}
|
178
|
-
else {
|
179
|
-
this.data[i][1] = i+1;
|
180
|
-
}
|
181
|
-
}
|
182
|
-
}
|
183
|
-
}
|
184
|
-
|
185
|
-
$.jqplot.preSeriesInitHooks.push(barPreInit);
|
186
|
-
|
187
|
-
// needs to be called with scope of series, not renderer.
|
188
|
-
$.jqplot.BarRenderer.prototype.calcSeriesNumbers = function() {
|
189
|
-
var nvals = 0;
|
190
|
-
var nseries = 0;
|
191
|
-
var paxis = this[this._primaryAxis];
|
192
|
-
var s, series, pos;
|
193
|
-
// loop through all series on this axis
|
194
|
-
for (var i=0; i < paxis._series.length; i++) {
|
195
|
-
series = paxis._series[i];
|
196
|
-
if (series === this) {
|
197
|
-
pos = i;
|
198
|
-
}
|
199
|
-
// is the series rendered as a bar?
|
200
|
-
if (series.renderer.constructor == $.jqplot.BarRenderer) {
|
201
|
-
// gridData may not be computed yet, use data length insted
|
202
|
-
nvals += series.data.length;
|
203
|
-
nseries += 1;
|
204
|
-
}
|
205
|
-
}
|
206
|
-
// return total number of values for all bar series, total number of bar series, and position of this series
|
207
|
-
return [nvals, nseries, pos];
|
208
|
-
};
|
209
|
-
|
210
|
-
$.jqplot.BarRenderer.prototype.setBarWidth = function() {
|
211
|
-
// need to know how many data values we have on the approprate axis and figure it out.
|
212
|
-
var i;
|
213
|
-
var nvals = 0;
|
214
|
-
var nseries = 0;
|
215
|
-
var paxis = this[this._primaryAxis];
|
216
|
-
var s, series, pos;
|
217
|
-
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
218
|
-
nvals = temp[0];
|
219
|
-
nseries = temp[1];
|
220
|
-
var nticks = paxis.numberTicks;
|
221
|
-
var nbins = (nticks-1)/2;
|
222
|
-
// so, now we have total number of axis values.
|
223
|
-
if (paxis.name == 'xaxis' || paxis.name == 'x2axis') {
|
224
|
-
if (this._stack) {
|
225
|
-
this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals * nseries - this.barMargin;
|
226
|
-
}
|
227
|
-
else {
|
228
|
-
this.barWidth = ((paxis._offsets.max - paxis._offsets.min)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
229
|
-
// this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals - this.barPadding - this.barMargin/nseries;
|
230
|
-
}
|
231
|
-
}
|
232
|
-
else {
|
233
|
-
if (this._stack) {
|
234
|
-
this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals * nseries - this.barMargin;
|
235
|
-
}
|
236
|
-
else {
|
237
|
-
this.barWidth = ((paxis._offsets.min - paxis._offsets.max)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
238
|
-
// this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals - this.barPadding - this.barMargin/nseries;
|
239
|
-
}
|
240
|
-
}
|
241
|
-
return [nvals, nseries];
|
242
|
-
};
|
243
|
-
|
244
|
-
function computeHighlightColors (colors) {
|
245
|
-
var ret = [];
|
246
|
-
for (var i=0; i<colors.length; i++){
|
247
|
-
var rgba = $.jqplot.getColorComponents(colors[i]);
|
248
|
-
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
249
|
-
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
250
|
-
for (var j=0; j<3; j++) {
|
251
|
-
// when darkening, lowest color component can be is 60.
|
252
|
-
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
253
|
-
newrgb[j] = parseInt(newrgb[j], 10);
|
254
|
-
}
|
255
|
-
ret.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
|
256
|
-
}
|
257
|
-
return ret;
|
258
|
-
}
|
259
|
-
|
260
|
-
$.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options) {
|
261
|
-
var i;
|
262
|
-
// Ughhh, have to make a copy of options b/c it may be modified later.
|
263
|
-
var opts = $.extend({}, options);
|
264
|
-
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
265
|
-
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
266
|
-
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
267
|
-
var xaxis = this.xaxis;
|
268
|
-
var yaxis = this.yaxis;
|
269
|
-
var xp = this._xaxis.series_u2p;
|
270
|
-
var yp = this._yaxis.series_u2p;
|
271
|
-
var pointx, pointy;
|
272
|
-
// clear out data colors.
|
273
|
-
this._dataColors = [];
|
274
|
-
this._barPoints = [];
|
275
|
-
|
276
|
-
if (this.barWidth == null) {
|
277
|
-
this.renderer.setBarWidth.call(this);
|
278
|
-
}
|
279
|
-
|
280
|
-
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
281
|
-
var nvals = temp[0];
|
282
|
-
var nseries = temp[1];
|
283
|
-
var pos = temp[2];
|
284
|
-
var points = [];
|
285
|
-
|
286
|
-
if (this._stack) {
|
287
|
-
this._barNudge = 0;
|
288
|
-
}
|
289
|
-
else {
|
290
|
-
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
291
|
-
}
|
292
|
-
if (showLine) {
|
293
|
-
var negativeColors = new $.jqplot.ColorGenerator(this.negativeSeriesColors);
|
294
|
-
var positiveColors = new $.jqplot.ColorGenerator(this.seriesColors);
|
295
|
-
var negativeColor = negativeColors.get(this.index);
|
296
|
-
if (! this.useNegativeColors) {
|
297
|
-
negativeColor = opts.fillStyle;
|
298
|
-
}
|
299
|
-
var positiveColor = opts.fillStyle;
|
300
|
-
var base;
|
301
|
-
var xstart;
|
302
|
-
var ystart;
|
303
|
-
|
304
|
-
if (this.barDirection == 'vertical') {
|
305
|
-
for (var i=0; i<gridData.length; i++) {
|
306
|
-
if (this.data[i][1] == null) {
|
307
|
-
continue;
|
308
|
-
}
|
309
|
-
points = [];
|
310
|
-
base = gridData[i][0] + this._barNudge;
|
311
|
-
ystart;
|
312
|
-
|
313
|
-
// stacked
|
314
|
-
if (this._stack && this._prevGridData.length) {
|
315
|
-
ystart = this._prevGridData[i][1];
|
316
|
-
}
|
317
|
-
// not stacked and first series in stack
|
318
|
-
else {
|
319
|
-
if (this.fillToZero) {
|
320
|
-
ystart = this._yaxis.series_u2p(0);
|
321
|
-
}
|
322
|
-
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
323
|
-
ystart = this.gridData[i-1][1];
|
324
|
-
}
|
325
|
-
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
326
|
-
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
327
|
-
ystart = this._yaxis.series_u2p(0);
|
328
|
-
}
|
329
|
-
else if (this._yaxis.min > 0) {
|
330
|
-
ystart = ctx.canvas.height;
|
331
|
-
}
|
332
|
-
else {
|
333
|
-
ystart = 0;
|
334
|
-
}
|
335
|
-
}
|
336
|
-
else if (this.waterfall && i == this.gridData.length - 1) {
|
337
|
-
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
338
|
-
ystart = this._yaxis.series_u2p(0);
|
339
|
-
}
|
340
|
-
else if (this._yaxis.min > 0) {
|
341
|
-
ystart = ctx.canvas.height;
|
342
|
-
}
|
343
|
-
else {
|
344
|
-
ystart = 0;
|
345
|
-
}
|
346
|
-
}
|
347
|
-
else {
|
348
|
-
ystart = ctx.canvas.height;
|
349
|
-
}
|
350
|
-
}
|
351
|
-
if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
|
352
|
-
if (this.varyBarColor && !this._stack) {
|
353
|
-
if (this.useNegativeColors) {
|
354
|
-
opts.fillStyle = negativeColors.next();
|
355
|
-
}
|
356
|
-
else {
|
357
|
-
opts.fillStyle = positiveColors.next();
|
358
|
-
}
|
359
|
-
}
|
360
|
-
else {
|
361
|
-
opts.fillStyle = negativeColor;
|
362
|
-
}
|
363
|
-
}
|
364
|
-
else {
|
365
|
-
if (this.varyBarColor && !this._stack) {
|
366
|
-
opts.fillStyle = positiveColors.next();
|
367
|
-
}
|
368
|
-
else {
|
369
|
-
opts.fillStyle = positiveColor;
|
370
|
-
}
|
371
|
-
}
|
372
|
-
|
373
|
-
if (!this.fillToZero || this._plotData[i][1] >= 0) {
|
374
|
-
points.push([base-this.barWidth/2, ystart]);
|
375
|
-
points.push([base-this.barWidth/2, gridData[i][1]]);
|
376
|
-
points.push([base+this.barWidth/2, gridData[i][1]]);
|
377
|
-
points.push([base+this.barWidth/2, ystart]);
|
378
|
-
}
|
379
|
-
// for negative bars make sure points are always ordered clockwise
|
380
|
-
else {
|
381
|
-
points.push([base-this.barWidth/2, gridData[i][1]]);
|
382
|
-
points.push([base-this.barWidth/2, ystart]);
|
383
|
-
points.push([base+this.barWidth/2, ystart]);
|
384
|
-
points.push([base+this.barWidth/2, gridData[i][1]]);
|
385
|
-
}
|
386
|
-
this._barPoints.push(points);
|
387
|
-
// now draw the shadows if not stacked.
|
388
|
-
// for stacked plots, they are predrawn by drawShadow
|
389
|
-
if (shadow && !this._stack) {
|
390
|
-
var sopts = $.extend(true, {}, opts);
|
391
|
-
// need to get rid of fillStyle on shadow.
|
392
|
-
delete sopts.fillStyle;
|
393
|
-
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
394
|
-
}
|
395
|
-
var clr = opts.fillStyle || this.color;
|
396
|
-
this._dataColors.push(clr);
|
397
|
-
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
398
|
-
}
|
399
|
-
}
|
400
|
-
|
401
|
-
else if (this.barDirection == 'horizontal'){
|
402
|
-
for (var i=0; i<gridData.length; i++) {
|
403
|
-
if (this.data[i][0] == null) {
|
404
|
-
continue;
|
405
|
-
}
|
406
|
-
points = [];
|
407
|
-
base = gridData[i][1] - this._barNudge;
|
408
|
-
xstart;
|
409
|
-
|
410
|
-
if (this._stack && this._prevGridData.length) {
|
411
|
-
xstart = this._prevGridData[i][0];
|
412
|
-
}
|
413
|
-
// not stacked and first series in stack
|
414
|
-
else {
|
415
|
-
if (this.fillToZero) {
|
416
|
-
xstart = this._xaxis.series_u2p(0);
|
417
|
-
}
|
418
|
-
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
419
|
-
xstart = this.gridData[i-1][1];
|
420
|
-
}
|
421
|
-
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
422
|
-
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
423
|
-
xstart = this._xaxis.series_u2p(0);
|
424
|
-
}
|
425
|
-
else if (this._xaxis.min > 0) {
|
426
|
-
xstart = 0;
|
427
|
-
}
|
428
|
-
else {
|
429
|
-
xstart = ctx.canvas.width;
|
430
|
-
}
|
431
|
-
}
|
432
|
-
else if (this.waterfall && i == this.gridData.length - 1) {
|
433
|
-
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
434
|
-
xstart = this._xaxis.series_u2p(0);
|
435
|
-
}
|
436
|
-
else if (this._xaxis.min > 0) {
|
437
|
-
xstart = 0;
|
438
|
-
}
|
439
|
-
else {
|
440
|
-
xstart = ctx.canvas.width;
|
441
|
-
}
|
442
|
-
}
|
443
|
-
else {
|
444
|
-
xstart = 0;
|
445
|
-
}
|
446
|
-
}
|
447
|
-
if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
|
448
|
-
if (this.varyBarColor && !this._stack) {
|
449
|
-
if (this.useNegativeColors) {
|
450
|
-
opts.fillStyle = negativeColors.next();
|
451
|
-
}
|
452
|
-
else {
|
453
|
-
opts.fillStyle = positiveColors.next();
|
454
|
-
}
|
455
|
-
}
|
456
|
-
}
|
457
|
-
else {
|
458
|
-
if (this.varyBarColor && !this._stack) {
|
459
|
-
opts.fillStyle = positiveColors.next();
|
460
|
-
}
|
461
|
-
else {
|
462
|
-
opts.fillStyle = positiveColor;
|
463
|
-
}
|
464
|
-
}
|
465
|
-
|
466
|
-
points.push([xstart, base+this.barWidth/2]);
|
467
|
-
points.push([xstart, base-this.barWidth/2]);
|
468
|
-
points.push([gridData[i][0], base-this.barWidth/2]);
|
469
|
-
points.push([gridData[i][0], base+this.barWidth/2]);
|
470
|
-
this._barPoints.push(points);
|
471
|
-
// now draw the shadows if not stacked.
|
472
|
-
// for stacked plots, they are predrawn by drawShadow
|
473
|
-
if (shadow && !this._stack) {
|
474
|
-
var sopts = $.extend(true, {}, opts);
|
475
|
-
delete sopts.fillStyle;
|
476
|
-
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
477
|
-
}
|
478
|
-
var clr = opts.fillStyle || this.color;
|
479
|
-
this._dataColors.push(clr);
|
480
|
-
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
481
|
-
}
|
482
|
-
}
|
483
|
-
}
|
484
|
-
|
485
|
-
if (this.highlightColors.length == 0) {
|
486
|
-
this.highlightColors = computeHighlightColors(this._dataColors);
|
487
|
-
}
|
488
|
-
|
489
|
-
else if (typeof(this.highlightColors) == 'string') {
|
490
|
-
var temp = this.highlightColors;
|
491
|
-
this.highlightColors = [];
|
492
|
-
for (var i=0; i<this._dataColors.length; i++) {
|
493
|
-
this.highlightColors.push(temp);
|
494
|
-
}
|
495
|
-
}
|
496
|
-
|
497
|
-
};
|
498
|
-
|
499
|
-
|
500
|
-
// for stacked plots, shadows will be pre drawn by drawShadow.
|
501
|
-
$.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options) {
|
502
|
-
var i;
|
503
|
-
var opts = (options != undefined) ? options : {};
|
504
|
-
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
505
|
-
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
506
|
-
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
507
|
-
var xaxis = this.xaxis;
|
508
|
-
var yaxis = this.yaxis;
|
509
|
-
var xp = this._xaxis.series_u2p;
|
510
|
-
var yp = this._yaxis.series_u2p;
|
511
|
-
var pointx, points, pointy, nvals, nseries, pos;
|
512
|
-
|
513
|
-
if (this._stack && this.shadow) {
|
514
|
-
if (this.barWidth == null) {
|
515
|
-
this.renderer.setBarWidth.call(this);
|
516
|
-
}
|
517
|
-
|
518
|
-
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
519
|
-
nvals = temp[0];
|
520
|
-
nseries = temp[1];
|
521
|
-
pos = temp[2];
|
522
|
-
|
523
|
-
if (this._stack) {
|
524
|
-
this._barNudge = 0;
|
525
|
-
}
|
526
|
-
else {
|
527
|
-
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
528
|
-
}
|
529
|
-
if (showLine) {
|
530
|
-
|
531
|
-
if (this.barDirection == 'vertical') {
|
532
|
-
for (var i=0; i<gridData.length; i++) {
|
533
|
-
if (this.data[i][1] == null) {
|
534
|
-
continue;
|
535
|
-
}
|
536
|
-
points = [];
|
537
|
-
var base = gridData[i][0] + this._barNudge;
|
538
|
-
var ystart;
|
539
|
-
|
540
|
-
if (this._stack && this._prevGridData.length) {
|
541
|
-
ystart = this._prevGridData[i][1];
|
542
|
-
}
|
543
|
-
else {
|
544
|
-
if (this.fillToZero) {
|
545
|
-
ystart = this._yaxis.series_u2p(0);
|
546
|
-
}
|
547
|
-
else {
|
548
|
-
ystart = ctx.canvas.height;
|
549
|
-
}
|
550
|
-
}
|
551
|
-
|
552
|
-
points.push([base-this.barWidth/2, ystart]);
|
553
|
-
points.push([base-this.barWidth/2, gridData[i][1]]);
|
554
|
-
points.push([base+this.barWidth/2, gridData[i][1]]);
|
555
|
-
points.push([base+this.barWidth/2, ystart]);
|
556
|
-
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
557
|
-
}
|
558
|
-
}
|
559
|
-
|
560
|
-
else if (this.barDirection == 'horizontal'){
|
561
|
-
for (var i=0; i<gridData.length; i++) {
|
562
|
-
if (this.data[i][0] == null) {
|
563
|
-
continue;
|
564
|
-
}
|
565
|
-
points = [];
|
566
|
-
var base = gridData[i][1] - this._barNudge;
|
567
|
-
var xstart;
|
568
|
-
|
569
|
-
if (this._stack && this._prevGridData.length) {
|
570
|
-
xstart = this._prevGridData[i][0];
|
571
|
-
}
|
572
|
-
else {
|
573
|
-
xstart = 0;
|
574
|
-
}
|
575
|
-
|
576
|
-
points.push([xstart, base+this.barWidth/2]);
|
577
|
-
points.push([gridData[i][0], base+this.barWidth/2]);
|
578
|
-
points.push([gridData[i][0], base-this.barWidth/2]);
|
579
|
-
points.push([xstart, base-this.barWidth/2]);
|
580
|
-
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
581
|
-
}
|
582
|
-
}
|
583
|
-
}
|
584
|
-
|
585
|
-
}
|
586
|
-
};
|
587
|
-
|
588
|
-
function postInit(target, data, options) {
|
589
|
-
for (var i=0; i<this.series.length; i++) {
|
590
|
-
if (this.series[i].renderer.constructor == $.jqplot.BarRenderer) {
|
591
|
-
// don't allow mouseover and mousedown at same time.
|
592
|
-
if (this.series[i].highlightMouseOver) {
|
593
|
-
this.series[i].highlightMouseDown = false;
|
594
|
-
}
|
595
|
-
}
|
596
|
-
}
|
597
|
-
this.target.bind('mouseout', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
598
|
-
}
|
599
|
-
|
600
|
-
// called within context of plot
|
601
|
-
// create a canvas which we can draw on.
|
602
|
-
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
603
|
-
function postPlotDraw() {
|
604
|
-
this.plugins.barRenderer = {highlightedSeriesIndex:null};
|
605
|
-
this.plugins.barRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
606
|
-
|
607
|
-
this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions));
|
608
|
-
this.plugins.barRenderer.highlightCanvas.setContext();
|
609
|
-
}
|
610
|
-
|
611
|
-
function highlight (plot, sidx, pidx, points) {
|
612
|
-
var s = plot.series[sidx];
|
613
|
-
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
614
|
-
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
615
|
-
s._highlightedPoint = pidx;
|
616
|
-
plot.plugins.barRenderer.highlightedSeriesIndex = sidx;
|
617
|
-
var opts = {fillStyle: s.highlightColors[pidx]};
|
618
|
-
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
|
619
|
-
canvas = null;
|
620
|
-
}
|
621
|
-
|
622
|
-
function unhighlight (plot) {
|
623
|
-
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
624
|
-
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
625
|
-
for (var i=0; i<plot.series.length; i++) {
|
626
|
-
plot.series[i]._highlightedPoint = null;
|
627
|
-
}
|
628
|
-
plot.plugins.barRenderer.highlightedSeriesIndex = null;
|
629
|
-
plot.target.trigger('jqplotDataUnhighlight');
|
630
|
-
canvas = null;
|
631
|
-
}
|
632
|
-
|
633
|
-
|
634
|
-
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
635
|
-
if (neighbor) {
|
636
|
-
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
637
|
-
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
638
|
-
evt1.pageX = ev.pageX;
|
639
|
-
evt1.pageY = ev.pageY;
|
640
|
-
plot.target.trigger(evt1, ins);
|
641
|
-
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
642
|
-
var evt = jQuery.Event('jqplotDataHighlight');
|
643
|
-
evt.pageX = ev.pageX;
|
644
|
-
evt.pageY = ev.pageY;
|
645
|
-
plot.target.trigger(evt, ins);
|
646
|
-
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
647
|
-
}
|
648
|
-
}
|
649
|
-
else if (neighbor == null) {
|
650
|
-
unhighlight (plot);
|
651
|
-
}
|
652
|
-
}
|
653
|
-
|
654
|
-
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
655
|
-
if (neighbor) {
|
656
|
-
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
657
|
-
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
658
|
-
var evt = jQuery.Event('jqplotDataHighlight');
|
659
|
-
evt.pageX = ev.pageX;
|
660
|
-
evt.pageY = ev.pageY;
|
661
|
-
plot.target.trigger(evt, ins);
|
662
|
-
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
663
|
-
}
|
664
|
-
}
|
665
|
-
else if (neighbor == null) {
|
666
|
-
unhighlight (plot);
|
667
|
-
}
|
668
|
-
}
|
669
|
-
|
670
|
-
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
671
|
-
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
672
|
-
if (idx != null && plot.series[idx].highlightMouseDown) {
|
673
|
-
unhighlight(plot);
|
674
|
-
}
|
675
|
-
}
|
676
|
-
|
677
|
-
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
678
|
-
if (neighbor) {
|
679
|
-
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
680
|
-
var evt = jQuery.Event('jqplotDataClick');
|
681
|
-
evt.pageX = ev.pageX;
|
682
|
-
evt.pageY = ev.pageY;
|
683
|
-
plot.target.trigger(evt, ins);
|
684
|
-
}
|
685
|
-
}
|
686
|
-
|
687
|
-
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
688
|
-
if (neighbor) {
|
689
|
-
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
690
|
-
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
691
|
-
if (idx != null && plot.series[idx].highlightMouseDown) {
|
692
|
-
unhighlight(plot);
|
693
|
-
}
|
694
|
-
var evt = jQuery.Event('jqplotDataRightClick');
|
695
|
-
evt.pageX = ev.pageX;
|
696
|
-
evt.pageY = ev.pageY;
|
697
|
-
plot.target.trigger(evt, ins);
|
698
|
-
}
|
699
|
-
}
|
700
|
-
|
701
|
-
|
702
|
-
})(jQuery);
|