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
data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.min.js
DELETED
@@ -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($){$.jqplot.JSON=window.JSON;if(!window.JSON){$.jqplot.JSON={}}function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof $.jqplot.JSON.stringify!=="function"){$.jqplot.JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("$.jqplot.JSON.stringify")}return str("",{"":value})}}if(typeof $.jqplot.JSON.parse!=="function"){$.jqplot.JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("$.jqplot.JSON.parse")}}})(jQuery);
|
data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.js
DELETED
@@ -1,446 +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.LogAxisRenderer
|
33
|
-
* A plugin for a jqPlot to render a logarithmic axis.
|
34
|
-
*
|
35
|
-
* To use this renderer, include the plugin in your source
|
36
|
-
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.logAxisRenderer.js"></script>
|
37
|
-
*
|
38
|
-
* and supply the appropriate options to your plot
|
39
|
-
*
|
40
|
-
* > {axes:{xaxis:{renderer:$.jqplot.LogAxisRenderer}}}
|
41
|
-
**/
|
42
|
-
$.jqplot.LogAxisRenderer = function() {
|
43
|
-
$.jqplot.LinearAxisRenderer.call(this);
|
44
|
-
// prop: axisDefaults
|
45
|
-
// Default properties which will be applied directly to the series.
|
46
|
-
//
|
47
|
-
// Group: Properties
|
48
|
-
//
|
49
|
-
// Properties
|
50
|
-
//
|
51
|
-
/// base - the logarithmic base, commonly 2, 10 or Math.E
|
52
|
-
// tickDistribution - 'even' or 'power'. 'even' gives equal pixel
|
53
|
-
// spacing of the ticks on the plot. 'power' gives ticks in powers
|
54
|
-
// of 10.
|
55
|
-
this.axisDefaults = {
|
56
|
-
base : 10,
|
57
|
-
tickDistribution :'even'
|
58
|
-
};
|
59
|
-
};
|
60
|
-
|
61
|
-
$.jqplot.LogAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
62
|
-
$.jqplot.LogAxisRenderer.prototype.constructor = $.jqplot.LogAxisRenderer;
|
63
|
-
|
64
|
-
$.jqplot.LogAxisRenderer.prototype.init = function(options) {
|
65
|
-
// prop: tickRenderer
|
66
|
-
// A class of a rendering engine for creating the ticks labels displayed on the plot,
|
67
|
-
// See <$.jqplot.AxisTickRenderer>.
|
68
|
-
// this.tickRenderer = $.jqplot.AxisTickRenderer;
|
69
|
-
// this.labelRenderer = $.jqplot.AxisLabelRenderer;
|
70
|
-
$.extend(true, this.renderer, options);
|
71
|
-
for (var d in this.renderer.axisDefaults) {
|
72
|
-
if (this[d] == null) {
|
73
|
-
this[d] = this.renderer.axisDefaults[d];
|
74
|
-
}
|
75
|
-
}
|
76
|
-
var db = this._dataBounds;
|
77
|
-
// Go through all the series attached to this axis and find
|
78
|
-
// the min/max bounds for this axis.
|
79
|
-
for (var i=0; i<this._series.length; i++) {
|
80
|
-
var s = this._series[i];
|
81
|
-
var d = s.data;
|
82
|
-
|
83
|
-
for (var j=0; j<d.length; j++) {
|
84
|
-
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
85
|
-
if ((d[j][0] != null && d[j][0] < db.min) || db.min == null) {
|
86
|
-
db.min = d[j][0];
|
87
|
-
}
|
88
|
-
if ((d[j][0] != null && d[j][0] > db.max) || db.max == null) {
|
89
|
-
db.max = d[j][0];
|
90
|
-
}
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
if ((d[j][1] != null && d[j][1] < db.min) || db.min == null) {
|
94
|
-
db.min = d[j][1];
|
95
|
-
}
|
96
|
-
if ((d[j][1] != null && d[j][1] > db.max) || db.max == null) {
|
97
|
-
db.max = d[j][1];
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
};
|
103
|
-
|
104
|
-
$.jqplot.LogAxisRenderer.prototype.createTicks = function() {
|
105
|
-
// we're are operating on an axis here
|
106
|
-
var ticks = this._ticks;
|
107
|
-
var userTicks = this.ticks;
|
108
|
-
var name = this.name;
|
109
|
-
var db = this._dataBounds;
|
110
|
-
var dim, interval;
|
111
|
-
var min, max;
|
112
|
-
var pos1, pos2;
|
113
|
-
var tt, i;
|
114
|
-
|
115
|
-
// if we already have ticks, use them.
|
116
|
-
// ticks must be in order of increasing value.
|
117
|
-
if (userTicks.length) {
|
118
|
-
// ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
|
119
|
-
for (i=0; i<userTicks.length; i++){
|
120
|
-
var ut = userTicks[i];
|
121
|
-
var t = new this.tickRenderer(this.tickOptions);
|
122
|
-
if (ut.constructor == Array) {
|
123
|
-
t.value = ut[0];
|
124
|
-
t.label = ut[1];
|
125
|
-
if (!this.showTicks) {
|
126
|
-
t.showLabel = false;
|
127
|
-
t.showMark = false;
|
128
|
-
}
|
129
|
-
else if (!this.showTickMarks) {
|
130
|
-
t.showMark = false;
|
131
|
-
}
|
132
|
-
t.setTick(ut[0], this.name);
|
133
|
-
this._ticks.push(t);
|
134
|
-
}
|
135
|
-
|
136
|
-
else {
|
137
|
-
t.value = ut;
|
138
|
-
if (!this.showTicks) {
|
139
|
-
t.showLabel = false;
|
140
|
-
t.showMark = false;
|
141
|
-
}
|
142
|
-
else if (!this.showTickMarks) {
|
143
|
-
t.showMark = false;
|
144
|
-
}
|
145
|
-
t.setTick(ut, this.name);
|
146
|
-
this._ticks.push(t);
|
147
|
-
}
|
148
|
-
}
|
149
|
-
this.numberTicks = userTicks.length;
|
150
|
-
this.min = this._ticks[0].value;
|
151
|
-
this.max = this._ticks[this.numberTicks-1].value;
|
152
|
-
}
|
153
|
-
|
154
|
-
// we don't have any ticks yet, let's make some!
|
155
|
-
else {
|
156
|
-
if (name == 'xaxis' || name == 'x2axis') {
|
157
|
-
dim = this._plotDimensions.width;
|
158
|
-
}
|
159
|
-
else {
|
160
|
-
dim = this._plotDimensions.height;
|
161
|
-
}
|
162
|
-
|
163
|
-
min = ((this.min != null) ? this.min : db.min);
|
164
|
-
max = ((this.max != null) ? this.max : db.max);
|
165
|
-
|
166
|
-
// if min and max are same, space them out a bit
|
167
|
-
if (min == max) {
|
168
|
-
var adj = 0.05;
|
169
|
-
min = min*(1-adj);
|
170
|
-
max = max*(1+adj);
|
171
|
-
}
|
172
|
-
|
173
|
-
// perform some checks
|
174
|
-
if (this.min != null && this.min <= 0) {
|
175
|
-
throw('log axis minimum must be greater than 0');
|
176
|
-
}
|
177
|
-
if (this.max != null && this.max <= 0) {
|
178
|
-
throw('log axis maximum must be greater than 0');
|
179
|
-
}
|
180
|
-
// if (this.pad >1.99) this.pad = 1.99;
|
181
|
-
var range = max - min;
|
182
|
-
var rmin, rmax;
|
183
|
-
|
184
|
-
if (this.tickDistribution == 'even') {
|
185
|
-
rmin = (this.min != null) ? this.min : min - min*((this.padMin-1)/2);
|
186
|
-
rmax = (this.max != null) ? this.max : max + max*((this.padMax-1)/2);
|
187
|
-
this.min = rmin;
|
188
|
-
this.max = rmax;
|
189
|
-
range = this.max - this.min;
|
190
|
-
|
191
|
-
if (this.numberTicks == null){
|
192
|
-
if (dim > 100) {
|
193
|
-
this.numberTicks = parseInt(3+(dim-100)/75, 10);
|
194
|
-
}
|
195
|
-
else {
|
196
|
-
this.numberTicks = 2;
|
197
|
-
}
|
198
|
-
}
|
199
|
-
|
200
|
-
var u = Math.pow(this.base, (1/(this.numberTicks-1)*Math.log(this.max/this.min)/Math.log(this.base)));
|
201
|
-
for (var i=0; i<this.numberTicks; i++){
|
202
|
-
tt = this.min * Math.pow(u, i);
|
203
|
-
var t = new this.tickRenderer(this.tickOptions);
|
204
|
-
if (!this.showTicks) {
|
205
|
-
t.showLabel = false;
|
206
|
-
t.showMark = false;
|
207
|
-
}
|
208
|
-
else if (!this.showTickMarks) {
|
209
|
-
t.showMark = false;
|
210
|
-
}
|
211
|
-
t.setTick(tt, this.name);
|
212
|
-
this._ticks.push(t);
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
else if (this.tickDistribution == 'power'){
|
218
|
-
// for power distribution, open up range to get a nice power of axis.renderer.base.
|
219
|
-
// power distribution won't respect the user's min/max settings.
|
220
|
-
rmin = Math.pow(this.base, Math.ceil(Math.log(min*(2-this.padMin))/Math.log(this.base))-1);
|
221
|
-
rmax = Math.pow(this.base, Math.floor(Math.log(max*this.padMax)/Math.log(this.base))+1);
|
222
|
-
this.min = rmin;
|
223
|
-
this.max = rmax;
|
224
|
-
range = this.max - this.min;
|
225
|
-
|
226
|
-
var fittedTicks = 0;
|
227
|
-
var minorTicks = 0;
|
228
|
-
if (this.numberTicks == null){
|
229
|
-
if (dim > 100) {
|
230
|
-
this.numberTicks = Math.round(Math.log(this.max/this.min)/Math.log(this.base) + 1);
|
231
|
-
if (this.numberTicks < 2) {
|
232
|
-
this.numberTicks = 2;
|
233
|
-
}
|
234
|
-
fittedTicks = parseInt(3+(dim-100)/75, 10);
|
235
|
-
}
|
236
|
-
else {
|
237
|
-
this.numberTicks = 2;
|
238
|
-
fittedTicks = 2;
|
239
|
-
}
|
240
|
-
// if we don't have enough ticks, add some intermediate ticks
|
241
|
-
// how many to have between major ticks.
|
242
|
-
if (this.numberTicks < fittedTicks-1) {
|
243
|
-
minorTicks = Math.floor(fittedTicks/this.numberTicks);
|
244
|
-
}
|
245
|
-
}
|
246
|
-
|
247
|
-
for (var i=0; i<this.numberTicks; i++){
|
248
|
-
tt = Math.pow(this.base, i - this.numberTicks + 1) * this.max;
|
249
|
-
var t = new this.tickRenderer(this.tickOptions);
|
250
|
-
if (!this.showTicks) {
|
251
|
-
t.showLabel = false;
|
252
|
-
t.showMark = false;
|
253
|
-
}
|
254
|
-
else if (!this.showTickMarks) {
|
255
|
-
t.showMark = false;
|
256
|
-
}
|
257
|
-
t.setTick(tt, this.name);
|
258
|
-
this._ticks.push(t);
|
259
|
-
|
260
|
-
if (minorTicks && i<this.numberTicks-1) {
|
261
|
-
var tt1 = Math.pow(this.base, i - this.numberTicks + 2) * this.max;
|
262
|
-
var spread = tt1 - tt;
|
263
|
-
var interval = tt1 / (minorTicks+1);
|
264
|
-
for (var j=minorTicks-1; j>=0; j--) {
|
265
|
-
var val = tt1-interval*(j+1);
|
266
|
-
var t = new this.tickRenderer(this.tickOptions);
|
267
|
-
if (!this.showTicks) {
|
268
|
-
t.showLabel = false;
|
269
|
-
t.showMark = false;
|
270
|
-
}
|
271
|
-
else if (!this.showTickMarks) {
|
272
|
-
t.showMark = false;
|
273
|
-
}
|
274
|
-
t.setTick(val, this.name);
|
275
|
-
this._ticks.push(t);
|
276
|
-
}
|
277
|
-
}
|
278
|
-
}
|
279
|
-
}
|
280
|
-
}
|
281
|
-
};
|
282
|
-
|
283
|
-
$.jqplot.LogAxisRenderer.prototype.pack = function(pos, offsets) {
|
284
|
-
var lb = parseInt(this.base, 10);
|
285
|
-
var ticks = this._ticks;
|
286
|
-
var trans = function (v) { return Math.log(v)/Math.log(lb); };
|
287
|
-
var invtrans = function (v) { return Math.pow(Math.E, (Math.log(lb)*v)); };
|
288
|
-
var max = trans(this.max);
|
289
|
-
var min = trans(this.min);
|
290
|
-
var offmax = offsets.max;
|
291
|
-
var offmin = offsets.min;
|
292
|
-
var lshow = (this._label == null) ? false : this._label.show;
|
293
|
-
|
294
|
-
for (var p in pos) {
|
295
|
-
this._elem.css(p, pos[p]);
|
296
|
-
}
|
297
|
-
|
298
|
-
this._offsets = offsets;
|
299
|
-
// pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
|
300
|
-
var pixellength = offmax - offmin;
|
301
|
-
var unitlength = max - min;
|
302
|
-
|
303
|
-
// point to unit and unit to point conversions references to Plot DOM element top left corner.
|
304
|
-
this.p2u = function(p){
|
305
|
-
return invtrans((p - offmin) * unitlength / pixellength + min);
|
306
|
-
};
|
307
|
-
|
308
|
-
this.u2p = function(u){
|
309
|
-
return (trans(u) - min) * pixellength / unitlength + offmin;
|
310
|
-
};
|
311
|
-
|
312
|
-
if (this.name == 'xaxis' || this.name == 'x2axis'){
|
313
|
-
this.series_u2p = function(u){
|
314
|
-
return (trans(u) - min) * pixellength / unitlength;
|
315
|
-
};
|
316
|
-
this.series_p2u = function(p){
|
317
|
-
return invtrans(p * unitlength / pixellength + min);
|
318
|
-
};
|
319
|
-
}
|
320
|
-
// yaxis is max at top of canvas.
|
321
|
-
else {
|
322
|
-
this.series_u2p = function(u){
|
323
|
-
return (trans(u) - max) * pixellength / unitlength;
|
324
|
-
};
|
325
|
-
this.series_p2u = function(p){
|
326
|
-
return invtrans(p * unitlength / pixellength + max);
|
327
|
-
};
|
328
|
-
}
|
329
|
-
|
330
|
-
if (this.show) {
|
331
|
-
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
332
|
-
for (var i=0; i<ticks.length; i++) {
|
333
|
-
var t = ticks[i];
|
334
|
-
if (t.show && t.showLabel) {
|
335
|
-
var shim;
|
336
|
-
|
337
|
-
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
338
|
-
switch (t.labelPosition) {
|
339
|
-
case 'auto':
|
340
|
-
// position at end
|
341
|
-
if (t.angle < 0) {
|
342
|
-
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
343
|
-
}
|
344
|
-
// position at start
|
345
|
-
else {
|
346
|
-
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
347
|
-
}
|
348
|
-
break;
|
349
|
-
case 'end':
|
350
|
-
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
351
|
-
break;
|
352
|
-
case 'start':
|
353
|
-
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
354
|
-
break;
|
355
|
-
case 'middle':
|
356
|
-
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
357
|
-
break;
|
358
|
-
default:
|
359
|
-
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
360
|
-
break;
|
361
|
-
}
|
362
|
-
}
|
363
|
-
else {
|
364
|
-
shim = -t.getWidth()/2;
|
365
|
-
}
|
366
|
-
// var shim = t.getWidth()/2;
|
367
|
-
var val = this.u2p(t.value) + shim + 'px';
|
368
|
-
t._elem.css('left', val);
|
369
|
-
t.pack();
|
370
|
-
}
|
371
|
-
}
|
372
|
-
if (lshow) {
|
373
|
-
var w = this._label._elem.outerWidth(true);
|
374
|
-
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
|
375
|
-
if (this.name == 'xaxis') {
|
376
|
-
this._label._elem.css('bottom', '0px');
|
377
|
-
}
|
378
|
-
else {
|
379
|
-
this._label._elem.css('top', '0px');
|
380
|
-
}
|
381
|
-
this._label.pack();
|
382
|
-
}
|
383
|
-
}
|
384
|
-
else {
|
385
|
-
for (var i=0; i<ticks.length; i++) {
|
386
|
-
var t = ticks[i];
|
387
|
-
if (t.show && t.showLabel) {
|
388
|
-
var shim;
|
389
|
-
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
390
|
-
switch (t.labelPosition) {
|
391
|
-
case 'auto':
|
392
|
-
// position at end
|
393
|
-
case 'end':
|
394
|
-
if (t.angle < 0) {
|
395
|
-
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
396
|
-
}
|
397
|
-
else {
|
398
|
-
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
399
|
-
}
|
400
|
-
break;
|
401
|
-
case 'start':
|
402
|
-
if (t.angle > 0) {
|
403
|
-
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
404
|
-
}
|
405
|
-
else {
|
406
|
-
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
407
|
-
}
|
408
|
-
break;
|
409
|
-
case 'middle':
|
410
|
-
// if (t.angle > 0) {
|
411
|
-
// shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
412
|
-
// }
|
413
|
-
// else {
|
414
|
-
// shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
415
|
-
// }
|
416
|
-
shim = -t.getHeight()/2;
|
417
|
-
break;
|
418
|
-
default:
|
419
|
-
shim = -t.getHeight()/2;
|
420
|
-
break;
|
421
|
-
}
|
422
|
-
}
|
423
|
-
else {
|
424
|
-
shim = -t.getHeight()/2;
|
425
|
-
}
|
426
|
-
|
427
|
-
var val = this.u2p(t.value) + shim + 'px';
|
428
|
-
t._elem.css('top', val);
|
429
|
-
t.pack();
|
430
|
-
}
|
431
|
-
}
|
432
|
-
if (lshow) {
|
433
|
-
var h = this._label._elem.outerHeight(true);
|
434
|
-
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
|
435
|
-
if (this.name == 'yaxis') {
|
436
|
-
this._label._elem.css('left', '0px');
|
437
|
-
}
|
438
|
-
else {
|
439
|
-
this._label._elem.css('right', '0px');
|
440
|
-
}
|
441
|
-
this._label.pack();
|
442
|
-
}
|
443
|
-
}
|
444
|
-
}
|
445
|
-
};
|
446
|
-
})(jQuery);
|