jquery_cheats 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/README.md +1 -0
  2. data/app/assets/javascripts/jquery_cheats/jquery_cheats.js +1 -1
  3. data/app/assets/javascripts/jquery_cheats/replacementContextMenu.js +62 -0
  4. data/jquery_cheats.gemspec +2 -2
  5. data/lib/jquery_cheats/jquery_cheats.rb +58 -0
  6. data/vendor/assets/javascripts/jqplot/excanvas.js +1438 -0
  7. data/vendor/assets/javascripts/jqplot/jquery.jqplot.js +10901 -0
  8. data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.js +312 -0
  9. data/vendor/assets/javascripts/jqplot/plugins/jqplot.BezierCurveRenderer.min.js +57 -0
  10. data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.js +747 -0
  11. data/vendor/assets/javascripts/jqplot/plugins/jqplot.barRenderer.min.js +57 -0
  12. data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.js +234 -0
  13. data/vendor/assets/javascripts/jqplot/plugins/jqplot.blockRenderer.min.js +57 -0
  14. data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.js +754 -0
  15. data/vendor/assets/javascripts/jqplot/plugins/jqplot.bubbleRenderer.min.js +57 -0
  16. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js +202 -0
  17. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js +57 -0
  18. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.js +242 -0
  19. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js +57 -0
  20. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.js +864 -0
  21. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasOverlay.min.js +57 -0
  22. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.js +448 -0
  23. data/vendor/assets/javascripts/jqplot/plugins/jqplot.canvasTextRenderer.min.js +57 -0
  24. data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.js +636 -0
  25. data/vendor/assets/javascripts/jqplot/plugins/jqplot.categoryAxisRenderer.min.js +57 -0
  26. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.js +115 -0
  27. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ciParser.min.js +57 -0
  28. data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.js +1093 -0
  29. data/vendor/assets/javascripts/jqplot/plugins/jqplot.cursor.min.js +57 -0
  30. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.js +702 -0
  31. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dateAxisRenderer.min.js +57 -0
  32. data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.js +800 -0
  33. data/vendor/assets/javascripts/jqplot/plugins/jqplot.donutRenderer.min.js +57 -0
  34. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.js +224 -0
  35. data/vendor/assets/javascripts/jqplot/plugins/jqplot.dragable.min.js +57 -0
  36. data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.js +241 -0
  37. data/vendor/assets/javascripts/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js +57 -0
  38. data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.js +938 -0
  39. data/vendor/assets/javascripts/jqplot/plugins/jqplot.funnelRenderer.min.js +57 -0
  40. data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.js +454 -0
  41. data/vendor/assets/javascripts/jqplot/plugins/jqplot.highlighter.min.js +57 -0
  42. data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.js +475 -0
  43. data/vendor/assets/javascripts/jqplot/plugins/jqplot.json2.min.js +57 -0
  44. data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.js +528 -0
  45. data/vendor/assets/javascripts/jqplot/plugins/jqplot.logAxisRenderer.min.js +57 -0
  46. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.js +610 -0
  47. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoAxisRenderer.min.js +57 -0
  48. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.js +436 -0
  49. data/vendor/assets/javascripts/jqplot/plugins/jqplot.mekkoRenderer.min.js +57 -0
  50. data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.js +1029 -0
  51. data/vendor/assets/javascripts/jqplot/plugins/jqplot.meterGaugeRenderer.min.js +57 -0
  52. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.js +372 -0
  53. data/vendor/assets/javascripts/jqplot/plugins/jqplot.ohlcRenderer.min.js +57 -0
  54. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.js +899 -0
  55. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pieRenderer.min.js +57 -0
  56. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.js +362 -0
  57. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pointLabels.min.js +57 -0
  58. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.js +730 -0
  59. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidAxisRenderer.min.js +57 -0
  60. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.js +423 -0
  61. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidGridRenderer.min.js +57 -0
  62. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.js +490 -0
  63. data/vendor/assets/javascripts/jqplot/plugins/jqplot.pyramidRenderer.min.js +57 -0
  64. data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.js +222 -0
  65. data/vendor/assets/javascripts/jqplot/plugins/jqplot.trendline.min.js +57 -0
  66. data/vendor/assets/javascripts/jquery_cheats/spinjs/spin.min.js +1 -1
  67. data/vendor/assets/stylesheets/jquery.jqplot.css +259 -0
  68. metadata +66 -3
@@ -0,0 +1,57 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.0b2_r1012
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
+ * included jsDate library by Chris Leonello:
30
+ *
31
+ * Copyright (c) 2010-2011 Chris Leonello
32
+ *
33
+ * jsDate is currently available for use in all personal or commercial projects
34
+ * under both the MIT and GPL version 2.0 licenses. This means that you can
35
+ * choose the license that best suits your project and use it accordingly.
36
+ *
37
+ * jsDate borrows many concepts and ideas from the Date Instance
38
+ * Methods by Ken Snyder along with some parts of Ken's actual code.
39
+ *
40
+ * Ken's origianl Date Instance Methods and copyright notice:
41
+ *
42
+ * Ken Snyder (ken d snyder at gmail dot com)
43
+ * 2008-09-10
44
+ * version 2.0.2 (http://kendsnyder.com/sandbox/date/)
45
+ * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
46
+ *
47
+ * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
48
+ * Larry has generously given permission to adapt his code for inclusion
49
+ * into jqPlot.
50
+ *
51
+ * Larry's original code can be found here:
52
+ *
53
+ * https://github.com/lsiden/export-jqplot-to-png
54
+ *
55
+ *
56
+ */
57
+ (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);
@@ -0,0 +1,528 @@
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.0b2_r1012
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 - Deprecated. "power" distribution of ticks
53
+ // always used. Option has no effect.
54
+ this.axisDefaults = {
55
+ base : 10,
56
+ tickDistribution :'power'
57
+ };
58
+ };
59
+
60
+ $.jqplot.LogAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
61
+ $.jqplot.LogAxisRenderer.prototype.constructor = $.jqplot.LogAxisRenderer;
62
+
63
+ $.jqplot.LogAxisRenderer.prototype.init = function(options) {
64
+ // prop: drawBaseline
65
+ // True to draw the axis baseline.
66
+ this.drawBaseline = true;
67
+ // prop: minorTicks
68
+ // Number of ticks to add between "major" ticks.
69
+ // Major ticks are ticks supplied by user or auto computed.
70
+ // Minor ticks cannot be created by user.
71
+ this.minorTicks = 'auto';
72
+ this._scalefact = 1.0;
73
+
74
+ $.extend(true, this, options);
75
+
76
+ this._autoFormatString = '%d';
77
+ this._overrideFormatString = false;
78
+
79
+ for (var d in this.renderer.axisDefaults) {
80
+ if (this[d] == null) {
81
+ this[d] = this.renderer.axisDefaults[d];
82
+ }
83
+ }
84
+
85
+ this.resetDataBounds();
86
+ };
87
+
88
+ $.jqplot.LogAxisRenderer.prototype.createTicks = function(plot) {
89
+ // we're are operating on an axis here
90
+ var ticks = this._ticks;
91
+ var userTicks = this.ticks;
92
+ var name = this.name;
93
+ var db = this._dataBounds;
94
+ var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
95
+ var interval;
96
+ var min, max;
97
+ var pos1, pos2;
98
+ var tt, i;
99
+
100
+ var threshold = 30;
101
+ // For some reason scalefactor is screwing up ticks.
102
+ this._scalefact = (Math.max(dim, threshold+1) - threshold)/300;
103
+
104
+ // if we already have ticks, use them.
105
+ // ticks must be in order of increasing value.
106
+ if (userTicks.length) {
107
+ // ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
108
+ for (i=0; i<userTicks.length; i++){
109
+ var ut = userTicks[i];
110
+ var t = new this.tickRenderer(this.tickOptions);
111
+ if (ut.constructor == Array) {
112
+ t.value = ut[0];
113
+ t.label = ut[1];
114
+ if (!this.showTicks) {
115
+ t.showLabel = false;
116
+ t.showMark = false;
117
+ }
118
+ else if (!this.showTickMarks) {
119
+ t.showMark = false;
120
+ }
121
+ t.setTick(ut[0], this.name);
122
+ this._ticks.push(t);
123
+ }
124
+
125
+ else if ($.isPlainObject(ut)) {
126
+ $.extend(true, t, ut);
127
+ t.axis = this.name;
128
+ this._ticks.push(t);
129
+ }
130
+
131
+ else {
132
+ t.value = ut;
133
+ if (!this.showTicks) {
134
+ t.showLabel = false;
135
+ t.showMark = false;
136
+ }
137
+ else if (!this.showTickMarks) {
138
+ t.showMark = false;
139
+ }
140
+ t.setTick(ut, this.name);
141
+ this._ticks.push(t);
142
+ }
143
+ }
144
+ this.numberTicks = userTicks.length;
145
+ this.min = this._ticks[0].value;
146
+ this.max = this._ticks[this.numberTicks-1].value;
147
+ }
148
+
149
+ // we don't have any ticks yet, let's make some!
150
+ else if (this.min == null && this.max == null) {
151
+ min = db.min * (2 - this.padMin);
152
+ max = db.max * this.padMax;
153
+
154
+ // if min and max are same, space them out a bit
155
+ if (min == max) {
156
+ var adj = 0.05;
157
+ min = min*(1-adj);
158
+ max = max*(1+adj);
159
+ }
160
+
161
+ // perform some checks
162
+ if (this.min != null && this.min <= 0) {
163
+ throw('log axis minimum must be greater than 0');
164
+ }
165
+ if (this.max != null && this.max <= 0) {
166
+ throw('log axis maximum must be greater than 0');
167
+ }
168
+
169
+ function findCeil (val) {
170
+ var order = Math.pow(10, Math.floor(Math.log(val)/Math.LN10));
171
+ return Math.ceil(val/order) * order;
172
+ }
173
+
174
+ function findFloor(val) {
175
+ var order = Math.pow(10, Math.floor(Math.log(val)/Math.LN10));
176
+ return Math.floor(val/order) * order;
177
+ }
178
+
179
+ // var range = max - min;
180
+ var rmin, rmax;
181
+
182
+ // for power distribution, open up range to get a nice power of axis.renderer.base.
183
+ // power distribution won't respect the user's min/max settings.
184
+ rmin = Math.pow(this.base, Math.floor(Math.log(min)/Math.log(this.base)));
185
+ rmax = Math.pow(this.base, Math.ceil(Math.log(max)/Math.log(this.base)));
186
+
187
+ // // if min and max are same, space them out a bit
188
+ // if (rmin === rmax) {
189
+ // var adj = 0.05;
190
+ // rmin = rmin*(1-adj);
191
+ // rmax = rmax*(1+adj);
192
+ // }
193
+
194
+ var order = Math.round(Math.log(rmin)/Math.LN10);
195
+
196
+ if (this.tickOptions == null || !this.tickOptions.formatString) {
197
+ this._overrideFormatString = true;
198
+ }
199
+
200
+ this.min = rmin;
201
+ this.max = rmax;
202
+ var range = this.max - this.min;
203
+
204
+ var minorTicks = (this.minorTicks === 'auto') ? 0 : this.minorTicks;
205
+ var numberTicks;
206
+ if (this.numberTicks == null){
207
+ if (dim > 140) {
208
+ numberTicks = Math.round(Math.log(this.max/this.min)/Math.log(this.base) + 1);
209
+ if (numberTicks < 2) {
210
+ numberTicks = 2;
211
+ }
212
+ if (minorTicks === 0) {
213
+ var temp = dim/(numberTicks - 1);
214
+ if (temp < 100) {
215
+ minorTicks = 0;
216
+ }
217
+ else if (temp < 190) {
218
+ minorTicks = 1;
219
+ }
220
+ else if (temp < 250) {
221
+ minorTicks = 3;
222
+ }
223
+ else if (temp < 600) {
224
+ minorTicks = 4;
225
+ }
226
+ else {
227
+ minorTicks = 9;
228
+ }
229
+ }
230
+ }
231
+ else {
232
+ numberTicks = 2;
233
+ if (minorTicks === 0) {
234
+ minorTicks = 1;
235
+ }
236
+ minorTicks = 0;
237
+ }
238
+ }
239
+ else {
240
+ numberTicks = this.numberTicks;
241
+ }
242
+
243
+ if (order >= 0 && minorTicks !== 3) {
244
+ this._autoFormatString = '%d';
245
+ }
246
+ // Adjust format string for case with 3 ticks where we'll have like 1, 2.5, 5, 7.5, 10
247
+ else if (order <= 0 && minorTicks === 3) {
248
+ var temp = -(order - 1);
249
+ this._autoFormatString = '%.'+ Math.abs(order-1) + 'f';
250
+ }
251
+
252
+ // Adjust format string for values less than 1.
253
+ else if (order < 0) {
254
+ var temp = -order;
255
+ this._autoFormatString = '%.'+ Math.abs(order) + 'f';
256
+ }
257
+
258
+ else {
259
+ this._autoFormatString = '%d';
260
+ }
261
+
262
+ var to, t, val, tt1, spread, interval;
263
+ for (var i=0; i<numberTicks; i++){
264
+ tt = Math.pow(this.base, i - numberTicks + 1) * this.max;
265
+
266
+ t = new this.tickRenderer(this.tickOptions);
267
+
268
+ if (this._overrideFormatString) {
269
+ t.formatString = this._autoFormatString;
270
+ }
271
+
272
+ if (!this.showTicks) {
273
+ t.showLabel = false;
274
+ t.showMark = false;
275
+ }
276
+ else if (!this.showTickMarks) {
277
+ t.showMark = false;
278
+ }
279
+ t.setTick(tt, this.name);
280
+ this._ticks.push(t);
281
+
282
+ if (minorTicks && i<numberTicks-1) {
283
+ tt1 = Math.pow(this.base, i - numberTicks + 2) * this.max;
284
+ spread = tt1 - tt;
285
+ interval = tt1 / (minorTicks+1);
286
+ for (var j=minorTicks-1; j>=0; j--) {
287
+ val = tt1-interval*(j+1);
288
+ t = new this.tickRenderer(this.tickOptions);
289
+
290
+ if (this._overrideFormatString && this._autoFormatString != '') {
291
+ t.formatString = this._autoFormatString;
292
+ }
293
+ if (!this.showTicks) {
294
+ t.showLabel = false;
295
+ t.showMark = false;
296
+ }
297
+ else if (!this.showTickMarks) {
298
+ t.showMark = false;
299
+ }
300
+ t.setTick(val, this.name);
301
+ this._ticks.push(t);
302
+ }
303
+ }
304
+ }
305
+ }
306
+
307
+ // min and max are set as would be the case with zooming
308
+ else if (this.min != null && this.max != null) {
309
+ var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
310
+ var nt, ti;
311
+ // don't have an interval yet, pick one that gives the most
312
+ // "round" ticks we can get.
313
+ if (this.numberTicks == null && this.tickInterval == null) {
314
+ // var threshold = 30;
315
+ var tdim = Math.max(dim, threshold+1);
316
+ var nttarget = Math.ceil((tdim-threshold)/35 + 1);
317
+
318
+ var ret = $.jqplot.LinearTickGenerator.bestConstrainedInterval(this.min, this.max, nttarget);
319
+
320
+ this._autoFormatString = ret[3];
321
+ nt = ret[2];
322
+ ti = ret[4];
323
+
324
+ for (var i=0; i<nt; i++) {
325
+ opts.value = this.min + i * ti;
326
+ t = new this.tickRenderer(opts);
327
+
328
+ if (this._overrideFormatString && this._autoFormatString != '') {
329
+ t.formatString = this._autoFormatString;
330
+ }
331
+ if (!this.showTicks) {
332
+ t.showLabel = false;
333
+ t.showMark = false;
334
+ }
335
+ else if (!this.showTickMarks) {
336
+ t.showMark = false;
337
+ }
338
+ this._ticks.push(t);
339
+ }
340
+ }
341
+
342
+ // for loose zoom, number ticks and interval are also set.
343
+ else if (this.numberTicks != null && this.tickInterval != null) {
344
+ nt = this.numberTicks;
345
+ for (var i=0; i<nt; i++) {
346
+ opts.value = this.min + i * this.tickInterval;
347
+ t = new this.tickRenderer(opts);
348
+
349
+ if (this._overrideFormatString && this._autoFormatString != '') {
350
+ t.formatString = this._autoFormatString;
351
+ }
352
+ if (!this.showTicks) {
353
+ t.showLabel = false;
354
+ t.showMark = false;
355
+ }
356
+ else if (!this.showTickMarks) {
357
+ t.showMark = false;
358
+ }
359
+ this._ticks.push(t);
360
+ }
361
+ }
362
+ }
363
+ };
364
+
365
+ $.jqplot.LogAxisRenderer.prototype.pack = function(pos, offsets) {
366
+ var lb = parseInt(this.base, 10);
367
+ var ticks = this._ticks;
368
+ var trans = function (v) { return Math.log(v)/Math.log(lb); };
369
+ var invtrans = function (v) { return Math.pow(Math.E, (Math.log(lb)*v)); };
370
+ var max = trans(this.max);
371
+ var min = trans(this.min);
372
+ var offmax = offsets.max;
373
+ var offmin = offsets.min;
374
+ var lshow = (this._label == null) ? false : this._label.show;
375
+
376
+ for (var p in pos) {
377
+ this._elem.css(p, pos[p]);
378
+ }
379
+
380
+ this._offsets = offsets;
381
+ // pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
382
+ var pixellength = offmax - offmin;
383
+ var unitlength = max - min;
384
+
385
+ // point to unit and unit to point conversions references to Plot DOM element top left corner.
386
+ this.p2u = function(p){
387
+ return invtrans((p - offmin) * unitlength / pixellength + min);
388
+ };
389
+
390
+ this.u2p = function(u){
391
+ return (trans(u) - min) * pixellength / unitlength + offmin;
392
+ };
393
+
394
+ if (this.name == 'xaxis' || this.name == 'x2axis'){
395
+ this.series_u2p = function(u){
396
+ return (trans(u) - min) * pixellength / unitlength;
397
+ };
398
+ this.series_p2u = function(p){
399
+ return invtrans(p * unitlength / pixellength + min);
400
+ };
401
+ }
402
+ // yaxis is max at top of canvas.
403
+ else {
404
+ this.series_u2p = function(u){
405
+ return (trans(u) - max) * pixellength / unitlength;
406
+ };
407
+ this.series_p2u = function(p){
408
+ return invtrans(p * unitlength / pixellength + max);
409
+ };
410
+ }
411
+
412
+ if (this.show) {
413
+ if (this.name == 'xaxis' || this.name == 'x2axis') {
414
+ for (var i=0; i<ticks.length; i++) {
415
+ var t = ticks[i];
416
+ if (t.show && t.showLabel) {
417
+ var shim;
418
+
419
+ if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
420
+ switch (t.labelPosition) {
421
+ case 'auto':
422
+ // position at end
423
+ if (t.angle < 0) {
424
+ shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
425
+ }
426
+ // position at start
427
+ else {
428
+ shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
429
+ }
430
+ break;
431
+ case 'end':
432
+ shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
433
+ break;
434
+ case 'start':
435
+ shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
436
+ break;
437
+ case 'middle':
438
+ shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
439
+ break;
440
+ default:
441
+ shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
442
+ break;
443
+ }
444
+ }
445
+ else {
446
+ shim = -t.getWidth()/2;
447
+ }
448
+ // var shim = t.getWidth()/2;
449
+ var val = this.u2p(t.value) + shim + 'px';
450
+ t._elem.css('left', val);
451
+ t.pack();
452
+ }
453
+ }
454
+ if (lshow) {
455
+ var w = this._label._elem.outerWidth(true);
456
+ this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
457
+ if (this.name == 'xaxis') {
458
+ this._label._elem.css('bottom', '0px');
459
+ }
460
+ else {
461
+ this._label._elem.css('top', '0px');
462
+ }
463
+ this._label.pack();
464
+ }
465
+ }
466
+ else {
467
+ for (var i=0; i<ticks.length; i++) {
468
+ var t = ticks[i];
469
+ if (t.show && t.showLabel) {
470
+ var shim;
471
+ if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
472
+ switch (t.labelPosition) {
473
+ case 'auto':
474
+ // position at end
475
+ case 'end':
476
+ if (t.angle < 0) {
477
+ shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
478
+ }
479
+ else {
480
+ shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
481
+ }
482
+ break;
483
+ case 'start':
484
+ if (t.angle > 0) {
485
+ shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
486
+ }
487
+ else {
488
+ shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
489
+ }
490
+ break;
491
+ case 'middle':
492
+ // if (t.angle > 0) {
493
+ // shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
494
+ // }
495
+ // else {
496
+ // shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
497
+ // }
498
+ shim = -t.getHeight()/2;
499
+ break;
500
+ default:
501
+ shim = -t.getHeight()/2;
502
+ break;
503
+ }
504
+ }
505
+ else {
506
+ shim = -t.getHeight()/2;
507
+ }
508
+
509
+ var val = this.u2p(t.value) + shim + 'px';
510
+ t._elem.css('top', val);
511
+ t.pack();
512
+ }
513
+ }
514
+ if (lshow) {
515
+ var h = this._label._elem.outerHeight(true);
516
+ this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
517
+ if (this.name == 'yaxis') {
518
+ this._label._elem.css('left', '0px');
519
+ }
520
+ else {
521
+ this._label._elem.css('right', '0px');
522
+ }
523
+ this._label.pack();
524
+ }
525
+ }
526
+ }
527
+ };
528
+ })(jQuery);