outfielding-jqplot-rails 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/CHANGELOG.md +8 -4
  4. data/changes-jqplot.txt +48 -37
  5. data/copyright-jqplot.txt +17 -17
  6. data/lib/outfielding-jqplot-rails/version.rb +1 -1
  7. data/vendor/assets/javascripts/excanvas.js +1438 -1438
  8. data/vendor/assets/javascripts/jqplot-plugins/jqplot.BezierCurveRenderer.js +313 -313
  9. data/vendor/assets/javascripts/jqplot-plugins/jqplot.barRenderer.js +801 -801
  10. data/vendor/assets/javascripts/jqplot-plugins/jqplot.blockRenderer.js +234 -234
  11. data/vendor/assets/javascripts/jqplot-plugins/jqplot.bubbleRenderer.js +758 -758
  12. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasAxisLabelRenderer.js +202 -202
  13. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasAxisTickRenderer.js +252 -252
  14. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasOverlay.js +1020 -1020
  15. data/vendor/assets/javascripts/jqplot-plugins/jqplot.canvasTextRenderer.js +448 -448
  16. data/vendor/assets/javascripts/jqplot-plugins/jqplot.categoryAxisRenderer.js +679 -679
  17. data/vendor/assets/javascripts/jqplot-plugins/jqplot.ciParser.js +115 -115
  18. data/vendor/assets/javascripts/jqplot-plugins/jqplot.cursor.js +1108 -1108
  19. data/vendor/assets/javascripts/jqplot-plugins/jqplot.dateAxisRenderer.js +741 -741
  20. data/vendor/assets/javascripts/jqplot-plugins/jqplot.donutRenderer.js +816 -805
  21. data/vendor/assets/javascripts/jqplot-plugins/jqplot.dragable.js +224 -224
  22. data/vendor/assets/javascripts/jqplot-plugins/jqplot.enhancedLegendRenderer.js +305 -305
  23. data/vendor/assets/javascripts/jqplot-plugins/jqplot.enhancedPieLegendRenderer.js +261 -0
  24. data/vendor/assets/javascripts/jqplot-plugins/jqplot.funnelRenderer.js +942 -942
  25. data/vendor/assets/javascripts/jqplot-plugins/jqplot.highlighter.js +464 -464
  26. data/vendor/assets/javascripts/jqplot-plugins/jqplot.json2.js +475 -475
  27. data/vendor/assets/javascripts/jqplot-plugins/jqplot.logAxisRenderer.js +533 -533
  28. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mekkoAxisRenderer.js +611 -611
  29. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mekkoRenderer.js +437 -437
  30. data/vendor/assets/javascripts/jqplot-plugins/jqplot.meterGaugeRenderer.js +1029 -1029
  31. data/vendor/assets/javascripts/jqplot-plugins/jqplot.mobile.js +2 -2
  32. data/vendor/assets/javascripts/jqplot-plugins/jqplot.ohlcRenderer.js +373 -373
  33. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pieRenderer.js +945 -903
  34. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pointLabels.js +379 -377
  35. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidAxisRenderer.js +728 -728
  36. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidGridRenderer.js +428 -428
  37. data/vendor/assets/javascripts/jqplot-plugins/jqplot.pyramidRenderer.js +513 -513
  38. data/vendor/assets/javascripts/jqplot-plugins/jqplot.trendline.js +222 -222
  39. data/vendor/assets/javascripts/jquery.jqplot.js +11477 -11411
  40. data/vendor/assets/stylesheets/jquery.jqplot.css +259 -259
  41. metadata +9 -10
@@ -1,203 +1,203 @@
1
- /**
2
- * jqPlot
3
- * Pure JavaScript plotting plugin using jQuery
4
- *
5
- * Version: 1.0.8
6
- * Revision: 1250
7
- *
8
- * Copyright (c) 2009-2013 Chris Leonello
9
- * jqPlot is currently available for use in all personal or commercial projects
10
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
- * choose the license that best suits your project and use it accordingly.
13
- *
14
- * Although not required, the author would appreciate an email letting him
15
- * know of any substantial use of jqPlot. You can reach the author at:
16
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
- *
18
- * If you are feeling kind and generous, consider supporting the project by
19
- * making a donation at: http://www.jqplot.com/donate.php .
20
- *
21
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
- *
23
- * version 2007.04.27
24
- * author Ash Searle
25
- * http://hexmen.com/blog/2007/03/printf-sprintf/
26
- * http://hexmen.com/js/sprintf.js
27
- * The author (Ash Searle) has placed this code in the public domain:
28
- * "This code is unrestricted: you are free to use it however you like."
29
- *
30
- */
31
- (function($) {
32
- /**
33
- * Class: $.jqplot.CanvasAxisLabelRenderer
34
- * Renderer to draw axis labels with a canvas element to support advanced
35
- * featrues such as rotated text. This renderer uses a separate rendering engine
36
- * to draw the text on the canvas. Two modes of rendering the text are available.
37
- * If the browser has native font support for canvas fonts (currently Mozila 3.5
38
- * and Safari 4), you can enable text rendering with the canvas fillText method.
39
- * You do so by setting the "enableFontSupport" option to true.
40
- *
41
- * Browsers lacking native font support will have the text drawn on the canvas
42
- * using the Hershey font metrics. Even if the "enableFontSupport" option is true
43
- * non-supporting browsers will still render with the Hershey font.
44
- *
45
- */
46
- $.jqplot.CanvasAxisLabelRenderer = function(options) {
47
- // Group: Properties
48
-
49
- // prop: angle
50
- // angle of text, measured clockwise from x axis.
51
- this.angle = 0;
52
- // name of the axis associated with this tick
53
- this.axis;
54
- // prop: show
55
- // whether or not to show the tick (mark and label).
56
- this.show = true;
57
- // prop: showLabel
58
- // whether or not to show the label.
59
- this.showLabel = true;
60
- // prop: label
61
- // label for the axis.
62
- this.label = '';
63
- // prop: fontFamily
64
- // CSS spec for the font-family css attribute.
65
- // Applies only to browsers supporting native font rendering in the
66
- // canvas tag. Currently Mozilla 3.5 and Safari 4.
67
- this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
68
- // prop: fontSize
69
- // CSS spec for font size.
70
- this.fontSize = '11pt';
71
- // prop: fontWeight
72
- // CSS spec for fontWeight: normal, bold, bolder, lighter or a number 100 - 900
73
- this.fontWeight = 'normal';
74
- // prop: fontStretch
75
- // Multiplier to condense or expand font width.
76
- // Applies only to browsers which don't support canvas native font rendering.
77
- this.fontStretch = 1.0;
78
- // prop: textColor
79
- // css spec for the color attribute.
80
- this.textColor = '#666666';
81
- // prop: enableFontSupport
82
- // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
83
- // If true, label will be drawn with canvas tag native support for fonts.
84
- // If false, label will be drawn with Hershey font metrics.
85
- this.enableFontSupport = true;
86
- // prop: pt2px
87
- // Point to pixel scaling factor, used for computing height of bounding box
88
- // around a label. The labels text renderer has a default setting of 1.4, which
89
- // should be suitable for most fonts. Leave as null to use default. If tops of
90
- // letters appear clipped, increase this. If bounding box seems too big, decrease.
91
- // This is an issue only with the native font renderering capabilities of Mozilla
92
- // 3.5 and Safari 4 since they do not provide a method to determine the font height.
93
- this.pt2px = null;
94
-
95
- this._elem;
96
- this._ctx;
97
- this._plotWidth;
98
- this._plotHeight;
99
- this._plotDimensions = {height:null, width:null};
100
-
101
- $.extend(true, this, options);
102
-
103
- if (options.angle == null && this.axis != 'xaxis' && this.axis != 'x2axis') {
104
- this.angle = -90;
105
- }
106
-
107
- var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
108
- if (this.pt2px) {
109
- ropts.pt2px = this.pt2px;
110
- }
111
-
112
- if (this.enableFontSupport) {
113
- if ($.jqplot.support_canvas_text()) {
114
- this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
115
- }
116
-
117
- else {
118
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
119
- }
120
- }
121
- else {
122
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
123
- }
124
- };
125
-
126
- $.jqplot.CanvasAxisLabelRenderer.prototype.init = function(options) {
127
- $.extend(true, this, options);
128
- this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
129
- };
130
-
131
- // return width along the x axis
132
- // will check first to see if an element exists.
133
- // if not, will return the computed text box width.
134
- $.jqplot.CanvasAxisLabelRenderer.prototype.getWidth = function(ctx) {
135
- if (this._elem) {
136
- return this._elem.outerWidth(true);
137
- }
138
- else {
139
- var tr = this._textRenderer;
140
- var l = tr.getWidth(ctx);
141
- var h = tr.getHeight(ctx);
142
- var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
143
- return w;
144
- }
145
- };
146
-
147
- // return height along the y axis.
148
- $.jqplot.CanvasAxisLabelRenderer.prototype.getHeight = function(ctx) {
149
- if (this._elem) {
150
- return this._elem.outerHeight(true);
151
- }
152
- else {
153
- var tr = this._textRenderer;
154
- var l = tr.getWidth(ctx);
155
- var h = tr.getHeight(ctx);
156
- var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
157
- return w;
158
- }
159
- };
160
-
161
- $.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad = function() {
162
- var a = this.angle * Math.PI/180;
163
- return a;
164
- };
165
-
166
- $.jqplot.CanvasAxisLabelRenderer.prototype.draw = function(ctx, plot) {
167
- // Memory Leaks patch
168
- if (this._elem) {
169
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
170
- window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
171
- }
172
-
173
- this._elem.emptyForce();
174
- this._elem = null;
175
- }
176
-
177
- // create a canvas here, but can't draw on it untill it is appended
178
- // to dom for IE compatability.
179
- var elem = plot.canvasManager.getCanvas();
180
-
181
- this._textRenderer.setText(this.label, ctx);
182
- var w = this.getWidth(ctx);
183
- var h = this.getHeight(ctx);
184
- elem.width = w;
185
- elem.height = h;
186
- elem.style.width = w;
187
- elem.style.height = h;
188
-
189
- elem = plot.canvasManager.initCanvas(elem);
190
-
191
- this._elem = $(elem);
192
- this._elem.css({ position: 'absolute'});
193
- this._elem.addClass('jqplot-'+this.axis+'-label');
194
-
195
- elem = null;
196
- return this._elem;
197
- };
198
-
199
- $.jqplot.CanvasAxisLabelRenderer.prototype.pack = function() {
200
- this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
201
- };
202
-
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.9
6
+ * Revision: d96a669
7
+ *
8
+ * Copyright (c) 2009-2016 Chris Leonello
9
+ * jqPlot is currently available for use in all personal or commercial projects
10
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
+ * choose the license that best suits your project and use it accordingly.
13
+ *
14
+ * Although not required, the author would appreciate an email letting him
15
+ * know of any substantial use of jqPlot. You can reach the author at:
16
+ * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
+ *
18
+ * If you are feeling kind and generous, consider supporting the project by
19
+ * making a donation at: http://www.jqplot.com/donate.php .
20
+ *
21
+ * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
+ *
23
+ * version 2007.04.27
24
+ * author Ash Searle
25
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
26
+ * http://hexmen.com/js/sprintf.js
27
+ * The author (Ash Searle) has placed this code in the public domain:
28
+ * "This code is unrestricted: you are free to use it however you like."
29
+ *
30
+ */
31
+ (function($) {
32
+ /**
33
+ * Class: $.jqplot.CanvasAxisLabelRenderer
34
+ * Renderer to draw axis labels with a canvas element to support advanced
35
+ * featrues such as rotated text. This renderer uses a separate rendering engine
36
+ * to draw the text on the canvas. Two modes of rendering the text are available.
37
+ * If the browser has native font support for canvas fonts (currently Mozila 3.5
38
+ * and Safari 4), you can enable text rendering with the canvas fillText method.
39
+ * You do so by setting the "enableFontSupport" option to true.
40
+ *
41
+ * Browsers lacking native font support will have the text drawn on the canvas
42
+ * using the Hershey font metrics. Even if the "enableFontSupport" option is true
43
+ * non-supporting browsers will still render with the Hershey font.
44
+ *
45
+ */
46
+ $.jqplot.CanvasAxisLabelRenderer = function(options) {
47
+ // Group: Properties
48
+
49
+ // prop: angle
50
+ // angle of text, measured clockwise from x axis.
51
+ this.angle = 0;
52
+ // name of the axis associated with this tick
53
+ this.axis;
54
+ // prop: show
55
+ // whether or not to show the tick (mark and label).
56
+ this.show = true;
57
+ // prop: showLabel
58
+ // whether or not to show the label.
59
+ this.showLabel = true;
60
+ // prop: label
61
+ // label for the axis.
62
+ this.label = '';
63
+ // prop: fontFamily
64
+ // CSS spec for the font-family css attribute.
65
+ // Applies only to browsers supporting native font rendering in the
66
+ // canvas tag. Currently Mozilla 3.5 and Safari 4.
67
+ this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
68
+ // prop: fontSize
69
+ // CSS spec for font size.
70
+ this.fontSize = '11pt';
71
+ // prop: fontWeight
72
+ // CSS spec for fontWeight: normal, bold, bolder, lighter or a number 100 - 900
73
+ this.fontWeight = 'normal';
74
+ // prop: fontStretch
75
+ // Multiplier to condense or expand font width.
76
+ // Applies only to browsers which don't support canvas native font rendering.
77
+ this.fontStretch = 1.0;
78
+ // prop: textColor
79
+ // css spec for the color attribute.
80
+ this.textColor = '#666666';
81
+ // prop: enableFontSupport
82
+ // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
83
+ // If true, label will be drawn with canvas tag native support for fonts.
84
+ // If false, label will be drawn with Hershey font metrics.
85
+ this.enableFontSupport = true;
86
+ // prop: pt2px
87
+ // Point to pixel scaling factor, used for computing height of bounding box
88
+ // around a label. The labels text renderer has a default setting of 1.4, which
89
+ // should be suitable for most fonts. Leave as null to use default. If tops of
90
+ // letters appear clipped, increase this. If bounding box seems too big, decrease.
91
+ // This is an issue only with the native font renderering capabilities of Mozilla
92
+ // 3.5 and Safari 4 since they do not provide a method to determine the font height.
93
+ this.pt2px = null;
94
+
95
+ this._elem;
96
+ this._ctx;
97
+ this._plotWidth;
98
+ this._plotHeight;
99
+ this._plotDimensions = {height:null, width:null};
100
+
101
+ $.extend(true, this, options);
102
+
103
+ if (options.angle == null && this.axis != 'xaxis' && this.axis != 'x2axis') {
104
+ this.angle = -90;
105
+ }
106
+
107
+ var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
108
+ if (this.pt2px) {
109
+ ropts.pt2px = this.pt2px;
110
+ }
111
+
112
+ if (this.enableFontSupport) {
113
+ if ($.jqplot.support_canvas_text()) {
114
+ this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
115
+ }
116
+
117
+ else {
118
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
119
+ }
120
+ }
121
+ else {
122
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
123
+ }
124
+ };
125
+
126
+ $.jqplot.CanvasAxisLabelRenderer.prototype.init = function(options) {
127
+ $.extend(true, this, options);
128
+ this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
129
+ };
130
+
131
+ // return width along the x axis
132
+ // will check first to see if an element exists.
133
+ // if not, will return the computed text box width.
134
+ $.jqplot.CanvasAxisLabelRenderer.prototype.getWidth = function(ctx) {
135
+ if (this._elem) {
136
+ return this._elem.outerWidth(true);
137
+ }
138
+ else {
139
+ var tr = this._textRenderer;
140
+ var l = tr.getWidth(ctx);
141
+ var h = tr.getHeight(ctx);
142
+ var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
143
+ return w;
144
+ }
145
+ };
146
+
147
+ // return height along the y axis.
148
+ $.jqplot.CanvasAxisLabelRenderer.prototype.getHeight = function(ctx) {
149
+ if (this._elem) {
150
+ return this._elem.outerHeight(true);
151
+ }
152
+ else {
153
+ var tr = this._textRenderer;
154
+ var l = tr.getWidth(ctx);
155
+ var h = tr.getHeight(ctx);
156
+ var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
157
+ return w;
158
+ }
159
+ };
160
+
161
+ $.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad = function() {
162
+ var a = this.angle * Math.PI/180;
163
+ return a;
164
+ };
165
+
166
+ $.jqplot.CanvasAxisLabelRenderer.prototype.draw = function(ctx, plot) {
167
+ // Memory Leaks patch
168
+ if (this._elem) {
169
+ if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
170
+ window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
171
+ }
172
+
173
+ this._elem.emptyForce();
174
+ this._elem = null;
175
+ }
176
+
177
+ // create a canvas here, but can't draw on it untill it is appended
178
+ // to dom for IE compatability.
179
+ var elem = plot.canvasManager.getCanvas();
180
+
181
+ this._textRenderer.setText(this.label, ctx);
182
+ var w = this.getWidth(ctx);
183
+ var h = this.getHeight(ctx);
184
+ elem.width = w;
185
+ elem.height = h;
186
+ elem.style.width = w;
187
+ elem.style.height = h;
188
+
189
+ elem = plot.canvasManager.initCanvas(elem);
190
+
191
+ this._elem = $(elem);
192
+ this._elem.css({ position: 'absolute'});
193
+ this._elem.addClass('jqplot-'+this.axis+'-label');
194
+
195
+ elem = null;
196
+ return this._elem;
197
+ };
198
+
199
+ $.jqplot.CanvasAxisLabelRenderer.prototype.pack = function() {
200
+ this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
201
+ };
202
+
203
203
  })(jQuery);
@@ -1,253 +1,253 @@
1
- /**
2
- * jqPlot
3
- * Pure JavaScript plotting plugin using jQuery
4
- *
5
- * Version: 1.0.8
6
- * Revision: 1250
7
- *
8
- * Copyright (c) 2009-2013 Chris Leonello
9
- * jqPlot is currently available for use in all personal or commercial projects
10
- * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
- * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
- * choose the license that best suits your project and use it accordingly.
13
- *
14
- * Although not required, the author would appreciate an email letting him
15
- * know of any substantial use of jqPlot. You can reach the author at:
16
- * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
- *
18
- * If you are feeling kind and generous, consider supporting the project by
19
- * making a donation at: http://www.jqplot.com/donate.php .
20
- *
21
- * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
- *
23
- * version 2007.04.27
24
- * author Ash Searle
25
- * http://hexmen.com/blog/2007/03/printf-sprintf/
26
- * http://hexmen.com/js/sprintf.js
27
- * The author (Ash Searle) has placed this code in the public domain:
28
- * "This code is unrestricted: you are free to use it however you like."
29
- *
30
- */
31
- (function($) {
32
- /**
33
- * Class: $.jqplot.CanvasAxisTickRenderer
34
- * Renderer to draw axis ticks with a canvas element to support advanced
35
- * featrues such as rotated text. This renderer uses a separate rendering engine
36
- * to draw the text on the canvas. Two modes of rendering the text are available.
37
- * If the browser has native font support for canvas fonts (currently Mozila 3.5
38
- * and Safari 4), you can enable text rendering with the canvas fillText method.
39
- * You do so by setting the "enableFontSupport" option to true.
40
- *
41
- * Browsers lacking native font support will have the text drawn on the canvas
42
- * using the Hershey font metrics. Even if the "enableFontSupport" option is true
43
- * non-supporting browsers will still render with the Hershey font.
44
- */
45
- $.jqplot.CanvasAxisTickRenderer = function(options) {
46
- // Group: Properties
47
-
48
- // prop: mark
49
- // tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
50
- this.mark = 'outside';
51
- // prop: showMark
52
- // whether or not to show the mark on the axis.
53
- this.showMark = true;
54
- // prop: showGridline
55
- // whether or not to draw the gridline on the grid at this tick.
56
- this.showGridline = true;
57
- // prop: isMinorTick
58
- // if this is a minor tick.
59
- this.isMinorTick = false;
60
- // prop: angle
61
- // angle of text, measured clockwise from x axis.
62
- this.angle = 0;
63
- // prop: markSize
64
- // Length of the tick marks in pixels. For 'cross' style, length
65
- // will be stoked above and below axis, so total length will be twice this.
66
- this.markSize = 4;
67
- // prop: show
68
- // whether or not to show the tick (mark and label).
69
- this.show = true;
70
- // prop: showLabel
71
- // whether or not to show the label.
72
- this.showLabel = true;
73
- // prop: labelPosition
74
- // 'auto', 'start', 'middle' or 'end'.
75
- // Whether tick label should be positioned so the start, middle, or end
76
- // of the tick mark.
77
- this.labelPosition = 'auto';
78
- this.label = '';
79
- this.value = null;
80
- this._styles = {};
81
- // prop: formatter
82
- // A class of a formatter for the tick text.
83
- // The default $.jqplot.DefaultTickFormatter uses sprintf.
84
- this.formatter = $.jqplot.DefaultTickFormatter;
85
- // prop: formatString
86
- // string passed to the formatter.
87
- this.formatString = '';
88
- // prop: prefix
89
- // String to prepend to the tick label.
90
- // Prefix is prepended to the formatted tick label.
91
- this.prefix = '';
92
- // prop: fontFamily
93
- // css spec for the font-family css attribute.
94
- this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
95
- // prop: fontSize
96
- // CSS spec for font size.
97
- this.fontSize = '10pt';
98
- // prop: fontWeight
99
- // CSS spec for fontWeight
100
- this.fontWeight = 'normal';
101
- // prop: fontStretch
102
- // Multiplier to condense or expand font width.
103
- // Applies only to browsers which don't support canvas native font rendering.
104
- this.fontStretch = 1.0;
105
- // prop: textColor
106
- // css spec for the color attribute.
107
- this.textColor = '#666666';
108
- // prop: enableFontSupport
109
- // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
110
- // If true, tick label will be drawn with canvas tag native support for fonts.
111
- // If false, tick label will be drawn with Hershey font metrics.
112
- this.enableFontSupport = true;
113
- // prop: pt2px
114
- // Point to pixel scaling factor, used for computing height of bounding box
115
- // around a label. The labels text renderer has a default setting of 1.4, which
116
- // should be suitable for most fonts. Leave as null to use default. If tops of
117
- // letters appear clipped, increase this. If bounding box seems too big, decrease.
118
- // This is an issue only with the native font renderering capabilities of Mozilla
119
- // 3.5 and Safari 4 since they do not provide a method to determine the font height.
120
- this.pt2px = null;
121
-
122
- this._elem;
123
- this._ctx;
124
- this._plotWidth;
125
- this._plotHeight;
126
- this._plotDimensions = {height:null, width:null};
127
-
128
- $.extend(true, this, options);
129
-
130
- var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
131
- if (this.pt2px) {
132
- ropts.pt2px = this.pt2px;
133
- }
134
-
135
- if (this.enableFontSupport) {
136
- if ($.jqplot.support_canvas_text()) {
137
- this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
138
- }
139
-
140
- else {
141
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
142
- }
143
- }
144
- else {
145
- this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
146
- }
147
- };
148
-
149
- $.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
150
- $.extend(true, this, options);
151
- this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
152
- };
153
-
154
- // return width along the x axis
155
- // will check first to see if an element exists.
156
- // if not, will return the computed text box width.
157
- $.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
158
- if (this._elem) {
159
- return this._elem.outerWidth(true);
160
- }
161
- else {
162
- var tr = this._textRenderer;
163
- var l = tr.getWidth(ctx);
164
- var h = tr.getHeight(ctx);
165
- var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
166
- return w;
167
- }
168
- };
169
-
170
- // return height along the y axis.
171
- $.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
172
- if (this._elem) {
173
- return this._elem.outerHeight(true);
174
- }
175
- else {
176
- var tr = this._textRenderer;
177
- var l = tr.getWidth(ctx);
178
- var h = tr.getHeight(ctx);
179
- var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
180
- return w;
181
- }
182
- };
183
-
184
- // return top.
185
- $.jqplot.CanvasAxisTickRenderer.prototype.getTop = function(ctx) {
186
- if (this._elem) {
187
- return this._elem.position().top;
188
- }
189
- else {
190
- return null;
191
- }
192
- };
193
-
194
- $.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
195
- var a = this.angle * Math.PI/180;
196
- return a;
197
- };
198
-
199
-
200
- $.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
201
- this.value = value;
202
- if (isMinor) {
203
- this.isMinorTick = true;
204
- }
205
- return this;
206
- };
207
-
208
- $.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
209
- if (!this.label) {
210
- this.label = this.prefix + this.formatter(this.formatString, this.value);
211
- }
212
-
213
- // Memory Leaks patch
214
- if (this._elem) {
215
- if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
216
- window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
217
- }
218
-
219
- this._elem.emptyForce();
220
- this._elem = null;
221
- }
222
-
223
- // create a canvas here, but can't draw on it untill it is appended
224
- // to dom for IE compatability.
225
-
226
- var elem = plot.canvasManager.getCanvas();
227
-
228
- this._textRenderer.setText(this.label, ctx);
229
- var w = this.getWidth(ctx);
230
- var h = this.getHeight(ctx);
231
- // canvases seem to need to have width and heigh attributes directly set.
232
- elem.width = w;
233
- elem.height = h;
234
- elem.style.width = w;
235
- elem.style.height = h;
236
- elem.style.textAlign = 'left';
237
- elem.style.position = 'absolute';
238
-
239
- elem = plot.canvasManager.initCanvas(elem);
240
-
241
- this._elem = $(elem);
242
- this._elem.css(this._styles);
243
- this._elem.addClass('jqplot-'+this.axis+'-tick');
244
-
245
- elem = null;
246
- return this._elem;
247
- };
248
-
249
- $.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
250
- this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
251
- };
252
-
1
+ /**
2
+ * jqPlot
3
+ * Pure JavaScript plotting plugin using jQuery
4
+ *
5
+ * Version: 1.0.9
6
+ * Revision: d96a669
7
+ *
8
+ * Copyright (c) 2009-2016 Chris Leonello
9
+ * jqPlot is currently available for use in all personal or commercial projects
10
+ * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
11
+ * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
12
+ * choose the license that best suits your project and use it accordingly.
13
+ *
14
+ * Although not required, the author would appreciate an email letting him
15
+ * know of any substantial use of jqPlot. You can reach the author at:
16
+ * chris at jqplot dot com or see http://www.jqplot.com/info.php .
17
+ *
18
+ * If you are feeling kind and generous, consider supporting the project by
19
+ * making a donation at: http://www.jqplot.com/donate.php .
20
+ *
21
+ * sprintf functions contained in jqplot.sprintf.js by Ash Searle:
22
+ *
23
+ * version 2007.04.27
24
+ * author Ash Searle
25
+ * http://hexmen.com/blog/2007/03/printf-sprintf/
26
+ * http://hexmen.com/js/sprintf.js
27
+ * The author (Ash Searle) has placed this code in the public domain:
28
+ * "This code is unrestricted: you are free to use it however you like."
29
+ *
30
+ */
31
+ (function($) {
32
+ /**
33
+ * Class: $.jqplot.CanvasAxisTickRenderer
34
+ * Renderer to draw axis ticks with a canvas element to support advanced
35
+ * featrues such as rotated text. This renderer uses a separate rendering engine
36
+ * to draw the text on the canvas. Two modes of rendering the text are available.
37
+ * If the browser has native font support for canvas fonts (currently Mozila 3.5
38
+ * and Safari 4), you can enable text rendering with the canvas fillText method.
39
+ * You do so by setting the "enableFontSupport" option to true.
40
+ *
41
+ * Browsers lacking native font support will have the text drawn on the canvas
42
+ * using the Hershey font metrics. Even if the "enableFontSupport" option is true
43
+ * non-supporting browsers will still render with the Hershey font.
44
+ */
45
+ $.jqplot.CanvasAxisTickRenderer = function(options) {
46
+ // Group: Properties
47
+
48
+ // prop: mark
49
+ // tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
50
+ this.mark = 'outside';
51
+ // prop: showMark
52
+ // whether or not to show the mark on the axis.
53
+ this.showMark = true;
54
+ // prop: showGridline
55
+ // whether or not to draw the gridline on the grid at this tick.
56
+ this.showGridline = true;
57
+ // prop: isMinorTick
58
+ // if this is a minor tick.
59
+ this.isMinorTick = false;
60
+ // prop: angle
61
+ // angle of text, measured clockwise from x axis.
62
+ this.angle = 0;
63
+ // prop: markSize
64
+ // Length of the tick marks in pixels. For 'cross' style, length
65
+ // will be stoked above and below axis, so total length will be twice this.
66
+ this.markSize = 4;
67
+ // prop: show
68
+ // whether or not to show the tick (mark and label).
69
+ this.show = true;
70
+ // prop: showLabel
71
+ // whether or not to show the label.
72
+ this.showLabel = true;
73
+ // prop: labelPosition
74
+ // 'auto', 'start', 'middle' or 'end'.
75
+ // Whether tick label should be positioned so the start, middle, or end
76
+ // of the tick mark.
77
+ this.labelPosition = 'auto';
78
+ this.label = '';
79
+ this.value = null;
80
+ this._styles = {};
81
+ // prop: formatter
82
+ // A class of a formatter for the tick text.
83
+ // The default $.jqplot.DefaultTickFormatter uses sprintf.
84
+ this.formatter = $.jqplot.DefaultTickFormatter;
85
+ // prop: formatString
86
+ // string passed to the formatter.
87
+ this.formatString = '';
88
+ // prop: prefix
89
+ // String to prepend to the tick label.
90
+ // Prefix is prepended to the formatted tick label.
91
+ this.prefix = '';
92
+ // prop: fontFamily
93
+ // css spec for the font-family css attribute.
94
+ this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
95
+ // prop: fontSize
96
+ // CSS spec for font size.
97
+ this.fontSize = '10pt';
98
+ // prop: fontWeight
99
+ // CSS spec for fontWeight
100
+ this.fontWeight = 'normal';
101
+ // prop: fontStretch
102
+ // Multiplier to condense or expand font width.
103
+ // Applies only to browsers which don't support canvas native font rendering.
104
+ this.fontStretch = 1.0;
105
+ // prop: textColor
106
+ // css spec for the color attribute.
107
+ this.textColor = '#666666';
108
+ // prop: enableFontSupport
109
+ // true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
110
+ // If true, tick label will be drawn with canvas tag native support for fonts.
111
+ // If false, tick label will be drawn with Hershey font metrics.
112
+ this.enableFontSupport = true;
113
+ // prop: pt2px
114
+ // Point to pixel scaling factor, used for computing height of bounding box
115
+ // around a label. The labels text renderer has a default setting of 1.4, which
116
+ // should be suitable for most fonts. Leave as null to use default. If tops of
117
+ // letters appear clipped, increase this. If bounding box seems too big, decrease.
118
+ // This is an issue only with the native font renderering capabilities of Mozilla
119
+ // 3.5 and Safari 4 since they do not provide a method to determine the font height.
120
+ this.pt2px = null;
121
+
122
+ this._elem;
123
+ this._ctx;
124
+ this._plotWidth;
125
+ this._plotHeight;
126
+ this._plotDimensions = {height:null, width:null};
127
+
128
+ $.extend(true, this, options);
129
+
130
+ var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
131
+ if (this.pt2px) {
132
+ ropts.pt2px = this.pt2px;
133
+ }
134
+
135
+ if (this.enableFontSupport) {
136
+ if ($.jqplot.support_canvas_text()) {
137
+ this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
138
+ }
139
+
140
+ else {
141
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
142
+ }
143
+ }
144
+ else {
145
+ this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
146
+ }
147
+ };
148
+
149
+ $.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
150
+ $.extend(true, this, options);
151
+ this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
152
+ };
153
+
154
+ // return width along the x axis
155
+ // will check first to see if an element exists.
156
+ // if not, will return the computed text box width.
157
+ $.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
158
+ if (this._elem) {
159
+ return this._elem.outerWidth(true);
160
+ }
161
+ else {
162
+ var tr = this._textRenderer;
163
+ var l = tr.getWidth(ctx);
164
+ var h = tr.getHeight(ctx);
165
+ var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
166
+ return w;
167
+ }
168
+ };
169
+
170
+ // return height along the y axis.
171
+ $.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
172
+ if (this._elem) {
173
+ return this._elem.outerHeight(true);
174
+ }
175
+ else {
176
+ var tr = this._textRenderer;
177
+ var l = tr.getWidth(ctx);
178
+ var h = tr.getHeight(ctx);
179
+ var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
180
+ return w;
181
+ }
182
+ };
183
+
184
+ // return top.
185
+ $.jqplot.CanvasAxisTickRenderer.prototype.getTop = function(ctx) {
186
+ if (this._elem) {
187
+ return this._elem.position().top;
188
+ }
189
+ else {
190
+ return null;
191
+ }
192
+ };
193
+
194
+ $.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
195
+ var a = this.angle * Math.PI/180;
196
+ return a;
197
+ };
198
+
199
+
200
+ $.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
201
+ this.value = value;
202
+ if (isMinor) {
203
+ this.isMinorTick = true;
204
+ }
205
+ return this;
206
+ };
207
+
208
+ $.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
209
+ if (!this.label) {
210
+ this.label = this.prefix + this.formatter(this.formatString, this.value);
211
+ }
212
+
213
+ // Memory Leaks patch
214
+ if (this._elem) {
215
+ if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
216
+ window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
217
+ }
218
+
219
+ this._elem.emptyForce();
220
+ this._elem = null;
221
+ }
222
+
223
+ // create a canvas here, but can't draw on it untill it is appended
224
+ // to dom for IE compatability.
225
+
226
+ var elem = plot.canvasManager.getCanvas();
227
+
228
+ this._textRenderer.setText(this.label, ctx);
229
+ var w = this.getWidth(ctx);
230
+ var h = this.getHeight(ctx);
231
+ // canvases seem to need to have width and heigh attributes directly set.
232
+ elem.width = w;
233
+ elem.height = h;
234
+ elem.style.width = w;
235
+ elem.style.height = h;
236
+ elem.style.textAlign = 'left';
237
+ elem.style.position = 'absolute';
238
+
239
+ elem = plot.canvasManager.initCanvas(elem);
240
+
241
+ this._elem = $(elem);
242
+ this._elem.css(this._styles);
243
+ this._elem.addClass('jqplot-'+this.axis+'-tick');
244
+
245
+ elem = null;
246
+ return this._elem;
247
+ };
248
+
249
+ $.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
250
+ this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
251
+ };
252
+
253
253
  })(jQuery);