iobroker.ebus 2.4.3 → 2.5.1
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.
- package/README.md +15 -1
- package/admin/index_m.html +7 -23
- package/admin/words.js +1 -0
- package/io-package.json +51 -2
- package/main.js +22 -6
- package/package.json +9 -9
- package/widgets/ebus/lib/js/flot/jquery.canvaswrapper.js +7 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.axislabels.js +215 -0
- package/widgets/ebus/lib/js/flot/jquery.flot.drawSeries.js +3 -4
- package/widgets/ebus/lib/js/flot/jquery.flot.fillbetween.js +12 -12
- package/widgets/ebus/lib/js/flot/jquery.flot.hover.js +7 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.js +49 -56
- package/widgets/ebus/lib/js/flot/jquery.flot.legend.js +2 -2
- package/widgets/ebus/lib/js/flot/jquery.flot.logaxis.js +3 -3
- package/widgets/ebus/lib/js/flot/jquery.flot.navigate.js +44 -8
- package/widgets/ebus/lib/js/flot/jquery.flot.resize.js +1 -1
- package/widgets/ebus/lib/js/flot/jquery.flot.selection.js +11 -1
- package/widgets/ebus/lib/js/flot/jquery.flot.stack.js +3 -3
- package/widgets/ebus/lib/js/flot/jquery.flot.time.js +110 -108
- package/widgets/ebus/lib/js/flot/jquery.flot.touchNavigate.js +1 -1
- package/widgets/ebus.html +106 -95
|
@@ -826,8 +826,8 @@ Licensed under the MIT license.
|
|
|
826
826
|
var expectedPs = s.datapoints.pointsize != null ? s.datapoints.pointsize : (s.data && s.data[0] && s.data[0].length ? s.data[0].length : 3);
|
|
827
827
|
if (expectedPs > 2) {
|
|
828
828
|
format.push({
|
|
829
|
-
x:
|
|
830
|
-
y:
|
|
829
|
+
x: s.bars.horizontal,
|
|
830
|
+
y: !s.bars.horizontal,
|
|
831
831
|
number: true,
|
|
832
832
|
required: false,
|
|
833
833
|
computeRange: s.yaxis.options.autoScale !== 'none',
|
|
@@ -847,8 +847,6 @@ Licensed under the MIT license.
|
|
|
847
847
|
ps = s.datapoints.pointsize;
|
|
848
848
|
points = s.datapoints.points;
|
|
849
849
|
|
|
850
|
-
var insertSteps = s.lines.show && s.lines.steps;
|
|
851
|
-
|
|
852
850
|
for (j = k = 0; j < data.length; ++j, k += ps) {
|
|
853
851
|
p = data[j];
|
|
854
852
|
|
|
@@ -980,8 +978,8 @@ Licensed under the MIT license.
|
|
|
980
978
|
var eventList = eventManager[key] || [];
|
|
981
979
|
|
|
982
980
|
eventList.push({"event": event, "handler": handler, "eventHolder": eventHolder, "priority": priority});
|
|
983
|
-
eventList.sort((a, b) => b.priority - a.priority
|
|
984
|
-
eventList.forEach(
|
|
981
|
+
eventList.sort((a, b) => b.priority - a.priority);
|
|
982
|
+
eventList.forEach(eventData => {
|
|
985
983
|
eventData.eventHolder.unbind(eventData.event, eventData.handler);
|
|
986
984
|
eventData.eventHolder.bind(eventData.event, eventData.handler);
|
|
987
985
|
});
|
|
@@ -1346,8 +1344,6 @@ Licensed under the MIT license.
|
|
|
1346
1344
|
setTransformationHelpers(axis);
|
|
1347
1345
|
setEndpointTicks(axis, series);
|
|
1348
1346
|
|
|
1349
|
-
console.log('+++');
|
|
1350
|
-
|
|
1351
1347
|
// find labelWidth/Height for axis
|
|
1352
1348
|
measureTickLabels(axis);
|
|
1353
1349
|
});
|
|
@@ -1765,7 +1761,7 @@ Licensed under the MIT license.
|
|
|
1765
1761
|
}
|
|
1766
1762
|
if (axis.options.showTickLabels === 'all') {
|
|
1767
1763
|
var associatedSeries = series.filter(function(s) {
|
|
1768
|
-
return s.xaxis === axis;
|
|
1764
|
+
return s.bars.horizontal ? s.yaxis === axis : s.xaxis === axis;
|
|
1769
1765
|
}),
|
|
1770
1766
|
notAllBarSeries = associatedSeries.some(function(s) {
|
|
1771
1767
|
return !s.bars.show;
|
|
@@ -1781,40 +1777,38 @@ Licensed under the MIT license.
|
|
|
1781
1777
|
surface.clear();
|
|
1782
1778
|
executeHooks(hooks.drawBackground, [ctx]);
|
|
1783
1779
|
|
|
1780
|
+
|
|
1784
1781
|
var grid = options.grid;
|
|
1785
|
-
|
|
1782
|
+
|
|
1786
1783
|
// draw background, if any
|
|
1787
1784
|
if (grid.show && grid.backgroundColor) {
|
|
1788
1785
|
drawBackground();
|
|
1789
1786
|
}
|
|
1790
|
-
|
|
1787
|
+
|
|
1791
1788
|
if (grid.show && !grid.aboveData) {
|
|
1792
1789
|
drawGrid();
|
|
1793
1790
|
}
|
|
1794
|
-
|
|
1791
|
+
|
|
1795
1792
|
for (var i = 0; i < series.length; ++i) {
|
|
1796
1793
|
executeHooks(hooks.drawSeries, [ctx, series[i], i, getColorOrGradient]);
|
|
1797
1794
|
drawSeries(series[i]);
|
|
1798
1795
|
}
|
|
1799
|
-
|
|
1796
|
+
|
|
1800
1797
|
executeHooks(hooks.draw, [ctx]);
|
|
1801
|
-
|
|
1798
|
+
|
|
1802
1799
|
if (grid.show && grid.aboveData) {
|
|
1803
1800
|
drawGrid();
|
|
1804
1801
|
}
|
|
1805
|
-
|
|
1802
|
+
|
|
1806
1803
|
surface.render();
|
|
1807
|
-
|
|
1804
|
+
|
|
1808
1805
|
// A draw implies that either the axes or data have changed, so we
|
|
1809
1806
|
// should probably update the overlay highlights as well.
|
|
1810
1807
|
triggerRedrawOverlay();
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
ShowTickLabels();
|
|
1814
|
-
|
|
1815
1808
|
|
|
1816
|
-
|
|
1809
|
+
ShowTickLabels();
|
|
1817
1810
|
|
|
1811
|
+
}
|
|
1818
1812
|
|
|
1819
1813
|
//*******************************************************************
|
|
1820
1814
|
// this is to overcome problem with colored ticks and axis labels
|
|
@@ -1930,8 +1924,6 @@ Licensed under the MIT license.
|
|
|
1930
1924
|
});
|
|
1931
1925
|
}
|
|
1932
1926
|
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
1927
|
function extractRange(ranges, coord) {
|
|
1936
1928
|
var axis, from, to, key, axes = allAxes();
|
|
1937
1929
|
|
|
@@ -2385,6 +2377,9 @@ Licensed under the MIT license.
|
|
|
2385
2377
|
});
|
|
2386
2378
|
},
|
|
2387
2379
|
drawAxisLabel = function (tick, labelBoxes) {
|
|
2380
|
+
|
|
2381
|
+
console.log('drawAxisLabel called');
|
|
2382
|
+
|
|
2388
2383
|
if (!tick || !tick.label || tick.v < axis.min || tick.v > axis.max) {
|
|
2389
2384
|
return nullBox;
|
|
2390
2385
|
}
|
|
@@ -2434,35 +2429,33 @@ Licensed under the MIT license.
|
|
|
2434
2429
|
return;
|
|
2435
2430
|
}
|
|
2436
2431
|
|
|
2437
|
-
/*
|
|
2438
|
-
var ctx = surface.context;
|
|
2439
|
-
ctx.fillStyle = "red";
|
|
2440
|
-
ctx.textAlign = "center";
|
|
2441
|
-
ctx.font = "8px Arial";
|
|
2442
|
-
*/
|
|
2443
2432
|
switch (axis.options.showTickLabels) {
|
|
2444
2433
|
case 'none':
|
|
2445
2434
|
break;
|
|
2446
2435
|
case 'endpoints':
|
|
2447
|
-
|
|
2436
|
+
//*******************************************************************
|
|
2437
|
+
// this is to overcome problem with colored ticks and axis labels
|
|
2438
|
+
// xxx
|
|
2439
|
+
//*******************************************************************
|
|
2448
2440
|
//labelBoxes.push(drawAxisLabel(axis.ticks[0], labelBoxes));
|
|
2449
2441
|
//labelBoxes.push(drawAxisLabel(axis.ticks[axis.ticks.length - 1], labelBoxes));
|
|
2450
2442
|
break;
|
|
2451
2443
|
case 'major':
|
|
2452
|
-
|
|
2444
|
+
//*******************************************************************
|
|
2445
|
+
// this is to overcome problem with colored ticks and axis labels
|
|
2446
|
+
// xxx
|
|
2447
|
+
//*******************************************************************
|
|
2453
2448
|
//labelBoxes.push(drawAxisLabel(axis.ticks[0], labelBoxes));
|
|
2454
2449
|
//labelBoxes.push(drawAxisLabel(axis.ticks[axis.ticks.length - 1], labelBoxes));
|
|
2455
2450
|
for (i = 1; i < axis.ticks.length - 1; ++i) {
|
|
2456
2451
|
//labelBoxes.push(drawAxisLabel(axis.ticks[i], labelBoxes));
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
//ctx.fillText(axis.ticks[i].label, 10, 50);
|
|
2461
|
-
|
|
2462
2452
|
}
|
|
2463
2453
|
break;
|
|
2464
2454
|
case 'all':
|
|
2465
|
-
|
|
2455
|
+
//*******************************************************************
|
|
2456
|
+
// this is to overcome problem with colored ticks and axis labels
|
|
2457
|
+
// xxx
|
|
2458
|
+
//*******************************************************************
|
|
2466
2459
|
//labelBoxes.push(drawAxisLabel(axis.ticks[0], []));
|
|
2467
2460
|
//labelBoxes.push(drawAxisLabel(axis.ticks[axis.ticks.length - 1], labelBoxes));
|
|
2468
2461
|
for (i = 1; i < axis.ticks.length - 1; ++i) {
|
|
@@ -2470,7 +2463,6 @@ Licensed under the MIT license.
|
|
|
2470
2463
|
}
|
|
2471
2464
|
break;
|
|
2472
2465
|
}
|
|
2473
|
-
|
|
2474
2466
|
});
|
|
2475
2467
|
}
|
|
2476
2468
|
|
|
@@ -2576,8 +2568,7 @@ Licensed under the MIT license.
|
|
|
2576
2568
|
if (series.bars.horizontal) {
|
|
2577
2569
|
range.ymin += delta;
|
|
2578
2570
|
range.ymax += delta + barWidth;
|
|
2579
|
-
}
|
|
2580
|
-
else {
|
|
2571
|
+
} else {
|
|
2581
2572
|
range.xmin += delta;
|
|
2582
2573
|
range.xmax += delta + barWidth;
|
|
2583
2574
|
}
|
|
@@ -2606,7 +2597,7 @@ Licensed under the MIT license.
|
|
|
2606
2597
|
}
|
|
2607
2598
|
|
|
2608
2599
|
var start = series.bars.horizontal ? 1 : 0;
|
|
2609
|
-
for (
|
|
2600
|
+
for (let j = start; j < series.datapoints.points.length; j += pointsize) {
|
|
2610
2601
|
if (isFinite(series.datapoints.points[j]) && series.datapoints.points[j] !== null) {
|
|
2611
2602
|
xValues.push(series.datapoints.points[j]);
|
|
2612
2603
|
}
|
|
@@ -2616,10 +2607,10 @@ Licensed under the MIT license.
|
|
|
2616
2607
|
return self.indexOf(value) === index;
|
|
2617
2608
|
}
|
|
2618
2609
|
|
|
2619
|
-
xValues = xValues.filter(
|
|
2620
|
-
xValues.sort(function(a, b){return a - b});
|
|
2610
|
+
xValues = xValues.filter(onlyUnique);
|
|
2611
|
+
xValues.sort(function(a, b) { return a - b });
|
|
2621
2612
|
|
|
2622
|
-
for (
|
|
2613
|
+
for (let j = 1; j < xValues.length; j++) {
|
|
2623
2614
|
var distance = Math.abs(xValues[j] - xValues[j - 1]);
|
|
2624
2615
|
if (distance < minDistance && isFinite(distance)) {
|
|
2625
2616
|
minDistance = distance;
|
|
@@ -2641,21 +2632,21 @@ Licensed under the MIT license.
|
|
|
2641
2632
|
}
|
|
2642
2633
|
}
|
|
2643
2634
|
|
|
2644
|
-
return items.sort((a, b) => {
|
|
2635
|
+
return items.sort((a, b) => {
|
|
2645
2636
|
if (b.distance === undefined) {
|
|
2646
2637
|
return -1;
|
|
2647
2638
|
} else if (a.distance === undefined && b.distance !== undefined) {
|
|
2648
2639
|
return 1;
|
|
2649
2640
|
}
|
|
2650
2641
|
|
|
2651
|
-
return a.distance - b.distance
|
|
2642
|
+
return a.distance - b.distance;
|
|
2652
2643
|
});
|
|
2653
2644
|
}
|
|
2654
2645
|
|
|
2655
2646
|
function findNearbyItem(mouseX, mouseY, seriesFilter, radius, computeDistance) {
|
|
2656
2647
|
var items = findNearbyItems(mouseX, mouseY, seriesFilter, radius, computeDistance);
|
|
2657
2648
|
return items[0] !== undefined ? items[0] : null;
|
|
2658
|
-
|
|
2649
|
+
}
|
|
2659
2650
|
|
|
2660
2651
|
// returns the data item the mouse is over/ the cursor is closest to, or null if none is found
|
|
2661
2652
|
function findItems(mouseX, mouseY, seriesFilter, radius, computeDistance) {
|
|
@@ -2689,7 +2680,7 @@ Licensed under the MIT license.
|
|
|
2689
2680
|
for (i = 0; i < items.length; i++) {
|
|
2690
2681
|
var seriesIndex = items[i].seriesIndex;
|
|
2691
2682
|
var dataIndex = items[i].dataIndex;
|
|
2692
|
-
var
|
|
2683
|
+
var itemDistance = items[i].distance;
|
|
2693
2684
|
var ps = series[seriesIndex].datapoints.pointsize;
|
|
2694
2685
|
|
|
2695
2686
|
foundItems.push({
|
|
@@ -2697,7 +2688,7 @@ Licensed under the MIT license.
|
|
|
2697
2688
|
dataIndex: dataIndex,
|
|
2698
2689
|
series: series[seriesIndex],
|
|
2699
2690
|
seriesIndex: seriesIndex,
|
|
2700
|
-
distance: Math.sqrt(
|
|
2691
|
+
distance: Math.sqrt(itemDistance)
|
|
2701
2692
|
});
|
|
2702
2693
|
}
|
|
2703
2694
|
|
|
@@ -2780,17 +2771,19 @@ Licensed under the MIT license.
|
|
|
2780
2771
|
var foundIndex = -1;
|
|
2781
2772
|
for (var j = 0; j < points.length; j += ps) {
|
|
2782
2773
|
var x = points[j], y = points[j + 1];
|
|
2783
|
-
if (x == null)
|
|
2774
|
+
if (x == null) {
|
|
2784
2775
|
continue;
|
|
2776
|
+
}
|
|
2785
2777
|
|
|
2786
2778
|
var bottom = ps === 3 ? points[j + 2] : defaultBottom;
|
|
2787
2779
|
// for a bar graph, the cursor must be inside the bar
|
|
2788
|
-
if (series.bars.horizontal
|
|
2789
|
-
(mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) &&
|
|
2790
|
-
my >= y + barLeft && my <= y + barRight)
|
|
2791
|
-
(mx >= x + barLeft && mx <= x + barRight &&
|
|
2792
|
-
my >= Math.min(bottom, y) && my <= Math.max(bottom, y)))
|
|
2793
|
-
|
|
2780
|
+
if (series.bars.horizontal
|
|
2781
|
+
? (mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) &&
|
|
2782
|
+
my >= y + barLeft && my <= y + barRight)
|
|
2783
|
+
: (mx >= x + barLeft && mx <= x + barRight &&
|
|
2784
|
+
my >= Math.min(bottom, y) && my <= Math.max(bottom, y))) {
|
|
2785
|
+
foundIndex = j / ps;
|
|
2786
|
+
}
|
|
2794
2787
|
}
|
|
2795
2788
|
|
|
2796
2789
|
return foundIndex;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
var columnWidths = [];
|
|
53
53
|
var style = window.getComputedStyle(document.querySelector('body'));
|
|
54
54
|
for (i = 0; i < entries.length; ++i) {
|
|
55
|
-
|
|
55
|
+
let columnIndex = i % options.legend.noColumns;
|
|
56
56
|
entry = entries[i];
|
|
57
57
|
shape.label = entry.label;
|
|
58
58
|
var info = plot.getSurface().getTextInfo('', shape.label, {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
// Generate html for icons and labels from a list of entries
|
|
80
80
|
for (i = 0; i < entries.length; ++i) {
|
|
81
|
-
|
|
81
|
+
let columnIndex = i % options.legend.noColumns;
|
|
82
82
|
entry = entries[i];
|
|
83
83
|
iconHtml = '';
|
|
84
84
|
shape.label = entry.label;
|
|
@@ -249,9 +249,9 @@ formatters and transformers to and from logarithmic representation.
|
|
|
249
249
|
.map(function(series) {
|
|
250
250
|
return plot.computeRangeForDataSeries(series, null, isValid);
|
|
251
251
|
}),
|
|
252
|
-
min = axis.direction === 'x'
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
min = axis.direction === 'x'
|
|
253
|
+
? Math.min(0.1, range && range[0] ? range[0].xmin : 0.1)
|
|
254
|
+
: Math.min(0.1, range && range[0] ? range[0].ymin : 0.1);
|
|
255
255
|
|
|
256
256
|
axis.min = min;
|
|
257
257
|
|
|
@@ -38,7 +38,9 @@ The plugin supports these options:
|
|
|
38
38
|
axisZoom: true, //zoom axis when mouse over it is allowed
|
|
39
39
|
plotZoom: true, //zoom axis is allowed for plot zoom
|
|
40
40
|
axisPan: true, //pan axis when mouse over it is allowed
|
|
41
|
-
plotPan: true //pan axis is allowed for plot pan
|
|
41
|
+
plotPan: true, //pan axis is allowed for plot pan
|
|
42
|
+
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units
|
|
43
|
+
zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
yaxis: {
|
|
@@ -46,6 +48,8 @@ The plugin supports these options:
|
|
|
46
48
|
plotZoom: true, //zoom axis is allowed for plot zoom
|
|
47
49
|
axisPan: true, //pan axis when mouse over it is allowed
|
|
48
50
|
plotPan: true //pan axis is allowed for plot pan
|
|
51
|
+
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units
|
|
52
|
+
zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units
|
|
49
53
|
}
|
|
50
54
|
```
|
|
51
55
|
**interactive** enables the built-in drag/click behaviour. If you enable
|
|
@@ -124,13 +128,17 @@ can set the default in the options.
|
|
|
124
128
|
axisZoom: true, //zoom axis when mouse over it is allowed
|
|
125
129
|
plotZoom: true, //zoom axis is allowed for plot zoom
|
|
126
130
|
axisPan: true, //pan axis when mouse over it is allowed
|
|
127
|
-
plotPan: true //pan axis is allowed for plot pan
|
|
131
|
+
plotPan: true, //pan axis is allowed for plot pan
|
|
132
|
+
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units
|
|
133
|
+
zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units
|
|
128
134
|
},
|
|
129
135
|
yaxis: {
|
|
130
136
|
axisZoom: true,
|
|
131
137
|
plotZoom: true,
|
|
132
138
|
axisPan: true,
|
|
133
|
-
plotPan: true
|
|
139
|
+
plotPan: true,
|
|
140
|
+
panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units
|
|
141
|
+
zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units
|
|
134
142
|
}
|
|
135
143
|
};
|
|
136
144
|
|
|
@@ -282,10 +290,10 @@ can set the default in the options.
|
|
|
282
290
|
prevDragPosition.y = page.Y;
|
|
283
291
|
}
|
|
284
292
|
}
|
|
285
|
-
|
|
293
|
+
|
|
286
294
|
function onDrag(e) {
|
|
287
|
-
if (!isPanAction) {
|
|
288
|
-
return;
|
|
295
|
+
if (!isPanAction) {
|
|
296
|
+
return;
|
|
289
297
|
}
|
|
290
298
|
|
|
291
299
|
var page = browser.getPageXY(e);
|
|
@@ -332,8 +340,8 @@ can set the default in the options.
|
|
|
332
340
|
}
|
|
333
341
|
|
|
334
342
|
function onDragEnd(e) {
|
|
335
|
-
if (!isPanAction) {
|
|
336
|
-
return;
|
|
343
|
+
if (!isPanAction) {
|
|
344
|
+
return;
|
|
337
345
|
}
|
|
338
346
|
|
|
339
347
|
if (panTimeout) {
|
|
@@ -490,6 +498,18 @@ can set the default in the options.
|
|
|
490
498
|
max = tmp;
|
|
491
499
|
}
|
|
492
500
|
|
|
501
|
+
// test for zoom limits zoomRange: [min,max]
|
|
502
|
+
if (opts.zoomRange) {
|
|
503
|
+
// zoomed in too far
|
|
504
|
+
if (max - min < opts.zoomRange[0]) {
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
// zoomed out to far
|
|
508
|
+
if (max - min > opts.zoomRange[1]) {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
493
513
|
var offsetBelow = $.plot.saturated.saturate(navigationOffset.below - (axis.min - min));
|
|
494
514
|
var offsetAbove = $.plot.saturated.saturate(navigationOffset.above - (axis.max - max));
|
|
495
515
|
opts.offset = { below: offsetBelow, above: offsetAbove };
|
|
@@ -521,6 +541,14 @@ can set the default in the options.
|
|
|
521
541
|
return;
|
|
522
542
|
}
|
|
523
543
|
|
|
544
|
+
// calc min delta (revealing left edge of plot)
|
|
545
|
+
var minD = axis.p2c(opts.panRange[0]) - axis.p2c(axis.min);
|
|
546
|
+
// calc max delta (revealing right edge of plot)
|
|
547
|
+
var maxD = axis.p2c(opts.panRange[1]) - axis.p2c(axis.max);
|
|
548
|
+
// limit delta to min or max if enabled
|
|
549
|
+
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD;
|
|
550
|
+
if (opts.panRange[1] !== undefined && d <= minD) d = minD;
|
|
551
|
+
|
|
524
552
|
if (d !== 0) {
|
|
525
553
|
var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axis.min) + d) - axis.c2p(axis.p2c(axis.min))),
|
|
526
554
|
navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axis.max) + d) - axis.c2p(axis.p2c(axis.max)));
|
|
@@ -675,6 +703,14 @@ can set the default in the options.
|
|
|
675
703
|
return;
|
|
676
704
|
}
|
|
677
705
|
|
|
706
|
+
// calc min delta (revealing left edge of plot)
|
|
707
|
+
var minD = p + axis.p2c(opts.panRange[0]) - axis.p2c(axisMin);
|
|
708
|
+
// calc max delta (revealing right edge of plot)
|
|
709
|
+
var maxD = p + axis.p2c(opts.panRange[1]) - axis.p2c(axisMax);
|
|
710
|
+
// limit delta to min or max if enabled
|
|
711
|
+
if (opts.panRange[0] !== undefined && d >= maxD) d = maxD;
|
|
712
|
+
if (opts.panRange[1] !== undefined && d <= minD) d = minD;
|
|
713
|
+
|
|
678
714
|
if (d !== 0) {
|
|
679
715
|
var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axisMin) - (p - d)) - axis.c2p(axis.p2c(axisMin))),
|
|
680
716
|
navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axisMax) - (p - d)) - axis.c2p(axis.p2c(axisMax)));
|
|
@@ -20,7 +20,7 @@ can just fix the size of their placeholders.
|
|
|
20
20
|
* Dual licensed under the MIT and GPL licenses.
|
|
21
21
|
* http://benalman.com/about/license/
|
|
22
22
|
*/
|
|
23
|
-
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,
|
|
23
|
+
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,window);
|
|
24
24
|
|
|
25
25
|
/* eslint-enable */
|
|
26
26
|
(function ($) {
|
|
@@ -10,6 +10,7 @@ selection: {
|
|
|
10
10
|
color: color,
|
|
11
11
|
shape: "round" or "miter" or "bevel",
|
|
12
12
|
visualization: "fill" or "focus",
|
|
13
|
+
displaySelectionDecorations: true or false,
|
|
13
14
|
minSize: number of pixels
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -26,6 +27,10 @@ option "focus" draws a colored bezel around the selected area while keeping
|
|
|
26
27
|
the selected area clear. The option "fill" highlights (i.e., fills) the
|
|
27
28
|
selected area with a colored highlight.
|
|
28
29
|
|
|
30
|
+
There are optional selection decorations (handles) that are rendered with the
|
|
31
|
+
"focus" visualization option. The selection decoration is rendered by default
|
|
32
|
+
but can be turned off by setting displaySelectionDecorations to false.
|
|
33
|
+
|
|
29
34
|
"minSize" is the minimum size a selection can be in pixels. This value can
|
|
30
35
|
be customized to determine the smallest size a selection can be and still
|
|
31
36
|
have the selection rectangle be displayed. When customizing this value, the
|
|
@@ -450,6 +455,7 @@ The plugin allso adds the following methods to the plot object:
|
|
|
450
455
|
|
|
451
456
|
var c = $.color.parse(o.selection.color);
|
|
452
457
|
var visualization = o.selection.visualization;
|
|
458
|
+
var displaySelectionDecorations = o.selection.displaySelectionDecorations;
|
|
453
459
|
|
|
454
460
|
var scalingFactor = 1;
|
|
455
461
|
|
|
@@ -486,7 +492,10 @@ The plugin allso adds the following methods to the plot object:
|
|
|
486
492
|
} else {
|
|
487
493
|
ctx.fillRect(0, 0, plot.width(), plot.height());
|
|
488
494
|
ctx.clearRect(x, y, w, h);
|
|
489
|
-
|
|
495
|
+
|
|
496
|
+
if (displaySelectionDecorations) {
|
|
497
|
+
drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot));
|
|
498
|
+
}
|
|
490
499
|
}
|
|
491
500
|
|
|
492
501
|
ctx.restore();
|
|
@@ -506,6 +515,7 @@ The plugin allso adds the following methods to the plot object:
|
|
|
506
515
|
selection: {
|
|
507
516
|
mode: null, // one of null, "x", "y" or "xy"
|
|
508
517
|
visualization: "focus", // "focus" or "fill"
|
|
518
|
+
displaySelectionDecorations: true, // true or false (currently only relevant for the focus visualization)
|
|
509
519
|
color: "#888888",
|
|
510
520
|
shape: "round", // one of "round", "miter", or "bevel"
|
|
511
521
|
minSize: 5 // minimum number of pixels
|
|
@@ -63,8 +63,8 @@ charts or filled areas).
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
datapoints.format.push({
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
66
|
+
x: s.bars.horizontal,
|
|
67
|
+
y: !s.bars.horizontal,
|
|
68
68
|
number: true,
|
|
69
69
|
required: false,
|
|
70
70
|
computeRange: s.yaxis.options.autoScale !== 'none',
|
|
@@ -78,7 +78,7 @@ charts or filled areas).
|
|
|
78
78
|
if (s.stack == null || s.stack === false) return;
|
|
79
79
|
|
|
80
80
|
var needsBottom = s.bars.show || (s.lines.show && s.lines.fill);
|
|
81
|
-
var hasBottom = datapoints.pointsize > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y);
|
|
81
|
+
var hasBottom = datapoints.pointsize > 2 && (s.bars.horizontal ? datapoints.format[2].x : datapoints.format[2].y);
|
|
82
82
|
// Series data is missing bottom points - need to format
|
|
83
83
|
if (needsBottom && !hasBottom) {
|
|
84
84
|
addBottomPoints(s, datapoints);
|