flot-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/README.md +2 -2
  2. data/lib/flot/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/excanvas.js +1428 -1427
  4. data/vendor/assets/javascripts/excanvas.min.js +1 -1
  5. data/vendor/assets/javascripts/jquery.colorhelpers.js +179 -179
  6. data/vendor/assets/javascripts/jquery.colorhelpers.min.js +21 -1
  7. data/vendor/assets/javascripts/jquery.flot.canvas.js +317 -0
  8. data/vendor/assets/javascripts/jquery.flot.canvas.min.js +28 -0
  9. data/vendor/assets/javascripts/jquery.flot.categories.js +190 -0
  10. data/vendor/assets/javascripts/jquery.flot.categories.min.js +44 -0
  11. data/vendor/assets/javascripts/jquery.flot.crosshair.js +176 -167
  12. data/vendor/assets/javascripts/jquery.flot.crosshair.min.js +59 -1
  13. data/vendor/assets/javascripts/jquery.flot.errorbars.js +353 -0
  14. data/vendor/assets/javascripts/jquery.flot.errorbars.min.js +63 -0
  15. data/vendor/assets/javascripts/jquery.flot.fillbetween.js +226 -183
  16. data/vendor/assets/javascripts/jquery.flot.fillbetween.min.js +30 -1
  17. data/vendor/assets/javascripts/jquery.flot.image.js +241 -238
  18. data/vendor/assets/javascripts/jquery.flot.image.min.js +53 -1
  19. data/vendor/assets/javascripts/jquery.flot.js +2980 -2599
  20. data/vendor/assets/javascripts/jquery.flot.min.js +26 -4
  21. data/vendor/assets/javascripts/jquery.flot.navigate.js +345 -336
  22. data/vendor/assets/javascripts/jquery.flot.navigate.min.js +96 -1
  23. data/vendor/assets/javascripts/jquery.flot.pie.js +561 -499
  24. data/vendor/assets/javascripts/jquery.flot.pie.min.js +56 -1
  25. data/vendor/assets/javascripts/jquery.flot.resize.js +60 -60
  26. data/vendor/assets/javascripts/jquery.flot.resize.min.js +21 -1
  27. data/vendor/assets/javascripts/jquery.flot.selection.js +360 -344
  28. data/vendor/assets/javascripts/jquery.flot.selection.min.js +79 -1
  29. data/vendor/assets/javascripts/jquery.flot.stack.js +188 -184
  30. data/vendor/assets/javascripts/jquery.flot.stack.min.js +36 -1
  31. data/vendor/assets/javascripts/jquery.flot.symbol.js +71 -70
  32. data/vendor/assets/javascripts/jquery.flot.symbol.min.js +14 -1
  33. data/vendor/assets/javascripts/jquery.flot.threshold.js +142 -103
  34. data/vendor/assets/javascripts/jquery.flot.threshold.min.js +43 -1
  35. data/vendor/assets/javascripts/jquery.flot.time.js +424 -0
  36. data/vendor/assets/javascripts/jquery.flot.time.min.js +9 -0
  37. metadata +25 -7
@@ -1 +1,79 @@
1
- (function(a){function b(k){var p={first:{x:-1,y:-1},second:{x:-1,y:-1},show:false,active:false};var m={};var r=null;function e(s){if(p.active){l(s);k.getPlaceholder().trigger("plotselecting",[g()])}}function n(s){if(s.which!=1){return}document.body.focus();if(document.onselectstart!==undefined&&m.onselectstart==null){m.onselectstart=document.onselectstart;document.onselectstart=function(){return false}}if(document.ondrag!==undefined&&m.ondrag==null){m.ondrag=document.ondrag;document.ondrag=function(){return false}}d(p.first,s);p.active=true;r=function(t){j(t)};a(document).one("mouseup",r)}function j(s){r=null;if(document.onselectstart!==undefined){document.onselectstart=m.onselectstart}if(document.ondrag!==undefined){document.ondrag=m.ondrag}p.active=false;l(s);if(f()){i()}else{k.getPlaceholder().trigger("plotunselected",[]);k.getPlaceholder().trigger("plotselecting",[null])}return false}function g(){if(!f()){return null}var u={},t=p.first,s=p.second;a.each(k.getAxes(),function(v,w){if(w.used){var y=w.c2p(t[w.direction]),x=w.c2p(s[w.direction]);u[v]={from:Math.min(y,x),to:Math.max(y,x)}}});return u}function i(){var s=g();k.getPlaceholder().trigger("plotselected",[s]);if(s.xaxis&&s.yaxis){k.getPlaceholder().trigger("selected",[{x1:s.xaxis.from,y1:s.yaxis.from,x2:s.xaxis.to,y2:s.yaxis.to}])}}function h(t,u,s){return u<t?t:(u>s?s:u)}function d(w,t){var v=k.getOptions();var u=k.getPlaceholder().offset();var s=k.getPlotOffset();w.x=h(0,t.pageX-u.left-s.left,k.width());w.y=h(0,t.pageY-u.top-s.top,k.height());if(v.selection.mode=="y"){w.x=w==p.first?0:k.width()}if(v.selection.mode=="x"){w.y=w==p.first?0:k.height()}}function l(s){if(s.pageX==null){return}d(p.second,s);if(f()){p.show=true;k.triggerRedrawOverlay()}else{q(true)}}function q(s){if(p.show){p.show=false;k.triggerRedrawOverlay();if(!s){k.getPlaceholder().trigger("plotunselected",[])}}}function c(s,w){var t,y,z,A,x=k.getAxes();for(var u in x){t=x[u];if(t.direction==w){A=w+t.n+"axis";if(!s[A]&&t.n==1){A=w+"axis"}if(s[A]){y=s[A].from;z=s[A].to;break}}}if(!s[A]){t=w=="x"?k.getXAxes()[0]:k.getYAxes()[0];y=s[w+"1"];z=s[w+"2"]}if(y!=null&&z!=null&&y>z){var v=y;y=z;z=v}return{from:y,to:z,axis:t}}function o(t,s){var v,u,w=k.getOptions();if(w.selection.mode=="y"){p.first.x=0;p.second.x=k.width()}else{u=c(t,"x");p.first.x=u.axis.p2c(u.from);p.second.x=u.axis.p2c(u.to)}if(w.selection.mode=="x"){p.first.y=0;p.second.y=k.height()}else{u=c(t,"y");p.first.y=u.axis.p2c(u.from);p.second.y=u.axis.p2c(u.to)}p.show=true;k.triggerRedrawOverlay();if(!s&&f()){i()}}function f(){var s=5;return Math.abs(p.second.x-p.first.x)>=s&&Math.abs(p.second.y-p.first.y)>=s}k.clearSelection=q;k.setSelection=o;k.getSelection=g;k.hooks.bindEvents.push(function(t,s){var u=t.getOptions();if(u.selection.mode!=null){s.mousemove(e);s.mousedown(n)}});k.hooks.drawOverlay.push(function(v,D){if(p.show&&f()){var t=v.getPlotOffset();var s=v.getOptions();D.save();D.translate(t.left,t.top);var z=a.color.parse(s.selection.color);D.strokeStyle=z.scale("a",0.8).toString();D.lineWidth=1;D.lineJoin="round";D.fillStyle=z.scale("a",0.4).toString();var B=Math.min(p.first.x,p.second.x),A=Math.min(p.first.y,p.second.y),C=Math.abs(p.second.x-p.first.x),u=Math.abs(p.second.y-p.first.y);D.fillRect(B,A,C,u);D.strokeRect(B,A,C,u);D.restore()}});k.hooks.shutdown.push(function(t,s){s.unbind("mousemove",e);s.unbind("mousedown",n);if(r){a(document).unbind("mouseup",r)}})}a.plot.plugins.push({init:b,options:{selection:{mode:null,color:"#e8cfac"}},name:"selection",version:"1.1"})})(jQuery);
1
+ /* Flot plugin for selecting regions of a plot.
2
+
3
+ Copyright (c) 2007-2013 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ The plugin supports these options:
7
+
8
+ selection: {
9
+ mode: null or "x" or "y" or "xy",
10
+ color: color,
11
+ shape: "round" or "miter" or "bevel",
12
+ minSize: number of pixels
13
+ }
14
+
15
+ Selection support is enabled by setting the mode to one of "x", "y" or "xy".
16
+ In "x" mode, the user will only be able to specify the x range, similarly for
17
+ "y" mode. For "xy", the selection becomes a rectangle where both ranges can be
18
+ specified. "color" is color of the selection (if you need to change the color
19
+ later on, you can get to it with plot.getOptions().selection.color). "shape"
20
+ is the shape of the corners of the selection.
21
+
22
+ "minSize" is the minimum size a selection can be in pixels. This value can
23
+ be customized to determine the smallest size a selection can be and still
24
+ have the selection rectangle be displayed. When customizing this value, the
25
+ fact that it refers to pixels, not axis units must be taken into account.
26
+ Thus, for example, if there is a bar graph in time mode with BarWidth set to 1
27
+ minute, setting "minSize" to 1 will not make the minimum selection size 1
28
+ minute, but rather 1 pixel. Note also that setting "minSize" to 0 will prevent
29
+ "plotunselected" events from being fired when the user clicks the mouse without
30
+ dragging.
31
+
32
+ When selection support is enabled, a "plotselected" event will be emitted on
33
+ the DOM element you passed into the plot function. The event handler gets a
34
+ parameter with the ranges selected on the axes, like this:
35
+
36
+ placeholder.bind( "plotselected", function( event, ranges ) {
37
+ alert("You selected " + ranges.xaxis.from + " to " + ranges.xaxis.to)
38
+ // similar for yaxis - with multiple axes, the extra ones are in
39
+ // x2axis, x3axis, ...
40
+ });
41
+
42
+ The "plotselected" event is only fired when the user has finished making the
43
+ selection. A "plotselecting" event is fired during the process with the same
44
+ parameters as the "plotselected" event, in case you want to know what's
45
+ happening while it's happening,
46
+
47
+ A "plotunselected" event with no arguments is emitted when the user clicks the
48
+ mouse to remove the selection. As stated above, setting "minSize" to 0 will
49
+ destroy this behavior.
50
+
51
+ The plugin allso adds the following methods to the plot object:
52
+
53
+ - setSelection( ranges, preventEvent )
54
+
55
+ Set the selection rectangle. The passed in ranges is on the same form as
56
+ returned in the "plotselected" event. If the selection mode is "x", you
57
+ should put in either an xaxis range, if the mode is "y" you need to put in
58
+ an yaxis range and both xaxis and yaxis if the selection mode is "xy", like
59
+ this:
60
+
61
+ setSelection({ xaxis: { from: 0, to: 10 }, yaxis: { from: 40, to: 60 } });
62
+
63
+ setSelection will trigger the "plotselected" event when called. If you don't
64
+ want that to happen, e.g. if you're inside a "plotselected" handler, pass
65
+ true as the second parameter. If you are using multiple axes, you can
66
+ specify the ranges on any of those, e.g. as x2axis/x3axis/... instead of
67
+ xaxis, the plugin picks the first one it sees.
68
+
69
+ - clearSelection( preventEvent )
70
+
71
+ Clear the selection rectangle. Pass in true to avoid getting a
72
+ "plotunselected" event.
73
+
74
+ - getSelection()
75
+
76
+ Returns the current selection in the same format as the "plotselected"
77
+ event. If there's currently no selection, the function returns null.
78
+
79
+ */(function(e){function t(t){function s(e){n.active&&(h(e),t.getPlaceholder().trigger("plotselecting",[a()]))}function o(t){if(t.which!=1)return;document.body.focus(),document.onselectstart!==undefined&&r.onselectstart==null&&(r.onselectstart=document.onselectstart,document.onselectstart=function(){return!1}),document.ondrag!==undefined&&r.ondrag==null&&(r.ondrag=document.ondrag,document.ondrag=function(){return!1}),c(n.first,t),n.active=!0,i=function(e){u(e)},e(document).one("mouseup",i)}function u(e){return i=null,document.onselectstart!==undefined&&(document.onselectstart=r.onselectstart),document.ondrag!==undefined&&(document.ondrag=r.ondrag),n.active=!1,h(e),m()?f():(t.getPlaceholder().trigger("plotunselected",[]),t.getPlaceholder().trigger("plotselecting",[null])),!1}function a(){if(!m())return null;if(!n.show)return null;var r={},i=n.first,s=n.second;return e.each(t.getAxes(),function(e,t){if(t.used){var n=t.c2p(i[t.direction]),o=t.c2p(s[t.direction]);r[e]={from:Math.min(n,o),to:Math.max(n,o)}}}),r}function f(){var e=a();t.getPlaceholder().trigger("plotselected",[e]),e.xaxis&&e.yaxis&&t.getPlaceholder().trigger("selected",[{x1:e.xaxis.from,y1:e.yaxis.from,x2:e.xaxis.to,y2:e.yaxis.to}])}function l(e,t,n){return t<e?e:t>n?n:t}function c(e,r){var i=t.getOptions(),s=t.getPlaceholder().offset(),o=t.getPlotOffset();e.x=l(0,r.pageX-s.left-o.left,t.width()),e.y=l(0,r.pageY-s.top-o.top,t.height()),i.selection.mode=="y"&&(e.x=e==n.first?0:t.width()),i.selection.mode=="x"&&(e.y=e==n.first?0:t.height())}function h(e){if(e.pageX==null)return;c(n.second,e),m()?(n.show=!0,t.triggerRedrawOverlay()):p(!0)}function p(e){n.show&&(n.show=!1,t.triggerRedrawOverlay(),e||t.getPlaceholder().trigger("plotunselected",[]))}function d(e,n){var r,i,s,o,u=t.getAxes();for(var a in u){r=u[a];if(r.direction==n){o=n+r.n+"axis",!e[o]&&r.n==1&&(o=n+"axis");if(e[o]){i=e[o].from,s=e[o].to;break}}}e[o]||(r=n=="x"?t.getXAxes()[0]:t.getYAxes()[0],i=e[n+"1"],s=e[n+"2"]);if(i!=null&&s!=null&&i>s){var f=i;i=s,s=f}return{from:i,to:s,axis:r}}function v(e,r){var i,s,o=t.getOptions();o.selection.mode=="y"?(n.first.x=0,n.second.x=t.width()):(s=d(e,"x"),n.first.x=s.axis.p2c(s.from),n.second.x=s.axis.p2c(s.to)),o.selection.mode=="x"?(n.first.y=0,n.second.y=t.height()):(s=d(e,"y"),n.first.y=s.axis.p2c(s.from),n.second.y=s.axis.p2c(s.to)),n.show=!0,t.triggerRedrawOverlay(),!r&&m()&&f()}function m(){var e=t.getOptions().selection.minSize;return Math.abs(n.second.x-n.first.x)>=e&&Math.abs(n.second.y-n.first.y)>=e}var n={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},r={},i=null;t.clearSelection=p,t.setSelection=v,t.getSelection=a,t.hooks.bindEvents.push(function(e,t){var n=e.getOptions();n.selection.mode!=null&&(t.mousemove(s),t.mousedown(o))}),t.hooks.drawOverlay.push(function(t,r){if(n.show&&m()){var i=t.getPlotOffset(),s=t.getOptions();r.save(),r.translate(i.left,i.top);var o=e.color.parse(s.selection.color);r.strokeStyle=o.scale("a",.8).toString(),r.lineWidth=1,r.lineJoin=s.selection.shape,r.fillStyle=o.scale("a",.4).toString();var u=Math.min(n.first.x,n.second.x)+.5,a=Math.min(n.first.y,n.second.y)+.5,f=Math.abs(n.second.x-n.first.x)-1,l=Math.abs(n.second.y-n.first.y)-1;r.fillRect(u,a,f,l),r.strokeRect(u,a,f,l),r.restore()}}),t.hooks.shutdown.push(function(t,n){n.unbind("mousemove",s),n.unbind("mousedown",o),i&&e(document).unbind("mouseup",i)})}e.plot.plugins.push({init:t,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})})(jQuery);
@@ -1,184 +1,188 @@
1
- /*
2
- Flot plugin for stacking data sets, i.e. putting them on top of each
3
- other, for accumulative graphs.
4
-
5
- The plugin assumes the data is sorted on x (or y if stacking
6
- horizontally). For line charts, it is assumed that if a line has an
7
- undefined gap (from a null point), then the line above it should have
8
- the same gap - insert zeros instead of "null" if you want another
9
- behaviour. This also holds for the start and end of the chart. Note
10
- that stacking a mix of positive and negative values in most instances
11
- doesn't make sense (so it looks weird).
12
-
13
- Two or more series are stacked when their "stack" attribute is set to
14
- the same key (which can be any number or string or just "true"). To
15
- specify the default stack, you can set
16
-
17
- series: {
18
- stack: null or true or key (number/string)
19
- }
20
-
21
- or specify it for a specific series
22
-
23
- $.plot($("#placeholder"), [{ data: [ ... ], stack: true }])
24
-
25
- The stacking order is determined by the order of the data series in
26
- the array (later series end up on top of the previous).
27
-
28
- Internally, the plugin modifies the datapoints in each series, adding
29
- an offset to the y value. For line series, extra data points are
30
- inserted through interpolation. If there's a second y value, it's also
31
- adjusted (e.g for bar charts or filled areas).
32
- */
33
-
34
- (function ($) {
35
- var options = {
36
- series: { stack: null } // or number/string
37
- };
38
-
39
- function init(plot) {
40
- function findMatchingSeries(s, allseries) {
41
- var res = null
42
- for (var i = 0; i < allseries.length; ++i) {
43
- if (s == allseries[i])
44
- break;
45
-
46
- if (allseries[i].stack == s.stack)
47
- res = allseries[i];
48
- }
49
-
50
- return res;
51
- }
52
-
53
- function stackData(plot, s, datapoints) {
54
- if (s.stack == null)
55
- return;
56
-
57
- var other = findMatchingSeries(s, plot.getData());
58
- if (!other)
59
- return;
60
-
61
- var ps = datapoints.pointsize,
62
- points = datapoints.points,
63
- otherps = other.datapoints.pointsize,
64
- otherpoints = other.datapoints.points,
65
- newpoints = [],
66
- px, py, intery, qx, qy, bottom,
67
- withlines = s.lines.show,
68
- horizontal = s.bars.horizontal,
69
- withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
70
- withsteps = withlines && s.lines.steps,
71
- fromgap = true,
72
- keyOffset = horizontal ? 1 : 0,
73
- accumulateOffset = horizontal ? 0 : 1,
74
- i = 0, j = 0, l;
75
-
76
- while (true) {
77
- if (i >= points.length)
78
- break;
79
-
80
- l = newpoints.length;
81
-
82
- if (points[i] == null) {
83
- // copy gaps
84
- for (m = 0; m < ps; ++m)
85
- newpoints.push(points[i + m]);
86
- i += ps;
87
- }
88
- else if (j >= otherpoints.length) {
89
- // for lines, we can't use the rest of the points
90
- if (!withlines) {
91
- for (m = 0; m < ps; ++m)
92
- newpoints.push(points[i + m]);
93
- }
94
- i += ps;
95
- }
96
- else if (otherpoints[j] == null) {
97
- // oops, got a gap
98
- for (m = 0; m < ps; ++m)
99
- newpoints.push(null);
100
- fromgap = true;
101
- j += otherps;
102
- }
103
- else {
104
- // cases where we actually got two points
105
- px = points[i + keyOffset];
106
- py = points[i + accumulateOffset];
107
- qx = otherpoints[j + keyOffset];
108
- qy = otherpoints[j + accumulateOffset];
109
- bottom = 0;
110
-
111
- if (px == qx) {
112
- for (m = 0; m < ps; ++m)
113
- newpoints.push(points[i + m]);
114
-
115
- newpoints[l + accumulateOffset] += qy;
116
- bottom = qy;
117
-
118
- i += ps;
119
- j += otherps;
120
- }
121
- else if (px > qx) {
122
- // we got past point below, might need to
123
- // insert interpolated extra point
124
- if (withlines && i > 0 && points[i - ps] != null) {
125
- intery = py + (points[i - ps + accumulateOffset] - py) * (qx - px) / (points[i - ps + keyOffset] - px);
126
- newpoints.push(qx);
127
- newpoints.push(intery + qy);
128
- for (m = 2; m < ps; ++m)
129
- newpoints.push(points[i + m]);
130
- bottom = qy;
131
- }
132
-
133
- j += otherps;
134
- }
135
- else { // px < qx
136
- if (fromgap && withlines) {
137
- // if we come from a gap, we just skip this point
138
- i += ps;
139
- continue;
140
- }
141
-
142
- for (m = 0; m < ps; ++m)
143
- newpoints.push(points[i + m]);
144
-
145
- // we might be able to interpolate a point below,
146
- // this can give us a better y
147
- if (withlines && j > 0 && otherpoints[j - otherps] != null)
148
- bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);
149
-
150
- newpoints[l + accumulateOffset] += bottom;
151
-
152
- i += ps;
153
- }
154
-
155
- fromgap = false;
156
-
157
- if (l != newpoints.length && withbottom)
158
- newpoints[l + 2] += bottom;
159
- }
160
-
161
- // maintain the line steps invariant
162
- if (withsteps && l != newpoints.length && l > 0
163
- && newpoints[l] != null
164
- && newpoints[l] != newpoints[l - ps]
165
- && newpoints[l + 1] != newpoints[l - ps + 1]) {
166
- for (m = 0; m < ps; ++m)
167
- newpoints[l + ps + m] = newpoints[l + m];
168
- newpoints[l + 1] = newpoints[l - ps + 1];
169
- }
170
- }
171
-
172
- datapoints.points = newpoints;
173
- }
174
-
175
- plot.hooks.processDatapoints.push(stackData);
176
- }
177
-
178
- $.plot.plugins.push({
179
- init: init,
180
- options: options,
181
- name: 'stack',
182
- version: '1.2'
183
- });
184
- })(jQuery);
1
+ /* Flot plugin for stacking data sets rather than overlyaing them.
2
+
3
+ Copyright (c) 2007-2013 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ The plugin assumes the data is sorted on x (or y if stacking horizontally).
7
+ For line charts, it is assumed that if a line has an undefined gap (from a
8
+ null point), then the line above it should have the same gap - insert zeros
9
+ instead of "null" if you want another behaviour. This also holds for the start
10
+ and end of the chart. Note that stacking a mix of positive and negative values
11
+ in most instances doesn't make sense (so it looks weird).
12
+
13
+ Two or more series are stacked when their "stack" attribute is set to the same
14
+ key (which can be any number or string or just "true"). To specify the default
15
+ stack, you can set the stack option like this:
16
+
17
+ series: {
18
+ stack: null/false, true, or a key (number/string)
19
+ }
20
+
21
+ You can also specify it for a single series, like this:
22
+
23
+ $.plot( $("#placeholder"), [{
24
+ data: [ ... ],
25
+ stack: true
26
+ }])
27
+
28
+ The stacking order is determined by the order of the data series in the array
29
+ (later series end up on top of the previous).
30
+
31
+ Internally, the plugin modifies the datapoints in each series, adding an
32
+ offset to the y value. For line series, extra data points are inserted through
33
+ interpolation. If there's a second y value, it's also adjusted (e.g for bar
34
+ charts or filled areas).
35
+
36
+ */
37
+
38
+ (function ($) {
39
+ var options = {
40
+ series: { stack: null } // or number/string
41
+ };
42
+
43
+ function init(plot) {
44
+ function findMatchingSeries(s, allseries) {
45
+ var res = null;
46
+ for (var i = 0; i < allseries.length; ++i) {
47
+ if (s == allseries[i])
48
+ break;
49
+
50
+ if (allseries[i].stack == s.stack)
51
+ res = allseries[i];
52
+ }
53
+
54
+ return res;
55
+ }
56
+
57
+ function stackData(plot, s, datapoints) {
58
+ if (s.stack == null || s.stack === false)
59
+ return;
60
+
61
+ var other = findMatchingSeries(s, plot.getData());
62
+ if (!other)
63
+ return;
64
+
65
+ var ps = datapoints.pointsize,
66
+ points = datapoints.points,
67
+ otherps = other.datapoints.pointsize,
68
+ otherpoints = other.datapoints.points,
69
+ newpoints = [],
70
+ px, py, intery, qx, qy, bottom,
71
+ withlines = s.lines.show,
72
+ horizontal = s.bars.horizontal,
73
+ withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
74
+ withsteps = withlines && s.lines.steps,
75
+ fromgap = true,
76
+ keyOffset = horizontal ? 1 : 0,
77
+ accumulateOffset = horizontal ? 0 : 1,
78
+ i = 0, j = 0, l, m;
79
+
80
+ while (true) {
81
+ if (i >= points.length)
82
+ break;
83
+
84
+ l = newpoints.length;
85
+
86
+ if (points[i] == null) {
87
+ // copy gaps
88
+ for (m = 0; m < ps; ++m)
89
+ newpoints.push(points[i + m]);
90
+ i += ps;
91
+ }
92
+ else if (j >= otherpoints.length) {
93
+ // for lines, we can't use the rest of the points
94
+ if (!withlines) {
95
+ for (m = 0; m < ps; ++m)
96
+ newpoints.push(points[i + m]);
97
+ }
98
+ i += ps;
99
+ }
100
+ else if (otherpoints[j] == null) {
101
+ // oops, got a gap
102
+ for (m = 0; m < ps; ++m)
103
+ newpoints.push(null);
104
+ fromgap = true;
105
+ j += otherps;
106
+ }
107
+ else {
108
+ // cases where we actually got two points
109
+ px = points[i + keyOffset];
110
+ py = points[i + accumulateOffset];
111
+ qx = otherpoints[j + keyOffset];
112
+ qy = otherpoints[j + accumulateOffset];
113
+ bottom = 0;
114
+
115
+ if (px == qx) {
116
+ for (m = 0; m < ps; ++m)
117
+ newpoints.push(points[i + m]);
118
+
119
+ newpoints[l + accumulateOffset] += qy;
120
+ bottom = qy;
121
+
122
+ i += ps;
123
+ j += otherps;
124
+ }
125
+ else if (px > qx) {
126
+ // we got past point below, might need to
127
+ // insert interpolated extra point
128
+ if (withlines && i > 0 && points[i - ps] != null) {
129
+ intery = py + (points[i - ps + accumulateOffset] - py) * (qx - px) / (points[i - ps + keyOffset] - px);
130
+ newpoints.push(qx);
131
+ newpoints.push(intery + qy);
132
+ for (m = 2; m < ps; ++m)
133
+ newpoints.push(points[i + m]);
134
+ bottom = qy;
135
+ }
136
+
137
+ j += otherps;
138
+ }
139
+ else { // px < qx
140
+ if (fromgap && withlines) {
141
+ // if we come from a gap, we just skip this point
142
+ i += ps;
143
+ continue;
144
+ }
145
+
146
+ for (m = 0; m < ps; ++m)
147
+ newpoints.push(points[i + m]);
148
+
149
+ // we might be able to interpolate a point below,
150
+ // this can give us a better y
151
+ if (withlines && j > 0 && otherpoints[j - otherps] != null)
152
+ bottom = qy + (otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx) / (otherpoints[j - otherps + keyOffset] - qx);
153
+
154
+ newpoints[l + accumulateOffset] += bottom;
155
+
156
+ i += ps;
157
+ }
158
+
159
+ fromgap = false;
160
+
161
+ if (l != newpoints.length && withbottom)
162
+ newpoints[l + 2] += bottom;
163
+ }
164
+
165
+ // maintain the line steps invariant
166
+ if (withsteps && l != newpoints.length && l > 0
167
+ && newpoints[l] != null
168
+ && newpoints[l] != newpoints[l - ps]
169
+ && newpoints[l + 1] != newpoints[l - ps + 1]) {
170
+ for (m = 0; m < ps; ++m)
171
+ newpoints[l + ps + m] = newpoints[l + m];
172
+ newpoints[l + 1] = newpoints[l - ps + 1];
173
+ }
174
+ }
175
+
176
+ datapoints.points = newpoints;
177
+ }
178
+
179
+ plot.hooks.processDatapoints.push(stackData);
180
+ }
181
+
182
+ $.plot.plugins.push({
183
+ init: init,
184
+ options: options,
185
+ name: 'stack',
186
+ version: '1.2'
187
+ });
188
+ })(jQuery);