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,225 +1,225 @@
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
- /**
34
- * Class: $.jqplot.Dragable
35
- * Plugin to make plotted points dragable by the user.
36
- */
37
- $.jqplot.Dragable = function(options) {
38
- // Group: Properties
39
- this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
40
- this.shapeRenderer = new $.jqplot.ShapeRenderer();
41
- this.isDragging = false;
42
- this.isOver = false;
43
- this._ctx;
44
- this._elem;
45
- this._point;
46
- this._gridData;
47
- // prop: color
48
- // CSS color spec for the dragged point (and adjacent line segment or bar).
49
- this.color;
50
- // prop: constrainTo
51
- // Constrain dragging motion to an axis or to none.
52
- // Allowable values are 'none', 'x', 'y'
53
- this.constrainTo = 'none'; // 'x', 'y', or 'none';
54
- $.extend(true, this, options);
55
- };
56
-
57
- function DragCanvas() {
58
- $.jqplot.GenericCanvas.call(this);
59
- this.isDragging = false;
60
- this.isOver = false;
61
- this._neighbor;
62
- this._cursors = [];
63
- }
64
-
65
- DragCanvas.prototype = new $.jqplot.GenericCanvas();
66
- DragCanvas.prototype.constructor = DragCanvas;
67
-
68
-
69
- // called within scope of series
70
- $.jqplot.Dragable.parseOptions = function (defaults, opts) {
71
- var options = opts || {};
72
- this.plugins.dragable = new $.jqplot.Dragable(options.dragable);
73
- // since this function is called before series options are parsed,
74
- // we can set this here and it will be overridden if needed.
75
- this.isDragable = $.jqplot.config.enablePlugins;
76
- };
77
-
78
- // called within context of plot
79
- // create a canvas which we can draw on.
80
- // insert it before the eventCanvas, so eventCanvas will still capture events.
81
- // add a new DragCanvas object to the plot plugins to handle drawing on this new canvas.
82
- $.jqplot.Dragable.postPlotDraw = function() {
83
- // Memory Leaks patch
84
- if (this.plugins.dragable && this.plugins.dragable.highlightCanvas) {
85
- this.plugins.dragable.highlightCanvas.resetCanvas();
86
- this.plugins.dragable.highlightCanvas = null;
87
- }
88
-
89
- this.plugins.dragable = {previousCursor:'auto', isOver:false};
90
- this.plugins.dragable.dragCanvas = new DragCanvas();
91
-
92
- this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding, 'jqplot-dragable-canvas', this._plotDimensions, this));
93
- var dctx = this.plugins.dragable.dragCanvas.setContext();
94
- };
95
-
96
- //$.jqplot.preInitHooks.push($.jqplot.Dragable.init);
97
- $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Dragable.parseOptions);
98
- $.jqplot.postDrawHooks.push($.jqplot.Dragable.postPlotDraw);
99
- $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
100
- $.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleDown]);
101
- $.jqplot.eventListenerHooks.push(['jqplotMouseUp', handleUp]);
102
-
103
-
104
- function initDragPoint(plot, neighbor) {
105
- var s = plot.series[neighbor.seriesIndex];
106
- var drag = s.plugins.dragable;
107
-
108
- // first, init the mark renderer for the dragged point
109
- var smr = s.markerRenderer;
110
- var mr = drag.markerRenderer;
111
- mr.style = smr.style;
112
- mr.lineWidth = smr.lineWidth + 2.5;
113
- mr.size = smr.size + 5;
114
- if (!drag.color) {
115
- var rgba = $.jqplot.getColorComponents(smr.color);
116
- var newrgb = [rgba[0], rgba[1], rgba[2]];
117
- var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
118
- drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
119
- }
120
- mr.color = drag.color;
121
- mr.init();
122
-
123
- var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
124
- var end = neighbor.pointIndex+2;
125
- drag._gridData = s.gridData.slice(start, end);
126
- }
127
-
128
- function handleMove(ev, gridpos, datapos, neighbor, plot) {
129
- if (plot.plugins.dragable.dragCanvas.isDragging) {
130
- var dc = plot.plugins.dragable.dragCanvas;
131
- var dp = dc._neighbor;
132
- var s = plot.series[dp.seriesIndex];
133
- var drag = s.plugins.dragable;
134
- var gd = s.gridData;
135
-
136
- // compute the new grid position with any constraints.
137
- var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
138
- var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
139
-
140
- // compute data values for any listeners.
141
- var xu = s._xaxis.series_p2u(x);
142
- var yu = s._yaxis.series_p2u(y);
143
-
144
- // clear the canvas then redraw effect at new position.
145
- var ctx = dc._ctx;
146
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
147
-
148
- // adjust our gridData for the new mouse position
149
- if (dp.pointIndex > 0) {
150
- drag._gridData[1] = [x, y];
151
- }
152
- else {
153
- drag._gridData[0] = [x, y];
154
- }
155
- plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
156
- plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
157
- }
158
- else if (neighbor != null) {
159
- var series = plot.series[neighbor.seriesIndex];
160
- if (series.isDragable) {
161
- var dc = plot.plugins.dragable.dragCanvas;
162
- if (!dc.isOver) {
163
- dc._cursors.push(ev.target.style.cursor);
164
- ev.target.style.cursor = "pointer";
165
- }
166
- dc.isOver = true;
167
- }
168
- }
169
- else if (neighbor == null) {
170
- var dc = plot.plugins.dragable.dragCanvas;
171
- if (dc.isOver) {
172
- ev.target.style.cursor = dc._cursors.pop();
173
- dc.isOver = false;
174
- }
175
- }
176
- }
177
-
178
- function handleDown(ev, gridpos, datapos, neighbor, plot) {
179
- var dc = plot.plugins.dragable.dragCanvas;
180
- dc._cursors.push(ev.target.style.cursor);
181
- if (neighbor != null) {
182
- var s = plot.series[neighbor.seriesIndex];
183
- var drag = s.plugins.dragable;
184
- if (s.isDragable && !dc.isDragging) {
185
- dc._neighbor = neighbor;
186
- dc.isDragging = true;
187
- initDragPoint(plot, neighbor);
188
- drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
189
- ev.target.style.cursor = "move";
190
- plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
191
- }
192
- }
193
- // Just in case of a hickup, we'll clear the drag canvas and reset.
194
- else {
195
- var ctx = dc._ctx;
196
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
197
- dc.isDragging = false;
198
- }
199
- }
200
-
201
- function handleUp(ev, gridpos, datapos, neighbor, plot) {
202
- if (plot.plugins.dragable.dragCanvas.isDragging) {
203
- var dc = plot.plugins.dragable.dragCanvas;
204
- // clear the canvas
205
- var ctx = dc._ctx;
206
- ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
207
- dc.isDragging = false;
208
- // redraw the series canvas at the new point.
209
- var dp = dc._neighbor;
210
- var s = plot.series[dp.seriesIndex];
211
- var drag = s.plugins.dragable;
212
- // compute the new grid position with any constraints.
213
- var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
214
- var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
215
- // var x = datapos[s.xaxis];
216
- // var y = datapos[s.yaxis];
217
- s.data[dp.pointIndex][0] = x;
218
- s.data[dp.pointIndex][1] = y;
219
- plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
220
- dc._neighbor = null;
221
- ev.target.style.cursor = dc._cursors.pop();
222
- plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
223
- }
224
- }
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
+ /**
34
+ * Class: $.jqplot.Dragable
35
+ * Plugin to make plotted points dragable by the user.
36
+ */
37
+ $.jqplot.Dragable = function(options) {
38
+ // Group: Properties
39
+ this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
40
+ this.shapeRenderer = new $.jqplot.ShapeRenderer();
41
+ this.isDragging = false;
42
+ this.isOver = false;
43
+ this._ctx;
44
+ this._elem;
45
+ this._point;
46
+ this._gridData;
47
+ // prop: color
48
+ // CSS color spec for the dragged point (and adjacent line segment or bar).
49
+ this.color;
50
+ // prop: constrainTo
51
+ // Constrain dragging motion to an axis or to none.
52
+ // Allowable values are 'none', 'x', 'y'
53
+ this.constrainTo = 'none'; // 'x', 'y', or 'none';
54
+ $.extend(true, this, options);
55
+ };
56
+
57
+ function DragCanvas() {
58
+ $.jqplot.GenericCanvas.call(this);
59
+ this.isDragging = false;
60
+ this.isOver = false;
61
+ this._neighbor;
62
+ this._cursors = [];
63
+ }
64
+
65
+ DragCanvas.prototype = new $.jqplot.GenericCanvas();
66
+ DragCanvas.prototype.constructor = DragCanvas;
67
+
68
+
69
+ // called within scope of series
70
+ $.jqplot.Dragable.parseOptions = function (defaults, opts) {
71
+ var options = opts || {};
72
+ this.plugins.dragable = new $.jqplot.Dragable(options.dragable);
73
+ // since this function is called before series options are parsed,
74
+ // we can set this here and it will be overridden if needed.
75
+ this.isDragable = $.jqplot.config.enablePlugins;
76
+ };
77
+
78
+ // called within context of plot
79
+ // create a canvas which we can draw on.
80
+ // insert it before the eventCanvas, so eventCanvas will still capture events.
81
+ // add a new DragCanvas object to the plot plugins to handle drawing on this new canvas.
82
+ $.jqplot.Dragable.postPlotDraw = function() {
83
+ // Memory Leaks patch
84
+ if (this.plugins.dragable && this.plugins.dragable.highlightCanvas) {
85
+ this.plugins.dragable.highlightCanvas.resetCanvas();
86
+ this.plugins.dragable.highlightCanvas = null;
87
+ }
88
+
89
+ this.plugins.dragable = {previousCursor:'auto', isOver:false};
90
+ this.plugins.dragable.dragCanvas = new DragCanvas();
91
+
92
+ this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding, 'jqplot-dragable-canvas', this._plotDimensions, this));
93
+ var dctx = this.plugins.dragable.dragCanvas.setContext();
94
+ };
95
+
96
+ //$.jqplot.preInitHooks.push($.jqplot.Dragable.init);
97
+ $.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Dragable.parseOptions);
98
+ $.jqplot.postDrawHooks.push($.jqplot.Dragable.postPlotDraw);
99
+ $.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
100
+ $.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleDown]);
101
+ $.jqplot.eventListenerHooks.push(['jqplotMouseUp', handleUp]);
102
+
103
+
104
+ function initDragPoint(plot, neighbor) {
105
+ var s = plot.series[neighbor.seriesIndex];
106
+ var drag = s.plugins.dragable;
107
+
108
+ // first, init the mark renderer for the dragged point
109
+ var smr = s.markerRenderer;
110
+ var mr = drag.markerRenderer;
111
+ mr.style = smr.style;
112
+ mr.lineWidth = smr.lineWidth + 2.5;
113
+ mr.size = smr.size + 5;
114
+ if (!drag.color) {
115
+ var rgba = $.jqplot.getColorComponents(smr.color);
116
+ var newrgb = [rgba[0], rgba[1], rgba[2]];
117
+ var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
118
+ drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
119
+ }
120
+ mr.color = drag.color;
121
+ mr.init();
122
+
123
+ var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
124
+ var end = neighbor.pointIndex+2;
125
+ drag._gridData = s.gridData.slice(start, end);
126
+ }
127
+
128
+ function handleMove(ev, gridpos, datapos, neighbor, plot) {
129
+ if (plot.plugins.dragable.dragCanvas.isDragging) {
130
+ var dc = plot.plugins.dragable.dragCanvas;
131
+ var dp = dc._neighbor;
132
+ var s = plot.series[dp.seriesIndex];
133
+ var drag = s.plugins.dragable;
134
+ var gd = s.gridData;
135
+
136
+ // compute the new grid position with any constraints.
137
+ var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
138
+ var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
139
+
140
+ // compute data values for any listeners.
141
+ var xu = s._xaxis.series_p2u(x);
142
+ var yu = s._yaxis.series_p2u(y);
143
+
144
+ // clear the canvas then redraw effect at new position.
145
+ var ctx = dc._ctx;
146
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
147
+
148
+ // adjust our gridData for the new mouse position
149
+ if (dp.pointIndex > 0) {
150
+ drag._gridData[1] = [x, y];
151
+ }
152
+ else {
153
+ drag._gridData[0] = [x, y];
154
+ }
155
+ plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
156
+ plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
157
+ }
158
+ else if (neighbor != null) {
159
+ var series = plot.series[neighbor.seriesIndex];
160
+ if (series.isDragable) {
161
+ var dc = plot.plugins.dragable.dragCanvas;
162
+ if (!dc.isOver) {
163
+ dc._cursors.push(ev.target.style.cursor);
164
+ ev.target.style.cursor = "pointer";
165
+ }
166
+ dc.isOver = true;
167
+ }
168
+ }
169
+ else if (neighbor == null) {
170
+ var dc = plot.plugins.dragable.dragCanvas;
171
+ if (dc.isOver) {
172
+ ev.target.style.cursor = dc._cursors.pop();
173
+ dc.isOver = false;
174
+ }
175
+ }
176
+ }
177
+
178
+ function handleDown(ev, gridpos, datapos, neighbor, plot) {
179
+ var dc = plot.plugins.dragable.dragCanvas;
180
+ dc._cursors.push(ev.target.style.cursor);
181
+ if (neighbor != null) {
182
+ var s = plot.series[neighbor.seriesIndex];
183
+ var drag = s.plugins.dragable;
184
+ if (s.isDragable && !dc.isDragging) {
185
+ dc._neighbor = neighbor;
186
+ dc.isDragging = true;
187
+ initDragPoint(plot, neighbor);
188
+ drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
189
+ ev.target.style.cursor = "move";
190
+ plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
191
+ }
192
+ }
193
+ // Just in case of a hickup, we'll clear the drag canvas and reset.
194
+ else {
195
+ var ctx = dc._ctx;
196
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
197
+ dc.isDragging = false;
198
+ }
199
+ }
200
+
201
+ function handleUp(ev, gridpos, datapos, neighbor, plot) {
202
+ if (plot.plugins.dragable.dragCanvas.isDragging) {
203
+ var dc = plot.plugins.dragable.dragCanvas;
204
+ // clear the canvas
205
+ var ctx = dc._ctx;
206
+ ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
207
+ dc.isDragging = false;
208
+ // redraw the series canvas at the new point.
209
+ var dp = dc._neighbor;
210
+ var s = plot.series[dp.seriesIndex];
211
+ var drag = s.plugins.dragable;
212
+ // compute the new grid position with any constraints.
213
+ var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
214
+ var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
215
+ // var x = datapos[s.xaxis];
216
+ // var y = datapos[s.yaxis];
217
+ s.data[dp.pointIndex][0] = x;
218
+ s.data[dp.pointIndex][1] = y;
219
+ plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
220
+ dc._neighbor = null;
221
+ ev.target.style.cursor = dc._cursors.pop();
222
+ plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
223
+ }
224
+ }
225
225
  })(jQuery);
@@ -1,305 +1,305 @@
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
- // class $.jqplot.EnhancedLegendRenderer
33
- // Legend renderer which can specify the number of rows and/or columns in the legend.
34
- $.jqplot.EnhancedLegendRenderer = function(){
35
- $.jqplot.TableLegendRenderer.call(this);
36
- };
37
-
38
- $.jqplot.EnhancedLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
39
- $.jqplot.EnhancedLegendRenderer.prototype.constructor = $.jqplot.EnhancedLegendRenderer;
40
-
41
- // called with scope of legend.
42
- $.jqplot.EnhancedLegendRenderer.prototype.init = function(options) {
43
- // prop: numberRows
44
- // Maximum number of rows in the legend. 0 or null for unlimited.
45
- this.numberRows = null;
46
- // prop: numberColumns
47
- // Maximum number of columns in the legend. 0 or null for unlimited.
48
- this.numberColumns = null;
49
- // prop: seriesToggle
50
- // false to not enable series on/off toggling on the legend.
51
- // true or a fadein/fadeout speed (number of milliseconds or 'fast', 'normal', 'slow')
52
- // to enable show/hide of series on click of legend item.
53
- this.seriesToggle = 'normal';
54
- // prop: seriesToggleReplot
55
- // True to replot the chart after toggling series on/off.
56
- // This will set the series show property to false.
57
- // This allows for rescaling or other maniplation of chart.
58
- // Set to an options object (e.g. {resetAxes: true}) for replot options.
59
- this.seriesToggleReplot = false;
60
- // prop: disableIEFading
61
- // true to toggle series with a show/hide method only and not allow fading in/out.
62
- // This is to overcome poor performance of fade in some versions of IE.
63
- this.disableIEFading = true;
64
- $.extend(true, this, options);
65
-
66
- if (this.seriesToggle) {
67
- $.jqplot.postDrawHooks.push(postDraw);
68
- }
69
- };
70
-
71
- // called with scope of legend
72
- $.jqplot.EnhancedLegendRenderer.prototype.draw = function(offsets, plot) {
73
- var legend = this;
74
- if (this.show) {
75
- var series = this._series;
76
- var s;
77
- var ss = 'position:absolute;';
78
- ss += (this.background) ? 'background:'+this.background+';' : '';
79
- ss += (this.border) ? 'border:'+this.border+';' : '';
80
- ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
81
- ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
82
- ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
83
- ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
84
- ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
85
- ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
86
- ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
87
- this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
88
- if (this.seriesToggle) {
89
- this._elem.css('z-index', '3');
90
- }
91
-
92
- var pad = false,
93
- reverse = false,
94
- nr, nc;
95
- if (this.numberRows) {
96
- nr = this.numberRows;
97
- if (!this.numberColumns){
98
- nc = Math.ceil(series.length/nr);
99
- }
100
- else{
101
- nc = this.numberColumns;
102
- }
103
- }
104
- else if (this.numberColumns) {
105
- nc = this.numberColumns;
106
- nr = Math.ceil(series.length/this.numberColumns);
107
- }
108
- else {
109
- nr = series.length;
110
- nc = 1;
111
- }
112
-
113
- var i, j, tr, td1, td2, lt, rs, div, div0, div1;
114
- var idx = 0;
115
- // check to see if we need to reverse
116
- for (i=series.length-1; i>=0; i--) {
117
- if (nc == 1 && series[i]._stack || series[i].renderer.constructor == $.jqplot.BezierCurveRenderer){
118
- reverse = true;
119
- }
120
- }
121
-
122
- for (i=0; i<nr; i++) {
123
- tr = $(document.createElement('tr'));
124
- tr.addClass('jqplot-table-legend');
125
- if (reverse){
126
- tr.prependTo(this._elem);
127
- }
128
- else{
129
- tr.appendTo(this._elem);
130
- }
131
- for (j=0; j<nc; j++) {
132
- if (idx < series.length && (series[idx].show || series[idx].showLabel)){
133
- s = series[idx];
134
- lt = this.labels[idx] || s.label.toString();
135
- if (lt) {
136
- var color = s.color;
137
- if (!reverse){
138
- if (i>0){
139
- pad = true;
140
- }
141
- else{
142
- pad = false;
143
- }
144
- }
145
- else{
146
- if (i == nr -1){
147
- pad = false;
148
- }
149
- else{
150
- pad = true;
151
- }
152
- }
153
- rs = (pad) ? this.rowSpacing : '0';
154
-
155
- td1 = $(document.createElement('td'));
156
- td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
157
- td1.css({textAlign: 'center', paddingTop: rs});
158
-
159
- div0 = $(document.createElement('div'));
160
- div0.addClass('jqplot-table-legend-swatch-outline');
161
- div1 = $(document.createElement('div'));
162
- div1.addClass('jqplot-table-legend-swatch');
163
- div1.css({backgroundColor: color, borderColor: color});
164
-
165
- td1.append(div0.append(div1));
166
-
167
- td2 = $(document.createElement('td'));
168
- td2.addClass('jqplot-table-legend jqplot-table-legend-label');
169
- td2.css('paddingTop', rs);
170
-
171
- // td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
172
- // '<div><div class="jqplot-table-legend-swatch" style="background-color:'+color+';border-color:'+color+';"></div>'+
173
- // '</div></td>');
174
- // td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
175
- if (this.escapeHtml){
176
- td2.text(lt);
177
- }
178
- else {
179
- td2.html(lt);
180
- }
181
- if (reverse) {
182
- if (this.showLabels) {td2.prependTo(tr);}
183
- if (this.showSwatches) {td1.prependTo(tr);}
184
- }
185
- else {
186
- if (this.showSwatches) {td1.appendTo(tr);}
187
- if (this.showLabels) {td2.appendTo(tr);}
188
- }
189
-
190
- if (this.seriesToggle) {
191
-
192
- // add an overlay for clicking series on/off
193
- // div0 = $(document.createElement('div'));
194
- // div0.addClass('jqplot-table-legend-overlay');
195
- // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
196
- // tr.append(div0);
197
-
198
- var speed;
199
- if (typeof(this.seriesToggle) === 'string' || typeof(this.seriesToggle) === 'number') {
200
- if (!$.jqplot.use_excanvas || !this.disableIEFading) {
201
- speed = this.seriesToggle;
202
- }
203
- }
204
- if (this.showSwatches) {
205
- td1.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
206
- td1.addClass('jqplot-seriesToggle');
207
- }
208
- if (this.showLabels) {
209
- td2.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
210
- td2.addClass('jqplot-seriesToggle');
211
- }
212
-
213
- // for series that are already hidden, add the hidden class
214
- if (!s.show && s.showLabel) {
215
- td1.addClass('jqplot-series-hidden');
216
- td2.addClass('jqplot-series-hidden');
217
- }
218
- }
219
-
220
- pad = true;
221
- }
222
- }
223
- idx++;
224
- }
225
-
226
- td1 = td2 = div0 = div1 = null;
227
- }
228
- }
229
- return this._elem;
230
- };
231
-
232
- var handleToggle = function (ev) {
233
- var d = ev.data,
234
- s = d.series,
235
- replot = d.replot,
236
- plot = d.plot,
237
- speed = d.speed,
238
- sidx = s.index,
239
- showing = false;
240
-
241
- if (s.canvas._elem.is(':hidden') || !s.show) {
242
- showing = true;
243
- }
244
-
245
- var doLegendToggle = function() {
246
-
247
- if (replot) {
248
- var opts = {};
249
-
250
- if ($.isPlainObject(replot)) {
251
- $.extend(true, opts, replot);
252
- }
253
-
254
- plot.replot(opts);
255
- // if showing, there was no canvas element to fade in, so hide here
256
- // and then do a fade in.
257
- if (showing && speed) {
258
- var s = plot.series[sidx];
259
-
260
- if (s.shadowCanvas._elem) {
261
- s.shadowCanvas._elem.hide().fadeIn(speed);
262
- }
263
- s.canvas._elem.hide().fadeIn(speed);
264
- s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide().fadeIn(speed);
265
- }
266
-
267
- }
268
-
269
- else {
270
- var s = plot.series[sidx];
271
-
272
- if (s.canvas._elem.is(':hidden') || !s.show) {
273
- // Not sure if there is a better way to check for showSwatches and showLabels === true.
274
- // Test for "undefined" since default values for both showSwatches and showLables is true.
275
- if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
276
- plot.legend._elem.find('td').eq(sidx * 2).addClass('jqplot-series-hidden');
277
- }
278
- if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
279
- plot.legend._elem.find('td').eq((sidx * 2) + 1).addClass('jqplot-series-hidden');
280
- }
281
- }
282
- else {
283
- if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
284
- plot.legend._elem.find('td').eq(sidx * 2).removeClass('jqplot-series-hidden');
285
- }
286
- if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
287
- plot.legend._elem.find('td').eq((sidx * 2) + 1).removeClass('jqplot-series-hidden');
288
- }
289
- }
290
-
291
- }
292
-
293
- };
294
-
295
- s.toggleDisplay(ev, doLegendToggle);
296
- };
297
-
298
- // called with scope of plot.
299
- var postDraw = function () {
300
- if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
301
- var e = this.legend._elem.detach();
302
- this.eventCanvas._elem.after(e);
303
- }
304
- };
305
- })(jQuery);
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
+ // class $.jqplot.EnhancedLegendRenderer
33
+ // Legend renderer which can specify the number of rows and/or columns in the legend.
34
+ $.jqplot.EnhancedLegendRenderer = function(){
35
+ $.jqplot.TableLegendRenderer.call(this);
36
+ };
37
+
38
+ $.jqplot.EnhancedLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
39
+ $.jqplot.EnhancedLegendRenderer.prototype.constructor = $.jqplot.EnhancedLegendRenderer;
40
+
41
+ // called with scope of legend.
42
+ $.jqplot.EnhancedLegendRenderer.prototype.init = function(options) {
43
+ // prop: numberRows
44
+ // Maximum number of rows in the legend. 0 or null for unlimited.
45
+ this.numberRows = null;
46
+ // prop: numberColumns
47
+ // Maximum number of columns in the legend. 0 or null for unlimited.
48
+ this.numberColumns = null;
49
+ // prop: seriesToggle
50
+ // false to not enable series on/off toggling on the legend.
51
+ // true or a fadein/fadeout speed (number of milliseconds or 'fast', 'normal', 'slow')
52
+ // to enable show/hide of series on click of legend item.
53
+ this.seriesToggle = 'normal';
54
+ // prop: seriesToggleReplot
55
+ // True to replot the chart after toggling series on/off.
56
+ // This will set the series show property to false.
57
+ // This allows for rescaling or other maniplation of chart.
58
+ // Set to an options object (e.g. {resetAxes: true}) for replot options.
59
+ this.seriesToggleReplot = false;
60
+ // prop: disableIEFading
61
+ // true to toggle series with a show/hide method only and not allow fading in/out.
62
+ // This is to overcome poor performance of fade in some versions of IE.
63
+ this.disableIEFading = true;
64
+ $.extend(true, this, options);
65
+
66
+ if (this.seriesToggle) {
67
+ $.jqplot.postDrawHooks.push(postDraw);
68
+ }
69
+ };
70
+
71
+ // called with scope of legend
72
+ $.jqplot.EnhancedLegendRenderer.prototype.draw = function(offsets, plot) {
73
+ var legend = this;
74
+ if (this.show) {
75
+ var series = this._series;
76
+ var s;
77
+ var ss = 'position:absolute;';
78
+ ss += (this.background) ? 'background:'+this.background+';' : '';
79
+ ss += (this.border) ? 'border:'+this.border+';' : '';
80
+ ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
81
+ ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
82
+ ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
83
+ ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
84
+ ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
85
+ ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
86
+ ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
87
+ this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
88
+ if (this.seriesToggle) {
89
+ this._elem.css('z-index', '3');
90
+ }
91
+
92
+ var pad = false,
93
+ reverse = false,
94
+ nr, nc;
95
+ if (this.numberRows) {
96
+ nr = this.numberRows;
97
+ if (!this.numberColumns){
98
+ nc = Math.ceil(series.length/nr);
99
+ }
100
+ else{
101
+ nc = this.numberColumns;
102
+ }
103
+ }
104
+ else if (this.numberColumns) {
105
+ nc = this.numberColumns;
106
+ nr = Math.ceil(series.length/this.numberColumns);
107
+ }
108
+ else {
109
+ nr = series.length;
110
+ nc = 1;
111
+ }
112
+
113
+ var i, j, tr, td1, td2, lt, rs, div, div0, div1;
114
+ var idx = 0;
115
+ // check to see if we need to reverse
116
+ for (i=series.length-1; i>=0; i--) {
117
+ if (nc == 1 && series[i]._stack || series[i].renderer.constructor == $.jqplot.BezierCurveRenderer){
118
+ reverse = true;
119
+ }
120
+ }
121
+
122
+ for (i=0; i<nr; i++) {
123
+ tr = $(document.createElement('tr'));
124
+ tr.addClass('jqplot-table-legend');
125
+ if (reverse){
126
+ tr.prependTo(this._elem);
127
+ }
128
+ else{
129
+ tr.appendTo(this._elem);
130
+ }
131
+ for (j=0; j<nc; j++) {
132
+ if (idx < series.length && (series[idx].show || series[idx].showLabel)){
133
+ s = series[idx];
134
+ lt = this.labels[idx] || s.label.toString();
135
+ if (lt) {
136
+ var color = s.color;
137
+ if (!reverse){
138
+ if (i>0){
139
+ pad = true;
140
+ }
141
+ else{
142
+ pad = false;
143
+ }
144
+ }
145
+ else{
146
+ if (i == nr -1){
147
+ pad = false;
148
+ }
149
+ else{
150
+ pad = true;
151
+ }
152
+ }
153
+ rs = (pad) ? this.rowSpacing : '0';
154
+
155
+ td1 = $(document.createElement('td'));
156
+ td1.addClass('jqplot-table-legend jqplot-table-legend-swatch');
157
+ td1.css({textAlign: 'center', paddingTop: rs});
158
+
159
+ div0 = $(document.createElement('div'));
160
+ div0.addClass('jqplot-table-legend-swatch-outline');
161
+ div1 = $(document.createElement('div'));
162
+ div1.addClass('jqplot-table-legend-swatch');
163
+ div1.css({backgroundColor: color, borderColor: color});
164
+
165
+ td1.append(div0.append(div1));
166
+
167
+ td2 = $(document.createElement('td'));
168
+ td2.addClass('jqplot-table-legend jqplot-table-legend-label');
169
+ td2.css('paddingTop', rs);
170
+
171
+ // td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
172
+ // '<div><div class="jqplot-table-legend-swatch" style="background-color:'+color+';border-color:'+color+';"></div>'+
173
+ // '</div></td>');
174
+ // td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
175
+ if (this.escapeHtml){
176
+ td2.text(lt);
177
+ }
178
+ else {
179
+ td2.html(lt);
180
+ }
181
+ if (reverse) {
182
+ if (this.showLabels) {td2.prependTo(tr);}
183
+ if (this.showSwatches) {td1.prependTo(tr);}
184
+ }
185
+ else {
186
+ if (this.showSwatches) {td1.appendTo(tr);}
187
+ if (this.showLabels) {td2.appendTo(tr);}
188
+ }
189
+
190
+ if (this.seriesToggle) {
191
+
192
+ // add an overlay for clicking series on/off
193
+ // div0 = $(document.createElement('div'));
194
+ // div0.addClass('jqplot-table-legend-overlay');
195
+ // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
196
+ // tr.append(div0);
197
+
198
+ var speed;
199
+ if (typeof(this.seriesToggle) === 'string' || typeof(this.seriesToggle) === 'number') {
200
+ if (!$.jqplot.use_excanvas || !this.disableIEFading) {
201
+ speed = this.seriesToggle;
202
+ }
203
+ }
204
+ if (this.showSwatches) {
205
+ td1.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
206
+ td1.addClass('jqplot-seriesToggle');
207
+ }
208
+ if (this.showLabels) {
209
+ td2.bind('click', {series:s, speed:speed, plot: plot, replot:this.seriesToggleReplot}, handleToggle);
210
+ td2.addClass('jqplot-seriesToggle');
211
+ }
212
+
213
+ // for series that are already hidden, add the hidden class
214
+ if (!s.show && s.showLabel) {
215
+ td1.addClass('jqplot-series-hidden');
216
+ td2.addClass('jqplot-series-hidden');
217
+ }
218
+ }
219
+
220
+ pad = true;
221
+ }
222
+ }
223
+ idx++;
224
+ }
225
+
226
+ td1 = td2 = div0 = div1 = null;
227
+ }
228
+ }
229
+ return this._elem;
230
+ };
231
+
232
+ var handleToggle = function (ev) {
233
+ var d = ev.data,
234
+ s = d.series,
235
+ replot = d.replot,
236
+ plot = d.plot,
237
+ speed = d.speed,
238
+ sidx = s.index,
239
+ showing = false;
240
+
241
+ if (s.canvas._elem.is(':hidden') || !s.show) {
242
+ showing = true;
243
+ }
244
+
245
+ var doLegendToggle = function() {
246
+
247
+ if (replot) {
248
+ var opts = {};
249
+
250
+ if ($.isPlainObject(replot)) {
251
+ $.extend(true, opts, replot);
252
+ }
253
+
254
+ plot.replot(opts);
255
+ // if showing, there was no canvas element to fade in, so hide here
256
+ // and then do a fade in.
257
+ if (showing && speed) {
258
+ var s = plot.series[sidx];
259
+
260
+ if (s.shadowCanvas._elem) {
261
+ s.shadowCanvas._elem.hide().fadeIn(speed);
262
+ }
263
+ s.canvas._elem.hide().fadeIn(speed);
264
+ s.canvas._elem.nextAll('.jqplot-point-label.jqplot-series-'+s.index).hide().fadeIn(speed);
265
+ }
266
+
267
+ }
268
+
269
+ else {
270
+ var s = plot.series[sidx];
271
+
272
+ if (s.canvas._elem.is(':hidden') || !s.show) {
273
+ // Not sure if there is a better way to check for showSwatches and showLabels === true.
274
+ // Test for "undefined" since default values for both showSwatches and showLables is true.
275
+ if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
276
+ plot.legend._elem.find('td').eq(sidx * 2).addClass('jqplot-series-hidden');
277
+ }
278
+ if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
279
+ plot.legend._elem.find('td').eq((sidx * 2) + 1).addClass('jqplot-series-hidden');
280
+ }
281
+ }
282
+ else {
283
+ if (typeof plot.options.legend.showSwatches === 'undefined' || plot.options.legend.showSwatches === true) {
284
+ plot.legend._elem.find('td').eq(sidx * 2).removeClass('jqplot-series-hidden');
285
+ }
286
+ if (typeof plot.options.legend.showLabels === 'undefined' || plot.options.legend.showLabels === true) {
287
+ plot.legend._elem.find('td').eq((sidx * 2) + 1).removeClass('jqplot-series-hidden');
288
+ }
289
+ }
290
+
291
+ }
292
+
293
+ };
294
+
295
+ s.toggleDisplay(ev, doLegendToggle);
296
+ };
297
+
298
+ // called with scope of plot.
299
+ var postDraw = function () {
300
+ if (this.legend.renderer.constructor == $.jqplot.EnhancedLegendRenderer && this.legend.seriesToggle){
301
+ var e = this.legend._elem.detach();
302
+ this.eventCanvas._elem.after(e);
303
+ }
304
+ };
305
+ })(jQuery);