iobroker.ebus 3.3.7 → 3.3.8

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 (38) hide show
  1. package/README.md +4 -0
  2. package/io-package.json +94 -14
  3. package/package.json +2 -1
  4. package/widgets/ebus/img/Prev_tplebus.png +0 -0
  5. package/widgets/ebus/lib/js/flot/jquery.canvaswrapper.js +549 -0
  6. package/widgets/ebus/lib/js/flot/jquery.colorhelpers.js +199 -0
  7. package/widgets/ebus/lib/js/flot/jquery.flot.axislabels.js +212 -0
  8. package/widgets/ebus/lib/js/flot/jquery.flot.browser.js +98 -0
  9. package/widgets/ebus/lib/js/flot/jquery.flot.categories.js +202 -0
  10. package/widgets/ebus/lib/js/flot/jquery.flot.composeImages.js +330 -0
  11. package/widgets/ebus/lib/js/flot/jquery.flot.crosshair.js +202 -0
  12. package/widgets/ebus/lib/js/flot/jquery.flot.drawSeries.js +662 -0
  13. package/widgets/ebus/lib/js/flot/jquery.flot.errorbars.js +375 -0
  14. package/widgets/ebus/lib/js/flot/jquery.flot.fillbetween.js +254 -0
  15. package/widgets/ebus/lib/js/flot/jquery.flot.flatdata.js +47 -0
  16. package/widgets/ebus/lib/js/flot/jquery.flot.hover.js +361 -0
  17. package/widgets/ebus/lib/js/flot/jquery.flot.image.js +249 -0
  18. package/widgets/ebus/lib/js/flot/jquery.flot.js +2953 -0
  19. package/widgets/ebus/lib/js/flot/jquery.flot.legend.js +437 -0
  20. package/widgets/ebus/lib/js/flot/jquery.flot.logaxis.js +298 -0
  21. package/widgets/ebus/lib/js/flot/jquery.flot.navigate.js +834 -0
  22. package/widgets/ebus/lib/js/flot/jquery.flot.pie.js +794 -0
  23. package/widgets/ebus/lib/js/flot/jquery.flot.resize.js +60 -0
  24. package/widgets/ebus/lib/js/flot/jquery.flot.saturated.js +43 -0
  25. package/widgets/ebus/lib/js/flot/jquery.flot.selection.js +527 -0
  26. package/widgets/ebus/lib/js/flot/jquery.flot.stack.js +220 -0
  27. package/widgets/ebus/lib/js/flot/jquery.flot.symbol.js +98 -0
  28. package/widgets/ebus/lib/js/flot/jquery.flot.threshold.js +143 -0
  29. package/widgets/ebus/lib/js/flot/jquery.flot.time.js +586 -0
  30. package/widgets/ebus/lib/js/flot/jquery.flot.touch.js +320 -0
  31. package/widgets/ebus/lib/js/flot/jquery.flot.touchNavigate.js +360 -0
  32. package/widgets/ebus/lib/js/flot/jquery.flot.uiConstants.js +10 -0
  33. package/widgets/ebus/lib/js/flot/jquery.js +9473 -0
  34. package/widgets/ebus/lib/js/lib/globalize.culture.en-US.js +33 -0
  35. package/widgets/ebus/lib/js/lib/globalize.js +1601 -0
  36. package/widgets/ebus/lib/js/lib/jquery.event.drag.js +145 -0
  37. package/widgets/ebus/lib/js/lib/jquery.mousewheel.js +86 -0
  38. package/widgets/ebus.html +2395 -0
@@ -0,0 +1,375 @@
1
+ /* Flot plugin for plotting error bars.
2
+
3
+ Copyright (c) 2007-2014 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ Error bars are used to show standard deviation and other statistical
7
+ properties in a plot.
8
+
9
+ * Created by Rui Pereira - rui (dot) pereira (at) gmail (dot) com
10
+
11
+ This plugin allows you to plot error-bars over points. Set "errorbars" inside
12
+ the points series to the axis name over which there will be error values in
13
+ your data array (*even* if you do not intend to plot them later, by setting
14
+ "show: null" on xerr/yerr).
15
+
16
+ The plugin supports these options:
17
+
18
+ series: {
19
+ points: {
20
+ errorbars: "x" or "y" or "xy",
21
+ xerr: {
22
+ show: null/false or true,
23
+ asymmetric: null/false or true,
24
+ upperCap: null or "-" or function,
25
+ lowerCap: null or "-" or function,
26
+ color: null or color,
27
+ radius: null or number
28
+ },
29
+ yerr: { same options as xerr }
30
+ }
31
+ }
32
+
33
+ Each data point array is expected to be of the type:
34
+
35
+ "x" [ x, y, xerr ]
36
+ "y" [ x, y, yerr ]
37
+ "xy" [ x, y, xerr, yerr ]
38
+
39
+ Where xerr becomes xerr_lower,xerr_upper for the asymmetric error case, and
40
+ equivalently for yerr. Eg., a datapoint for the "xy" case with symmetric
41
+ error-bars on X and asymmetric on Y would be:
42
+
43
+ [ x, y, xerr, yerr_lower, yerr_upper ]
44
+
45
+ By default no end caps are drawn. Setting upperCap and/or lowerCap to "-" will
46
+ draw a small cap perpendicular to the error bar. They can also be set to a
47
+ user-defined drawing function, with (ctx, x, y, radius) as parameters, as eg.
48
+
49
+ function drawSemiCircle( ctx, x, y, radius ) {
50
+ ctx.beginPath();
51
+ ctx.arc( x, y, radius, 0, Math.PI, false );
52
+ ctx.moveTo( x - radius, y );
53
+ ctx.lineTo( x + radius, y );
54
+ ctx.stroke();
55
+ }
56
+
57
+ Color and radius both default to the same ones of the points series if not
58
+ set. The independent radius parameter on xerr/yerr is useful for the case when
59
+ we may want to add error-bars to a line, without showing the interconnecting
60
+ points (with radius: 0), and still showing end caps on the error-bars.
61
+ shadowSize and lineWidth are derived as well from the points series.
62
+
63
+ */
64
+
65
+ (function ($) {
66
+ var options = {
67
+ series: {
68
+ points: {
69
+ errorbars: null, //should be 'x', 'y' or 'xy'
70
+ xerr: {err: 'x', show: null, asymmetric: null, upperCap: null, lowerCap: null, color: null, radius: null},
71
+ yerr: {err: 'y', show: null, asymmetric: null, upperCap: null, lowerCap: null, color: null, radius: null}
72
+ }
73
+ }
74
+ };
75
+
76
+ function processRawData(plot, series, data, datapoints) {
77
+ if (!series.points.errorbars) {
78
+ return;
79
+ }
80
+
81
+ // x,y values
82
+ var format = [
83
+ { x: true, number: true, required: true },
84
+ { y: true, number: true, required: true }
85
+ ];
86
+
87
+ var errors = series.points.errorbars;
88
+ // error bars - first X then Y
89
+ if (errors === 'x' || errors === 'xy') {
90
+ // lower / upper error
91
+ if (series.points.xerr.asymmetric) {
92
+ format.push({ x: true, number: true, required: true });
93
+ format.push({ x: true, number: true, required: true });
94
+ } else {
95
+ format.push({ x: true, number: true, required: true });
96
+ }
97
+ }
98
+ if (errors === 'y' || errors === 'xy') {
99
+ // lower / upper error
100
+ if (series.points.yerr.asymmetric) {
101
+ format.push({ y: true, number: true, required: true });
102
+ format.push({ y: true, number: true, required: true });
103
+ } else {
104
+ format.push({ y: true, number: true, required: true });
105
+ }
106
+ }
107
+ datapoints.format = format;
108
+ }
109
+
110
+ function parseErrors(series, i) {
111
+ var points = series.datapoints.points;
112
+
113
+ // read errors from points array
114
+ var exl = null,
115
+ exu = null,
116
+ eyl = null,
117
+ eyu = null;
118
+ var xerr = series.points.xerr,
119
+ yerr = series.points.yerr;
120
+
121
+ var eb = series.points.errorbars;
122
+ // error bars - first X
123
+ if (eb === 'x' || eb === 'xy') {
124
+ if (xerr.asymmetric) {
125
+ exl = points[i + 2];
126
+ exu = points[i + 3];
127
+ if (eb === 'xy') {
128
+ if (yerr.asymmetric) {
129
+ eyl = points[i + 4];
130
+ eyu = points[i + 5];
131
+ } else {
132
+ eyl = points[i + 4];
133
+ }
134
+ }
135
+ } else {
136
+ exl = points[i + 2];
137
+ if (eb === 'xy') {
138
+ if (yerr.asymmetric) {
139
+ eyl = points[i + 3];
140
+ eyu = points[i + 4];
141
+ } else {
142
+ eyl = points[i + 3];
143
+ }
144
+ }
145
+ }
146
+ // only Y
147
+ } else {
148
+ if (eb === 'y') {
149
+ if (yerr.asymmetric) {
150
+ eyl = points[i + 2];
151
+ eyu = points[i + 3];
152
+ } else {
153
+ eyl = points[i + 2];
154
+ }
155
+ }
156
+ }
157
+
158
+ // symmetric errors?
159
+ if (exu == null) exu = exl;
160
+ if (eyu == null) eyu = eyl;
161
+
162
+ var errRanges = [exl, exu, eyl, eyu];
163
+ // nullify if not showing
164
+ if (!xerr.show) {
165
+ errRanges[0] = null;
166
+ errRanges[1] = null;
167
+ }
168
+ if (!yerr.show) {
169
+ errRanges[2] = null;
170
+ errRanges[3] = null;
171
+ }
172
+ return errRanges;
173
+ }
174
+
175
+ function drawSeriesErrors(plot, ctx, s) {
176
+ var points = s.datapoints.points,
177
+ ps = s.datapoints.pointsize,
178
+ ax = [s.xaxis, s.yaxis],
179
+ radius = s.points.radius,
180
+ err = [s.points.xerr, s.points.yerr],
181
+ tmp;
182
+
183
+ //sanity check, in case some inverted axis hack is applied to flot
184
+ var invertX = false;
185
+ if (ax[0].p2c(ax[0].max) < ax[0].p2c(ax[0].min)) {
186
+ invertX = true;
187
+ tmp = err[0].lowerCap;
188
+ err[0].lowerCap = err[0].upperCap;
189
+ err[0].upperCap = tmp;
190
+ }
191
+
192
+ var invertY = false;
193
+ if (ax[1].p2c(ax[1].min) < ax[1].p2c(ax[1].max)) {
194
+ invertY = true;
195
+ tmp = err[1].lowerCap;
196
+ err[1].lowerCap = err[1].upperCap;
197
+ err[1].upperCap = tmp;
198
+ }
199
+
200
+ for (var i = 0; i < s.datapoints.points.length; i += ps) {
201
+ //parse
202
+ var errRanges = parseErrors(s, i);
203
+
204
+ //cycle xerr & yerr
205
+ for (var e = 0; e < err.length; e++) {
206
+ var minmax = [ax[e].min, ax[e].max];
207
+
208
+ //draw this error?
209
+ if (errRanges[e * err.length]) {
210
+ //data coordinates
211
+ var x = points[i],
212
+ y = points[i + 1];
213
+
214
+ //errorbar ranges
215
+ var upper = [x, y][e] + errRanges[e * err.length + 1],
216
+ lower = [x, y][e] - errRanges[e * err.length];
217
+
218
+ //points outside of the canvas
219
+ if (err[e].err === 'x') {
220
+ if (y > ax[1].max || y < ax[1].min || upper < ax[0].min || lower > ax[0].max) {
221
+ continue;
222
+ }
223
+ }
224
+
225
+ if (err[e].err === 'y') {
226
+ if (x > ax[0].max || x < ax[0].min || upper < ax[1].min || lower > ax[1].max) {
227
+ continue;
228
+ }
229
+ }
230
+
231
+ // prevent errorbars getting out of the canvas
232
+ var drawUpper = true,
233
+ drawLower = true;
234
+
235
+ if (upper > minmax[1]) {
236
+ drawUpper = false;
237
+ upper = minmax[1];
238
+ }
239
+ if (lower < minmax[0]) {
240
+ drawLower = false;
241
+ lower = minmax[0];
242
+ }
243
+
244
+ //sanity check, in case some inverted axis hack is applied to flot
245
+ if ((err[e].err === 'x' && invertX) || (err[e].err === 'y' && invertY)) {
246
+ //swap coordinates
247
+ tmp = lower;
248
+ lower = upper;
249
+ upper = tmp;
250
+ tmp = drawLower;
251
+ drawLower = drawUpper;
252
+ drawUpper = tmp;
253
+ tmp = minmax[0];
254
+ minmax[0] = minmax[1];
255
+ minmax[1] = tmp;
256
+ }
257
+
258
+ // convert to pixels
259
+ x = ax[0].p2c(x);
260
+ y = ax[1].p2c(y);
261
+ upper = ax[e].p2c(upper);
262
+ lower = ax[e].p2c(lower);
263
+ minmax[0] = ax[e].p2c(minmax[0]);
264
+ minmax[1] = ax[e].p2c(minmax[1]);
265
+
266
+ //same style as points by default
267
+ var lw = err[e].lineWidth ? err[e].lineWidth : s.points.lineWidth,
268
+ sw = s.points.shadowSize != null ? s.points.shadowSize : s.shadowSize;
269
+
270
+ //shadow as for points
271
+ if (lw > 0 && sw > 0) {
272
+ var w = sw / 2;
273
+ ctx.lineWidth = w;
274
+ ctx.strokeStyle = "rgba(0,0,0,0.1)";
275
+ drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w + w / 2, minmax);
276
+
277
+ ctx.strokeStyle = "rgba(0,0,0,0.2)";
278
+ drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, w / 2, minmax);
279
+ }
280
+
281
+ ctx.strokeStyle = err[e].color
282
+ ? err[e].color
283
+ : s.color;
284
+ ctx.lineWidth = lw;
285
+ //draw it
286
+ drawError(ctx, err[e], x, y, upper, lower, drawUpper, drawLower, radius, 0, minmax);
287
+ }
288
+ }
289
+ }
290
+ }
291
+
292
+ function drawError(ctx, err, x, y, upper, lower, drawUpper, drawLower, radius, offset, minmax) {
293
+ //shadow offset
294
+ y += offset;
295
+ upper += offset;
296
+ lower += offset;
297
+
298
+ // error bar - avoid plotting over circles
299
+ if (err.err === 'x') {
300
+ if (upper > x + radius) drawPath(ctx, [[upper, y], [Math.max(x + radius, minmax[0]), y]]);
301
+ else drawUpper = false;
302
+
303
+ if (lower < x - radius) drawPath(ctx, [[Math.min(x - radius, minmax[1]), y], [lower, y]]);
304
+ else drawLower = false;
305
+ } else {
306
+ if (upper < y - radius) drawPath(ctx, [[x, upper], [x, Math.min(y - radius, minmax[0])]]);
307
+ else drawUpper = false;
308
+
309
+ if (lower > y + radius) drawPath(ctx, [[x, Math.max(y + radius, minmax[1])], [x, lower]]);
310
+ else drawLower = false;
311
+ }
312
+
313
+ //internal radius value in errorbar, allows to plot radius 0 points and still keep proper sized caps
314
+ //this is a way to get errorbars on lines without visible connecting dots
315
+ radius = err.radius != null
316
+ ? err.radius
317
+ : radius;
318
+
319
+ // upper cap
320
+ if (drawUpper) {
321
+ if (err.upperCap === '-') {
322
+ if (err.err === 'x') drawPath(ctx, [[upper, y - radius], [upper, y + radius]]);
323
+ else drawPath(ctx, [[x - radius, upper], [x + radius, upper]]);
324
+ } else if ($.isFunction(err.upperCap)) {
325
+ if (err.err === 'x') err.upperCap(ctx, upper, y, radius);
326
+ else err.upperCap(ctx, x, upper, radius);
327
+ }
328
+ }
329
+ // lower cap
330
+ if (drawLower) {
331
+ if (err.lowerCap === '-') {
332
+ if (err.err === 'x') drawPath(ctx, [[lower, y - radius], [lower, y + radius]]);
333
+ else drawPath(ctx, [[x - radius, lower], [x + radius, lower]]);
334
+ } else if ($.isFunction(err.lowerCap)) {
335
+ if (err.err === 'x') err.lowerCap(ctx, lower, y, radius);
336
+ else err.lowerCap(ctx, x, lower, radius);
337
+ }
338
+ }
339
+ }
340
+
341
+ function drawPath(ctx, pts) {
342
+ ctx.beginPath();
343
+ ctx.moveTo(pts[0][0], pts[0][1]);
344
+ for (var p = 1; p < pts.length; p++) {
345
+ ctx.lineTo(pts[p][0], pts[p][1]);
346
+ }
347
+
348
+ ctx.stroke();
349
+ }
350
+
351
+ function draw(plot, ctx) {
352
+ var plotOffset = plot.getPlotOffset();
353
+
354
+ ctx.save();
355
+ ctx.translate(plotOffset.left, plotOffset.top);
356
+ $.each(plot.getData(), function (i, s) {
357
+ if (s.points.errorbars && (s.points.xerr.show || s.points.yerr.show)) {
358
+ drawSeriesErrors(plot, ctx, s);
359
+ }
360
+ });
361
+ ctx.restore();
362
+ }
363
+
364
+ function init(plot) {
365
+ plot.hooks.processRawData.push(processRawData);
366
+ plot.hooks.draw.push(draw);
367
+ }
368
+
369
+ $.plot.plugins.push({
370
+ init: init,
371
+ options: options,
372
+ name: 'errorbars',
373
+ version: '1.0'
374
+ });
375
+ })(jQuery);
@@ -0,0 +1,254 @@
1
+ /* Flot plugin for computing bottoms for filled line and bar charts.
2
+
3
+ Copyright (c) 2007-2014 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ The case: you've got two series that you want to fill the area between. In Flot
7
+ terms, you need to use one as the fill bottom of the other. You can specify the
8
+ bottom of each data point as the third coordinate manually, or you can use this
9
+ plugin to compute it for you.
10
+
11
+ In order to name the other series, you need to give it an id, like this:
12
+
13
+ var dataset = [
14
+ { data: [ ... ], id: "foo" } , // use default bottom
15
+ { data: [ ... ], fillBetween: "foo" }, // use first dataset as bottom
16
+ ];
17
+
18
+ $.plot($("#placeholder"), dataset, { lines: { show: true, fill: true }});
19
+
20
+ As a convenience, if the id given is a number that doesn't appear as an id in
21
+ the series, it is interpreted as the index in the array instead (so fillBetween:
22
+ 0 can also mean the first series).
23
+
24
+ Internally, the plugin modifies the datapoints in each series. For line series,
25
+ extra data points might be inserted through interpolation. Note that at points
26
+ where the bottom line is not defined (due to a null point or start/end of line),
27
+ the current line will show a gap too. The algorithm comes from the
28
+ jquery.flot.stack.js plugin, possibly some code could be shared.
29
+
30
+ */
31
+
32
+ (function ($) {
33
+ var options = {
34
+ series: {
35
+ fillBetween: null // or number
36
+ }
37
+ };
38
+
39
+ function init(plot) {
40
+ function findBottomSeries(s, allseries) {
41
+ var i;
42
+
43
+ for (i = 0; i < allseries.length; ++i) {
44
+ if (allseries[ i ].id === s.fillBetween) {
45
+ return allseries[ i ];
46
+ }
47
+ }
48
+
49
+ if (typeof s.fillBetween === "number") {
50
+ if (s.fillBetween < 0 || s.fillBetween >= allseries.length) {
51
+ return null;
52
+ }
53
+ return allseries[ s.fillBetween ];
54
+ }
55
+
56
+ return null;
57
+ }
58
+
59
+ function computeFormat(plot, s, data, datapoints) {
60
+ if (s.fillBetween == null) {
61
+ return;
62
+ }
63
+
64
+ var format = datapoints.format;
65
+ var plotHasId = function(id) {
66
+ var plotData = plot.getData();
67
+ for (var i = 0; i < plotData.length; i++) {
68
+ if (plotData[i].id === id) {
69
+ return true;
70
+ }
71
+ }
72
+
73
+ return false;
74
+ }
75
+
76
+ if (!format) {
77
+ format = [];
78
+
79
+ format.push({
80
+ x: true,
81
+ number: true,
82
+ computeRange: s.xaxis.options.autoScale !== 'none',
83
+ required: true
84
+ });
85
+ format.push({
86
+ y: true,
87
+ number: true,
88
+ computeRange: s.yaxis.options.autoScale !== 'none',
89
+ required: true
90
+ });
91
+
92
+ if (s.fillBetween !== undefined && s.fillBetween !== '' && plotHasId(s.fillBetween) && s.fillBetween !== s.id) {
93
+ format.push({
94
+ x: false,
95
+ y: true,
96
+ number: true,
97
+ required: false,
98
+ computeRange: s.yaxis.options.autoScale !== 'none',
99
+ defaultValue: 0
100
+ });
101
+ }
102
+
103
+ datapoints.format = format;
104
+ }
105
+ }
106
+
107
+ function computeFillBottoms(plot, s, datapoints) {
108
+ if (s.fillBetween == null) {
109
+ return;
110
+ }
111
+
112
+ var other = findBottomSeries(s, plot.getData());
113
+
114
+ if (!other) {
115
+ return;
116
+ }
117
+
118
+ var ps = datapoints.pointsize,
119
+ points = datapoints.points,
120
+ otherps = other.datapoints.pointsize,
121
+ otherpoints = other.datapoints.points,
122
+ newpoints = [],
123
+ px, py, intery, qx, qy, bottom,
124
+ withlines = s.lines.show,
125
+ withbottom = ps > 2 && datapoints.format[2].y,
126
+ withsteps = withlines && s.lines.steps,
127
+ fromgap = true,
128
+ i = 0,
129
+ j = 0,
130
+ l, m;
131
+
132
+ while (true) {
133
+ if (i >= points.length) {
134
+ break;
135
+ }
136
+
137
+ l = newpoints.length;
138
+
139
+ if (points[ i ] == null) {
140
+ // copy gaps
141
+ for (m = 0; m < ps; ++m) {
142
+ newpoints.push(points[ i + m ]);
143
+ }
144
+
145
+ i += ps;
146
+ } else if (j >= otherpoints.length) {
147
+ // for lines, we can't use the rest of the points
148
+ if (!withlines) {
149
+ for (m = 0; m < ps; ++m) {
150
+ newpoints.push(points[ i + m ]);
151
+ }
152
+ }
153
+
154
+ i += ps;
155
+ } else if (otherpoints[ j ] == null) {
156
+ // oops, got a gap
157
+ for (m = 0; m < ps; ++m) {
158
+ newpoints.push(null);
159
+ }
160
+
161
+ fromgap = true;
162
+ j += otherps;
163
+ } else {
164
+ // cases where we actually got two points
165
+ px = points[ i ];
166
+ py = points[ i + 1 ];
167
+ qx = otherpoints[ j ];
168
+ qy = otherpoints[ j + 1 ];
169
+ bottom = 0;
170
+
171
+ if (px === qx) {
172
+ for (m = 0; m < ps; ++m) {
173
+ newpoints.push(points[ i + m ]);
174
+ }
175
+
176
+ //newpoints[ l + 1 ] += qy;
177
+ bottom = qy;
178
+
179
+ i += ps;
180
+ j += otherps;
181
+ } else if (px > qx) {
182
+ // we got past point below, might need to
183
+ // insert interpolated extra point
184
+
185
+ if (withlines && i > 0 && points[ i - ps ] != null) {
186
+ intery = py + (points[ i - ps + 1 ] - py) * (qx - px) / (points[ i - ps ] - px);
187
+ newpoints.push(qx);
188
+ newpoints.push(intery);
189
+ for (m = 2; m < ps; ++m) {
190
+ newpoints.push(points[ i + m ]);
191
+ }
192
+ bottom = qy;
193
+ }
194
+
195
+ j += otherps;
196
+ } else {
197
+ // px < qx
198
+ // if we come from a gap, we just skip this point
199
+
200
+ if (fromgap && withlines) {
201
+ i += ps;
202
+ continue;
203
+ }
204
+
205
+ for (m = 0; m < ps; ++m) {
206
+ newpoints.push(points[ i + m ]);
207
+ }
208
+
209
+ // we might be able to interpolate a point below,
210
+ // this can give us a better y
211
+
212
+ if (withlines && j > 0 && otherpoints[ j - otherps ] != null) {
213
+ bottom = qy + (otherpoints[ j - otherps + 1 ] - qy) * (px - qx) / (otherpoints[ j - otherps ] - qx);
214
+ }
215
+
216
+ //newpoints[l + 1] += bottom;
217
+
218
+ i += ps;
219
+ }
220
+
221
+ fromgap = false;
222
+
223
+ if (l !== newpoints.length && withbottom) {
224
+ newpoints[ l + 2 ] = bottom;
225
+ }
226
+ }
227
+
228
+ // maintain the line steps invariant
229
+
230
+ if (withsteps && l !== newpoints.length && l > 0 &&
231
+ newpoints[ l ] !== null &&
232
+ newpoints[ l ] !== newpoints[ l - ps ] &&
233
+ newpoints[ l + 1 ] !== newpoints[ l - ps + 1 ]) {
234
+ for (m = 0; m < ps; ++m) {
235
+ newpoints[ l + ps + m ] = newpoints[ l + m ];
236
+ }
237
+ newpoints[ l + 1 ] = newpoints[ l - ps + 1 ];
238
+ }
239
+ }
240
+
241
+ datapoints.points = newpoints;
242
+ }
243
+
244
+ plot.hooks.processRawData.push(computeFormat);
245
+ plot.hooks.processDatapoints.push(computeFillBottoms);
246
+ }
247
+
248
+ $.plot.plugins.push({
249
+ init: init,
250
+ options: options,
251
+ name: "fillbetween",
252
+ version: "1.0"
253
+ });
254
+ })(jQuery);
@@ -0,0 +1,47 @@
1
+ /* Support for flat 1D data series.
2
+
3
+ A 1D flat data series is a data series in the form of a regular 1D array. The
4
+ main reason for using a flat data series is that it performs better, consumes
5
+ less memory and generates less garbage collection than the regular flot format.
6
+
7
+ Example:
8
+
9
+ plot.setData([[[0,0], [1,1], [2,2], [3,3]]]); // regular flot format
10
+ plot.setData([{flatdata: true, data: [0, 1, 2, 3]}]); // flatdata format
11
+
12
+ Set series.flatdata to true to enable this plugin.
13
+
14
+ You can use series.start to specify the starting index of the series (default is 0)
15
+ You can use series.step to specify the interval between consecutive indexes of the series (default is 1)
16
+ */
17
+
18
+ /* global jQuery*/
19
+
20
+ (function ($) {
21
+ 'use strict';
22
+
23
+ function process1DRawData(plot, series, data, datapoints) {
24
+ if (series.flatdata === true) {
25
+ var start = series.start || 0;
26
+ var step = typeof series.step === 'number' ? series.step : 1;
27
+ datapoints.pointsize = 2;
28
+ for (var i = 0, j = 0; i < data.length; i++, j += 2) {
29
+ datapoints.points[j] = start + (i * step);
30
+ datapoints.points[j + 1] = data[i];
31
+ }
32
+ if (datapoints.points !== undefined) {
33
+ datapoints.points.length = data.length * 2;
34
+ } else {
35
+ datapoints.points = [];
36
+ }
37
+ }
38
+ }
39
+
40
+ $.plot.plugins.push({
41
+ init: function(plot) {
42
+ plot.hooks.processRawData.push(process1DRawData);
43
+ },
44
+ name: 'flatdata',
45
+ version: '0.0.2'
46
+ });
47
+ })(jQuery);