flot-rails 0.0.3 → 0.0.4

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 (36) hide show
  1. data/lib/flot/rails/version.rb +2 -2
  2. data/vendor/assets/javascripts/excanvas.js +1428 -1428
  3. data/vendor/assets/javascripts/excanvas.min.js +0 -0
  4. data/vendor/assets/javascripts/jquery.colorhelpers.js +179 -179
  5. data/vendor/assets/javascripts/jquery.colorhelpers.min.js +0 -0
  6. data/vendor/assets/javascripts/jquery.flot.canvas.js +345 -317
  7. data/vendor/assets/javascripts/jquery.flot.canvas.min.js +1 -1
  8. data/vendor/assets/javascripts/jquery.flot.categories.js +190 -190
  9. data/vendor/assets/javascripts/jquery.flot.categories.min.js +0 -0
  10. data/vendor/assets/javascripts/jquery.flot.crosshair.js +176 -176
  11. data/vendor/assets/javascripts/jquery.flot.crosshair.min.js +0 -0
  12. data/vendor/assets/javascripts/jquery.flot.errorbars.js +353 -353
  13. data/vendor/assets/javascripts/jquery.flot.errorbars.min.js +0 -0
  14. data/vendor/assets/javascripts/jquery.flot.fillbetween.js +226 -226
  15. data/vendor/assets/javascripts/jquery.flot.fillbetween.min.js +0 -0
  16. data/vendor/assets/javascripts/jquery.flot.image.js +241 -241
  17. data/vendor/assets/javascripts/jquery.flot.image.min.js +0 -0
  18. data/vendor/assets/javascripts/jquery.flot.js +3061 -2980
  19. data/vendor/assets/javascripts/jquery.flot.min.js +5 -4
  20. data/vendor/assets/javascripts/jquery.flot.navigate.js +346 -345
  21. data/vendor/assets/javascripts/jquery.flot.navigate.min.js +86 -96
  22. data/vendor/assets/javascripts/jquery.flot.pie.js +817 -812
  23. data/vendor/assets/javascripts/jquery.flot.pie.min.js +1 -1
  24. data/vendor/assets/javascripts/jquery.flot.resize.js +60 -60
  25. data/vendor/assets/javascripts/jquery.flot.resize.min.js +19 -21
  26. data/vendor/assets/javascripts/jquery.flot.selection.js +360 -360
  27. data/vendor/assets/javascripts/jquery.flot.selection.min.js +0 -0
  28. data/vendor/assets/javascripts/jquery.flot.stack.js +188 -188
  29. data/vendor/assets/javascripts/jquery.flot.stack.min.js +0 -0
  30. data/vendor/assets/javascripts/jquery.flot.symbol.js +71 -71
  31. data/vendor/assets/javascripts/jquery.flot.symbol.min.js +0 -0
  32. data/vendor/assets/javascripts/jquery.flot.threshold.js +142 -142
  33. data/vendor/assets/javascripts/jquery.flot.threshold.min.js +0 -0
  34. data/vendor/assets/javascripts/jquery.flot.time.js +431 -424
  35. data/vendor/assets/javascripts/jquery.flot.time.min.js +1 -1
  36. metadata +5 -3
@@ -1,188 +1,188 @@
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);
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);
@@ -1,71 +1,71 @@
1
- /* Flot plugin that adds some extra symbols for plotting points.
2
-
3
- Copyright (c) 2007-2013 IOLA and Ole Laursen.
4
- Licensed under the MIT license.
5
-
6
- The symbols are accessed as strings through the standard symbol options:
7
-
8
- series: {
9
- points: {
10
- symbol: "square" // or "diamond", "triangle", "cross"
11
- }
12
- }
13
-
14
- */
15
-
16
- (function ($) {
17
- function processRawData(plot, series, datapoints) {
18
- // we normalize the area of each symbol so it is approximately the
19
- // same as a circle of the given radius
20
-
21
- var handlers = {
22
- square: function (ctx, x, y, radius, shadow) {
23
- // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
24
- var size = radius * Math.sqrt(Math.PI) / 2;
25
- ctx.rect(x - size, y - size, size + size, size + size);
26
- },
27
- diamond: function (ctx, x, y, radius, shadow) {
28
- // pi * r^2 = 2s^2 => s = r * sqrt(pi/2)
29
- var size = radius * Math.sqrt(Math.PI / 2);
30
- ctx.moveTo(x - size, y);
31
- ctx.lineTo(x, y - size);
32
- ctx.lineTo(x + size, y);
33
- ctx.lineTo(x, y + size);
34
- ctx.lineTo(x - size, y);
35
- },
36
- triangle: function (ctx, x, y, radius, shadow) {
37
- // pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))
38
- var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));
39
- var height = size * Math.sin(Math.PI / 3);
40
- ctx.moveTo(x - size/2, y + height/2);
41
- ctx.lineTo(x + size/2, y + height/2);
42
- if (!shadow) {
43
- ctx.lineTo(x, y - height/2);
44
- ctx.lineTo(x - size/2, y + height/2);
45
- }
46
- },
47
- cross: function (ctx, x, y, radius, shadow) {
48
- // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
49
- var size = radius * Math.sqrt(Math.PI) / 2;
50
- ctx.moveTo(x - size, y - size);
51
- ctx.lineTo(x + size, y + size);
52
- ctx.moveTo(x - size, y + size);
53
- ctx.lineTo(x + size, y - size);
54
- }
55
- };
56
-
57
- var s = series.points.symbol;
58
- if (handlers[s])
59
- series.points.symbol = handlers[s];
60
- }
61
-
62
- function init(plot) {
63
- plot.hooks.processDatapoints.push(processRawData);
64
- }
65
-
66
- $.plot.plugins.push({
67
- init: init,
68
- name: 'symbols',
69
- version: '1.0'
70
- });
71
- })(jQuery);
1
+ /* Flot plugin that adds some extra symbols for plotting points.
2
+
3
+ Copyright (c) 2007-2013 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ The symbols are accessed as strings through the standard symbol options:
7
+
8
+ series: {
9
+ points: {
10
+ symbol: "square" // or "diamond", "triangle", "cross"
11
+ }
12
+ }
13
+
14
+ */
15
+
16
+ (function ($) {
17
+ function processRawData(plot, series, datapoints) {
18
+ // we normalize the area of each symbol so it is approximately the
19
+ // same as a circle of the given radius
20
+
21
+ var handlers = {
22
+ square: function (ctx, x, y, radius, shadow) {
23
+ // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
24
+ var size = radius * Math.sqrt(Math.PI) / 2;
25
+ ctx.rect(x - size, y - size, size + size, size + size);
26
+ },
27
+ diamond: function (ctx, x, y, radius, shadow) {
28
+ // pi * r^2 = 2s^2 => s = r * sqrt(pi/2)
29
+ var size = radius * Math.sqrt(Math.PI / 2);
30
+ ctx.moveTo(x - size, y);
31
+ ctx.lineTo(x, y - size);
32
+ ctx.lineTo(x + size, y);
33
+ ctx.lineTo(x, y + size);
34
+ ctx.lineTo(x - size, y);
35
+ },
36
+ triangle: function (ctx, x, y, radius, shadow) {
37
+ // pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3))
38
+ var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3));
39
+ var height = size * Math.sin(Math.PI / 3);
40
+ ctx.moveTo(x - size/2, y + height/2);
41
+ ctx.lineTo(x + size/2, y + height/2);
42
+ if (!shadow) {
43
+ ctx.lineTo(x, y - height/2);
44
+ ctx.lineTo(x - size/2, y + height/2);
45
+ }
46
+ },
47
+ cross: function (ctx, x, y, radius, shadow) {
48
+ // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2
49
+ var size = radius * Math.sqrt(Math.PI) / 2;
50
+ ctx.moveTo(x - size, y - size);
51
+ ctx.lineTo(x + size, y + size);
52
+ ctx.moveTo(x - size, y + size);
53
+ ctx.lineTo(x + size, y - size);
54
+ }
55
+ };
56
+
57
+ var s = series.points.symbol;
58
+ if (handlers[s])
59
+ series.points.symbol = handlers[s];
60
+ }
61
+
62
+ function init(plot) {
63
+ plot.hooks.processDatapoints.push(processRawData);
64
+ }
65
+
66
+ $.plot.plugins.push({
67
+ init: init,
68
+ name: 'symbols',
69
+ version: '1.0'
70
+ });
71
+ })(jQuery);