jquery_cheats 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/app/assets/javascripts/{jqueryCheats.js → jquery_cheats/jquery_cheats.js} +0 -0
  2. data/jquery_cheats.gemspec +1 -1
  3. data/lib/jquery_cheats/engine.rb +6 -0
  4. data/lib/{railtie.rb → jquery_cheats/railtie.rb} +0 -0
  5. data/lib/jquery_cheats.rb +2 -2
  6. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/excanvas.js +1438 -1438
  7. data/vendor/assets/javascripts/jquery_cheats/jqplot/index.js +1 -0
  8. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/jquery.jqplot.js +10901 -10901
  9. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.js +311 -311
  10. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.BezierCurveRenderer.min.js +56 -56
  11. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.js +746 -746
  12. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.barRenderer.min.js +56 -56
  13. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.js +233 -233
  14. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.blockRenderer.min.js +56 -56
  15. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.js +753 -753
  16. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.bubbleRenderer.min.js +56 -56
  17. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.js +201 -201
  18. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisLabelRenderer.min.js +56 -56
  19. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.js +241 -241
  20. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasAxisTickRenderer.min.js +56 -56
  21. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.js +863 -863
  22. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasOverlay.min.js +56 -56
  23. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.js +447 -447
  24. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.canvasTextRenderer.min.js +56 -56
  25. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.js +635 -635
  26. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.categoryAxisRenderer.min.js +56 -56
  27. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.js +114 -114
  28. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ciParser.min.js +56 -56
  29. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.js +1092 -1092
  30. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.cursor.min.js +56 -56
  31. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.js +702 -702
  32. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dateAxisRenderer.min.js +56 -56
  33. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.js +799 -799
  34. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.donutRenderer.min.js +56 -56
  35. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.js +223 -223
  36. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.dragable.min.js +56 -56
  37. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.js +240 -240
  38. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.enhancedLegendRenderer.min.js +56 -56
  39. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.js +937 -937
  40. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.funnelRenderer.min.js +56 -56
  41. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.js +453 -453
  42. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.highlighter.min.js +56 -56
  43. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.js +475 -475
  44. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.json2.min.js +56 -56
  45. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.js +527 -527
  46. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.logAxisRenderer.min.js +56 -56
  47. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.js +610 -610
  48. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoAxisRenderer.min.js +56 -56
  49. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.js +435 -435
  50. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.mekkoRenderer.min.js +56 -56
  51. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.js +1028 -1028
  52. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.meterGaugeRenderer.min.js +56 -56
  53. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.js +371 -371
  54. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.ohlcRenderer.min.js +56 -56
  55. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.js +898 -898
  56. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pieRenderer.min.js +56 -56
  57. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.js +361 -361
  58. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pointLabels.min.js +56 -56
  59. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.js +729 -729
  60. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidAxisRenderer.min.js +56 -56
  61. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.js +422 -422
  62. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidGridRenderer.min.js +56 -56
  63. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.js +489 -489
  64. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.pyramidRenderer.min.js +56 -56
  65. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.js +221 -221
  66. data/vendor/assets/javascripts/{jqplot → jquery_cheats/jqplot}/plugins/jqplot.trendline.min.js +56 -56
  67. data/vendor/assets/stylesheets/{jquery.jqplot.css → jquery_cheats/jquery.jqplot.css} +259 -259
  68. metadata +68 -67
  69. data/lib/engine.rb +0 -7
@@ -1,57 +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
- */
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
57
  (function(a){a.jqplot.CanvasAxisLabelRenderer=function(b){this.angle=0;this.axis;this.show=true;this.showLabel=true;this.label="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="11pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);if(b.angle==null&&this.axis!="xaxis"&&this.axis!="x2axis"){this.angle=-90}var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisLabelRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisLabelRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisLabelRenderer.prototype.draw=function(c,f){if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css({position:"absolute"});this._elem.addClass("jqplot-"+this.axis+"-label");e=null;return this._elem};a.jqplot.CanvasAxisLabelRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery);
@@ -1,242 +1,242 @@
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.CanvasAxisTickRenderer
33
- * Renderer to draw axis ticks with a canvas element to support advanced
34
- * featrues such as rotated text. This renderer uses a separate rendering engine
35
- * to draw the text on the canvas. Two modes of rendering the text are available.
36
- * If the browser has native font support for canvas fonts (currently Mozila 3.5
37
- * and Safari 4), you can enable text rendering with the canvas fillText method.
38
- * You do so by setting the "enableFontSupport" option to true.
39
- *
40
- * Browsers lacking native font support will have the text drawn on the canvas
41
- * using the Hershey font metrics. Even if the "enableFontSupport" option is true
42
- * non-supporting browsers will still render with the Hershey font.
43
- */
44
- $.jqplot.CanvasAxisTickRenderer = function(options) {
45
- // Group: Properties
46
-
47
- // prop: mark
48
- // tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
49
- this.mark = 'outside';
50
- // prop: showMark
51
- // wether or not to show the mark on the axis.
52
- this.showMark = true;
53
- // prop: showGridline
54
- // wether or not to draw the gridline on the grid at this tick.
55
- this.showGridline = true;
56
- // prop: isMinorTick
57
- // if this is a minor tick.
58
- this.isMinorTick = false;
59
- // prop: angle
60
- // angle of text, measured clockwise from x axis.
61
- this.angle = 0;
62
- // prop: markSize
63
- // Length of the tick marks in pixels. For 'cross' style, length
64
- // will be stoked above and below axis, so total length will be twice this.
65
- this.markSize = 4;
66
- // prop: show
67
- // wether or not to show the tick (mark and label).
68
- this.show = true;
69
- // prop: showLabel
70
- // wether or not to show the label.
71
- this.showLabel = true;
72
- // prop: labelPosition
73
- // 'auto', 'start', 'middle' or 'end'.
74
- // Whether tick label should be positioned so the start, middle, or end
75
- // of the tick mark.
76
- this.labelPosition = 'auto';
77
- this.label = '';
78
- this.value = null;
79
- this._styles = {};
80
- // prop: formatter
81
- // A class of a formatter for the tick text.
82
- // The default $.jqplot.DefaultTickFormatter uses sprintf.
83
- this.formatter = $.jqplot.DefaultTickFormatter;
84
- // prop: formatString
85
- // string passed to the formatter.
86
- this.formatString = '';
87
- // prop: prefix
88
- // String to prepend to the tick label.
89
- // Prefix is prepended to the formatted tick label.
90
- this.prefix = '';
91
- // prop: fontFamily
92
- // css spec for the font-family css attribute.
93
- this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
94
- // prop: fontSize
95
- // CSS spec for font size.
96
- this.fontSize = '10pt';
97
- // prop: fontWeight
98
- // CSS spec for fontWeight
99
- this.fontWeight = 'normal';
100
- // prop: fontStretch
101
- // Multiplier to condense or expand font width.
102
- // Applies only to browsers which don't support canvas native font rendering.
103
- this.fontStretch = 1.0;
104
- // prop: textColor
105
- // css spec for the color attribute.
106
- this.textColor = '#666666';
107
- // prop: enableFontSupport
108
- // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
109
- // If true, tick label will be drawn with canvas tag native support for fonts.
110
- // If false, tick label will be drawn with Hershey font metrics.
111
- this.enableFontSupport = true;
112
- // prop: pt2px
113
- // Point to pixel scaling factor, used for computing height of bounding box
114
- // around a label. The labels text renderer has a default setting of 1.4, which
115
- // should be suitable for most fonts. Leave as null to use default. If tops of
116
- // letters appear clipped, increase this. If bounding box seems too big, decrease.
117
- // This is an issue only with the native font renderering capabilities of Mozilla
118
- // 3.5 and Safari 4 since they do not provide a method to determine the font height.
119
- this.pt2px = null;
120
-
121
- this._elem;
122
- this._ctx;
123
- this._plotWidth;
124
- this._plotHeight;
125
- this._plotDimensions = {height:null, width:null};
126
-
127
- $.extend(true, this, options);
128
-
129
- var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
130
- if (this.pt2px) {
131
- ropts.pt2px = this.pt2px;
132
- }
133
-
134
- if (this.enableFontSupport) {
135
- if ($.jqplot.support_canvas_text()) {
136
- this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
137
- }
138
-
139
- else {
140
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
141
- }
142
- }
143
- else {
144
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
145
- }
146
- };
147
-
148
- $.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
149
- $.extend(true, this, options);
150
- this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
151
- };
152
-
153
- // return width along the x axis
154
- // will check first to see if an element exists.
155
- // if not, will return the computed text box width.
156
- $.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
157
- if (this._elem) {
158
- return this._elem.outerWidth(true);
159
- }
160
- else {
161
- var tr = this._textRenderer;
162
- var l = tr.getWidth(ctx);
163
- var h = tr.getHeight(ctx);
164
- var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
165
- return w;
166
- }
167
- };
168
-
169
- // return height along the y axis.
170
- $.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
171
- if (this._elem) {
172
- return this._elem.outerHeight(true);
173
- }
174
- else {
175
- var tr = this._textRenderer;
176
- var l = tr.getWidth(ctx);
177
- var h = tr.getHeight(ctx);
178
- var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
179
- return w;
180
- }
181
- };
182
-
183
- $.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
184
- var a = this.angle * Math.PI/180;
185
- return a;
186
- };
187
-
188
-
189
- $.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
190
- this.value = value;
191
- if (isMinor) {
192
- this.isMinorTick = true;
193
- }
194
- return this;
195
- };
196
-
197
- $.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
198
- if (!this.label) {
199
- this.label = this.prefix + this.formatter(this.formatString, this.value);
200
- }
201
-
202
- // Memory Leaks patch
203
- if (this._elem) {
204
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
205
- window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
206
- }
207
-
208
- this._elem.emptyForce();
209
- this._elem = null;
210
- }
211
-
212
- // create a canvas here, but can't draw on it untill it is appended
213
- // to dom for IE compatability.
214
-
215
- var elem = plot.canvasManager.getCanvas();
216
-
217
- this._textRenderer.setText(this.label, ctx);
218
- var w = this.getWidth(ctx);
219
- var h = this.getHeight(ctx);
220
- // canvases seem to need to have width and heigh attributes directly set.
221
- elem.width = w;
222
- elem.height = h;
223
- elem.style.width = w;
224
- elem.style.height = h;
225
- elem.style.textAlign = 'left';
226
- elem.style.position = 'absolute';
227
-
228
- elem = plot.canvasManager.initCanvas(elem);
229
-
230
- this._elem = $(elem);
231
- this._elem.css(this._styles);
232
- this._elem.addClass('jqplot-'+this.axis+'-tick');
233
-
234
- elem = null;
235
- return this._elem;
236
- };
237
-
238
- $.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
239
- this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
240
- };
241
-
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.CanvasAxisTickRenderer
33
+ * Renderer to draw axis ticks with a canvas element to support advanced
34
+ * featrues such as rotated text. This renderer uses a separate rendering engine
35
+ * to draw the text on the canvas. Two modes of rendering the text are available.
36
+ * If the browser has native font support for canvas fonts (currently Mozila 3.5
37
+ * and Safari 4), you can enable text rendering with the canvas fillText method.
38
+ * You do so by setting the "enableFontSupport" option to true.
39
+ *
40
+ * Browsers lacking native font support will have the text drawn on the canvas
41
+ * using the Hershey font metrics. Even if the "enableFontSupport" option is true
42
+ * non-supporting browsers will still render with the Hershey font.
43
+ */
44
+ $.jqplot.CanvasAxisTickRenderer = function(options) {
45
+ // Group: Properties
46
+
47
+ // prop: mark
48
+ // tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
49
+ this.mark = 'outside';
50
+ // prop: showMark
51
+ // wether or not to show the mark on the axis.
52
+ this.showMark = true;
53
+ // prop: showGridline
54
+ // wether or not to draw the gridline on the grid at this tick.
55
+ this.showGridline = true;
56
+ // prop: isMinorTick
57
+ // if this is a minor tick.
58
+ this.isMinorTick = false;
59
+ // prop: angle
60
+ // angle of text, measured clockwise from x axis.
61
+ this.angle = 0;
62
+ // prop: markSize
63
+ // Length of the tick marks in pixels. For 'cross' style, length
64
+ // will be stoked above and below axis, so total length will be twice this.
65
+ this.markSize = 4;
66
+ // prop: show
67
+ // wether or not to show the tick (mark and label).
68
+ this.show = true;
69
+ // prop: showLabel
70
+ // wether or not to show the label.
71
+ this.showLabel = true;
72
+ // prop: labelPosition
73
+ // 'auto', 'start', 'middle' or 'end'.
74
+ // Whether tick label should be positioned so the start, middle, or end
75
+ // of the tick mark.
76
+ this.labelPosition = 'auto';
77
+ this.label = '';
78
+ this.value = null;
79
+ this._styles = {};
80
+ // prop: formatter
81
+ // A class of a formatter for the tick text.
82
+ // The default $.jqplot.DefaultTickFormatter uses sprintf.
83
+ this.formatter = $.jqplot.DefaultTickFormatter;
84
+ // prop: formatString
85
+ // string passed to the formatter.
86
+ this.formatString = '';
87
+ // prop: prefix
88
+ // String to prepend to the tick label.
89
+ // Prefix is prepended to the formatted tick label.
90
+ this.prefix = '';
91
+ // prop: fontFamily
92
+ // css spec for the font-family css attribute.
93
+ this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
94
+ // prop: fontSize
95
+ // CSS spec for font size.
96
+ this.fontSize = '10pt';
97
+ // prop: fontWeight
98
+ // CSS spec for fontWeight
99
+ this.fontWeight = 'normal';
100
+ // prop: fontStretch
101
+ // Multiplier to condense or expand font width.
102
+ // Applies only to browsers which don't support canvas native font rendering.
103
+ this.fontStretch = 1.0;
104
+ // prop: textColor
105
+ // css spec for the color attribute.
106
+ this.textColor = '#666666';
107
+ // prop: enableFontSupport
108
+ // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
109
+ // If true, tick label will be drawn with canvas tag native support for fonts.
110
+ // If false, tick label will be drawn with Hershey font metrics.
111
+ this.enableFontSupport = true;
112
+ // prop: pt2px
113
+ // Point to pixel scaling factor, used for computing height of bounding box
114
+ // around a label. The labels text renderer has a default setting of 1.4, which
115
+ // should be suitable for most fonts. Leave as null to use default. If tops of
116
+ // letters appear clipped, increase this. If bounding box seems too big, decrease.
117
+ // This is an issue only with the native font renderering capabilities of Mozilla
118
+ // 3.5 and Safari 4 since they do not provide a method to determine the font height.
119
+ this.pt2px = null;
120
+
121
+ this._elem;
122
+ this._ctx;
123
+ this._plotWidth;
124
+ this._plotHeight;
125
+ this._plotDimensions = {height:null, width:null};
126
+
127
+ $.extend(true, this, options);
128
+
129
+ var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
130
+ if (this.pt2px) {
131
+ ropts.pt2px = this.pt2px;
132
+ }
133
+
134
+ if (this.enableFontSupport) {
135
+ if ($.jqplot.support_canvas_text()) {
136
+ this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
137
+ }
138
+
139
+ else {
140
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
141
+ }
142
+ }
143
+ else {
144
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
145
+ }
146
+ };
147
+
148
+ $.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
149
+ $.extend(true, this, options);
150
+ this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
151
+ };
152
+
153
+ // return width along the x axis
154
+ // will check first to see if an element exists.
155
+ // if not, will return the computed text box width.
156
+ $.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
157
+ if (this._elem) {
158
+ return this._elem.outerWidth(true);
159
+ }
160
+ else {
161
+ var tr = this._textRenderer;
162
+ var l = tr.getWidth(ctx);
163
+ var h = tr.getHeight(ctx);
164
+ var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
165
+ return w;
166
+ }
167
+ };
168
+
169
+ // return height along the y axis.
170
+ $.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
171
+ if (this._elem) {
172
+ return this._elem.outerHeight(true);
173
+ }
174
+ else {
175
+ var tr = this._textRenderer;
176
+ var l = tr.getWidth(ctx);
177
+ var h = tr.getHeight(ctx);
178
+ var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
179
+ return w;
180
+ }
181
+ };
182
+
183
+ $.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
184
+ var a = this.angle * Math.PI/180;
185
+ return a;
186
+ };
187
+
188
+
189
+ $.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
190
+ this.value = value;
191
+ if (isMinor) {
192
+ this.isMinorTick = true;
193
+ }
194
+ return this;
195
+ };
196
+
197
+ $.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
198
+ if (!this.label) {
199
+ this.label = this.prefix + this.formatter(this.formatString, this.value);
200
+ }
201
+
202
+ // Memory Leaks patch
203
+ if (this._elem) {
204
+ if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
205
+ window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
206
+ }
207
+
208
+ this._elem.emptyForce();
209
+ this._elem = null;
210
+ }
211
+
212
+ // create a canvas here, but can't draw on it untill it is appended
213
+ // to dom for IE compatability.
214
+
215
+ var elem = plot.canvasManager.getCanvas();
216
+
217
+ this._textRenderer.setText(this.label, ctx);
218
+ var w = this.getWidth(ctx);
219
+ var h = this.getHeight(ctx);
220
+ // canvases seem to need to have width and heigh attributes directly set.
221
+ elem.width = w;
222
+ elem.height = h;
223
+ elem.style.width = w;
224
+ elem.style.height = h;
225
+ elem.style.textAlign = 'left';
226
+ elem.style.position = 'absolute';
227
+
228
+ elem = plot.canvasManager.initCanvas(elem);
229
+
230
+ this._elem = $(elem);
231
+ this._elem.css(this._styles);
232
+ this._elem.addClass('jqplot-'+this.axis+'-tick');
233
+
234
+ elem = null;
235
+ return this._elem;
236
+ };
237
+
238
+ $.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
239
+ this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
240
+ };
241
+
242
242
  })(jQuery);