kibana-sinatra 0.0.8 → 3.0.0.0
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.
- checksums.yaml +4 -4
- data/lib/kibana/assets/app/components/kbn.js +3 -3
- data/lib/kibana/assets/app/controllers/dash.js +2 -19
- data/lib/kibana/assets/app/dashboards/guided.json +1 -1
- data/lib/kibana/assets/app/panels/bettermap/module.html +1 -1
- data/lib/kibana/assets/app/panels/bettermap/module.js +11 -4
- data/lib/kibana/assets/app/panels/column/module.js +3 -0
- data/lib/kibana/assets/app/panels/{pie → goal}/editor.html +1 -25
- data/lib/kibana/assets/app/panels/{pie → goal}/module.html +4 -4
- data/lib/kibana/assets/app/panels/goal/module.js +252 -0
- data/lib/kibana/assets/app/panels/histogram/interval.js +1 -1
- data/lib/kibana/assets/app/panels/histogram/module.html +12 -3
- data/lib/kibana/assets/app/panels/histogram/module.js +16 -14
- data/lib/kibana/assets/app/panels/hits/module.js +7 -3
- data/lib/kibana/assets/app/panels/map/module.html +1 -1
- data/lib/kibana/assets/app/panels/map/module.js +9 -1
- data/lib/kibana/assets/app/panels/query/module.html +1 -1
- data/lib/kibana/assets/app/panels/sparklines/interval.js +1 -1
- data/lib/kibana/assets/app/panels/sparklines/module.js +5 -1
- data/lib/kibana/assets/app/panels/table/editor.html +1 -1
- data/lib/kibana/assets/app/panels/table/micropanel.html +3 -3
- data/lib/kibana/assets/app/panels/table/module.html +63 -16
- data/lib/kibana/assets/app/panels/table/module.js +4 -1
- data/lib/kibana/assets/app/panels/terms/module.js +7 -4
- data/lib/kibana/assets/app/panels/text/module.js +2 -0
- data/lib/kibana/assets/app/panels/timepicker/module.js +9 -1
- data/lib/kibana/assets/app/panels/trends/module.js +4 -0
- data/lib/kibana/assets/app/partials/dashboard.html +4 -2
- data/lib/kibana/assets/app/partials/panelgeneral.html +1 -1
- data/lib/kibana/assets/app/services/dashboard.js +9 -7
- data/lib/kibana/assets/app/services/fields.js +34 -3
- data/lib/kibana/assets/app/services/kbnIndex.js +5 -3
- data/lib/kibana/assets/css/bootstrap.dark.min.css +1 -1
- data/lib/kibana/assets/css/bootstrap.light.min.css +1 -1
- data/lib/kibana/assets/favicon.ico +0 -0
- data/lib/kibana/assets/img/annotation-icon.png +0 -0
- data/lib/kibana/assets/index.html +14 -9
- data/lib/kibana/assets/vendor/bootstrap/less/overrides.less +11 -5
- data/lib/kibana/assets/vendor/bootstrap/less/tooltip.less +4 -4
- data/lib/kibana/assets/vendor/jquery/jquery.flot.events.js +15 -9
- data/lib/kibana/assets/vendor/jquery/jquery.flot.js +154 -77
- data/lib/kibana/assets/vendor/jquery/jquery.flot.pie.js +6 -6
- data/lib/kibana/sinatra/version.rb +1 -1
- data/lib/kibana/views/config.erb +8 -2
- metadata +8 -6
- data/lib/kibana/assets/app/panels/pie/module.js +0 -334
@@ -324,17 +324,23 @@
|
|
324
324
|
|
325
325
|
div = $('<i style="position:absolute" class="'+icon.icon+'"></i>').appendTo(container);
|
326
326
|
|
327
|
-
|
328
|
-
|
327
|
+
var width = icon.size || icon.width;
|
328
|
+
var height = icon.size || icon.height;
|
329
|
+
|
330
|
+
top = o.top + plot.height() - height + 1;
|
331
|
+
left = xaxis.p2c(event.min) + o.left - width / 2;
|
329
332
|
|
330
333
|
// Positions the marker
|
331
|
-
|
334
|
+
var cssOptions = {
|
332
335
|
left: left + 'px',
|
333
|
-
top: top
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
336
|
+
top: top
|
337
|
+
};
|
338
|
+
|
339
|
+
if (icon.outline) cssOptions['text-shadow'] = "1px 1px "+icon.outline+", -1px -1px "+icon.outline+", -1px 1px "+icon.outline+", 1px -1px "+icon.outline;
|
340
|
+
if (icon.size) cssOptions['font-size'] = icon['size']+'px';
|
341
|
+
if (icon.color) cssOptions.color = icon.color;
|
342
|
+
|
343
|
+
div.css(cssOptions);
|
338
344
|
div.hide();
|
339
345
|
div.data({
|
340
346
|
"event": event
|
@@ -626,4 +632,4 @@
|
|
626
632
|
};
|
627
633
|
|
628
634
|
|
629
|
-
})(jQuery);
|
635
|
+
})(jQuery);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Javascript plotting library for jQuery, version 0.8.
|
1
|
+
/* Javascript plotting library for jQuery, version 0.8.2.
|
2
2
|
|
3
3
|
Copyright (c) 2007-2013 IOLA and Ole Laursen.
|
4
4
|
Licensed under the MIT license.
|
@@ -29,7 +29,7 @@ Licensed under the MIT license.
|
|
29
29
|
* V. 1.1: Fix error handling so e.g. parsing an empty string does
|
30
30
|
* produce a color rather than just crashing.
|
31
31
|
*/
|
32
|
-
(function(
|
32
|
+
(function($){$.color={};$.color.make=function(r,g,b,a){var o={};o.r=r||0;o.g=g||0;o.b=b||0;o.a=a!=null?a:1;o.add=function(c,d){for(var i=0;i<c.length;++i)o[c.charAt(i)]+=d;return o.normalize()};o.scale=function(c,f){for(var i=0;i<c.length;++i)o[c.charAt(i)]*=f;return o.normalize()};o.toString=function(){if(o.a>=1){return"rgb("+[o.r,o.g,o.b].join(",")+")"}else{return"rgba("+[o.r,o.g,o.b,o.a].join(",")+")"}};o.normalize=function(){function clamp(min,value,max){return value<min?min:value>max?max:value}o.r=clamp(0,parseInt(o.r),255);o.g=clamp(0,parseInt(o.g),255);o.b=clamp(0,parseInt(o.b),255);o.a=clamp(0,o.a,1);return o};o.clone=function(){return $.color.make(o.r,o.b,o.g,o.a)};return o.normalize()};$.color.extract=function(elem,css){var c;do{c=elem.css(css).toLowerCase();if(c!=""&&c!="transparent")break;elem=elem.parent()}while(elem.length&&!$.nodeName(elem.get(0),"body"));if(c=="rgba(0, 0, 0, 0)")c="transparent";return $.color.parse(c)};$.color.parse=function(str){var res,m=$.color.make;if(res=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10));if(res=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10),parseFloat(res[4]));if(res=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55);if(res=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55,parseFloat(res[4]));if(res=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))return m(parseInt(res[1],16),parseInt(res[2],16),parseInt(res[3],16));if(res=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))return m(parseInt(res[1]+res[1],16),parseInt(res[2]+res[2],16),parseInt(res[3]+res[3],16));var name=$.trim(str).toLowerCase();if(name=="transparent")return m(255,255,255,0);else{res=lookupColors[name]||[0,0,0];return m(res[0],res[1],res[2])}};var lookupColors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);
|
33
33
|
|
34
34
|
// the actual Flot code
|
35
35
|
(function($) {
|
@@ -425,7 +425,7 @@ Licensed under the MIT license.
|
|
425
425
|
element: positions.length ? info.element.clone() : info.element,
|
426
426
|
x: x,
|
427
427
|
y: y
|
428
|
-
}
|
428
|
+
};
|
429
429
|
|
430
430
|
positions.push(position);
|
431
431
|
|
@@ -567,6 +567,7 @@ Licensed under the MIT license.
|
|
567
567
|
fillColor: null,
|
568
568
|
align: "left", // "left", "right", or "center"
|
569
569
|
horizontal: false,
|
570
|
+
zero: true
|
570
571
|
},
|
571
572
|
shadowSize: 3,
|
572
573
|
highlightColor: null
|
@@ -657,6 +658,23 @@ Licensed under the MIT license.
|
|
657
658
|
};
|
658
659
|
};
|
659
660
|
plot.shutdown = shutdown;
|
661
|
+
plot.destroy = function () {
|
662
|
+
shutdown();
|
663
|
+
placeholder.removeData("plot").empty();
|
664
|
+
|
665
|
+
series = [];
|
666
|
+
options = null;
|
667
|
+
surface = null;
|
668
|
+
overlay = null;
|
669
|
+
eventHolder = null;
|
670
|
+
ctx = null;
|
671
|
+
octx = null;
|
672
|
+
xaxes = [];
|
673
|
+
yaxes = [];
|
674
|
+
hooks = null;
|
675
|
+
highlights = [];
|
676
|
+
plot = null;
|
677
|
+
};
|
660
678
|
plot.resize = function () {
|
661
679
|
var width = placeholder.width(),
|
662
680
|
height = placeholder.height();
|
@@ -734,16 +752,16 @@ Licensed under the MIT license.
|
|
734
752
|
// since the rest of the code assumes that they exist.
|
735
753
|
|
736
754
|
var i, axisOptions, axisCount,
|
755
|
+
fontSize = placeholder.css("font-size"),
|
756
|
+
fontSizeDefault = fontSize ? +fontSize.replace("px", "") : 13,
|
737
757
|
fontDefaults = {
|
738
758
|
style: placeholder.css("font-style"),
|
739
|
-
size: Math.round(0.8 *
|
759
|
+
size: Math.round(0.8 * fontSizeDefault),
|
740
760
|
variant: placeholder.css("font-variant"),
|
741
761
|
weight: placeholder.css("font-weight"),
|
742
762
|
family: placeholder.css("font-family")
|
743
763
|
};
|
744
764
|
|
745
|
-
fontDefaults.lineHeight = fontDefaults.size * 1.15;
|
746
|
-
|
747
765
|
axisCount = options.xaxes.length || 1;
|
748
766
|
for (i = 0; i < axisCount; ++i) {
|
749
767
|
|
@@ -760,6 +778,9 @@ Licensed under the MIT license.
|
|
760
778
|
if (!axisOptions.font.color) {
|
761
779
|
axisOptions.font.color = axisOptions.color;
|
762
780
|
}
|
781
|
+
if (!axisOptions.font.lineHeight) {
|
782
|
+
axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15);
|
783
|
+
}
|
763
784
|
}
|
764
785
|
}
|
765
786
|
|
@@ -779,6 +800,9 @@ Licensed under the MIT license.
|
|
779
800
|
if (!axisOptions.font.color) {
|
780
801
|
axisOptions.font.color = axisOptions.color;
|
781
802
|
}
|
803
|
+
if (!axisOptions.font.lineHeight) {
|
804
|
+
axisOptions.font.lineHeight = Math.round(axisOptions.font.size * 1.15);
|
805
|
+
}
|
782
806
|
}
|
783
807
|
}
|
784
808
|
|
@@ -1130,7 +1154,7 @@ Licensed under the MIT license.
|
|
1130
1154
|
if (val != null) {
|
1131
1155
|
f = format[m];
|
1132
1156
|
// extract min/max info
|
1133
|
-
if (f.autoscale) {
|
1157
|
+
if (f.autoscale !== false) {
|
1134
1158
|
if (f.x) {
|
1135
1159
|
updateAxis(s.xaxis, val, val);
|
1136
1160
|
}
|
@@ -1217,11 +1241,8 @@ Licensed under the MIT license.
|
|
1217
1241
|
case "right":
|
1218
1242
|
delta = -s.bars.barWidth;
|
1219
1243
|
break;
|
1220
|
-
case "center":
|
1221
|
-
delta = -s.bars.barWidth / 2;
|
1222
|
-
break;
|
1223
1244
|
default:
|
1224
|
-
|
1245
|
+
delta = -s.bars.barWidth / 2;
|
1225
1246
|
}
|
1226
1247
|
|
1227
1248
|
if (s.bars.horizontal) {
|
@@ -1252,7 +1273,9 @@ Licensed under the MIT license.
|
|
1252
1273
|
// from a previous plot in this container that we'll try to re-use.
|
1253
1274
|
|
1254
1275
|
placeholder.css("padding", 0) // padding messes up the positioning
|
1255
|
-
.children(
|
1276
|
+
.children().filter(function(){
|
1277
|
+
return !$(this).hasClass("flot-overlay") && !$(this).hasClass('flot-base');
|
1278
|
+
}).remove();
|
1256
1279
|
|
1257
1280
|
if (placeholder.css("position") == 'static')
|
1258
1281
|
placeholder.css("position", "relative"); // for positioning labels and overlay
|
@@ -1349,7 +1372,7 @@ Licensed under the MIT license.
|
|
1349
1372
|
ticks = axis.ticks || [],
|
1350
1373
|
labelWidth = opts.labelWidth || 0,
|
1351
1374
|
labelHeight = opts.labelHeight || 0,
|
1352
|
-
maxWidth = labelWidth || axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null
|
1375
|
+
maxWidth = labelWidth || (axis.direction == "x" ? Math.floor(surface.width / (ticks.length || 1)) : null),
|
1353
1376
|
legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis",
|
1354
1377
|
layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles,
|
1355
1378
|
font = opts.font || "flot-tick-label tickLabel";
|
@@ -1381,37 +1404,50 @@ Licensed under the MIT license.
|
|
1381
1404
|
var lw = axis.labelWidth,
|
1382
1405
|
lh = axis.labelHeight,
|
1383
1406
|
pos = axis.options.position,
|
1407
|
+
isXAxis = axis.direction === "x",
|
1384
1408
|
tickLength = axis.options.tickLength,
|
1385
1409
|
axisMargin = options.grid.axisMargin,
|
1386
1410
|
padding = options.grid.labelMargin,
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1411
|
+
innermost = true,
|
1412
|
+
outermost = true,
|
1413
|
+
first = true,
|
1414
|
+
found = false;
|
1415
|
+
|
1416
|
+
// Determine the axis's position in its direction and on its side
|
1417
|
+
|
1418
|
+
$.each(isXAxis ? xaxes : yaxes, function(i, a) {
|
1419
|
+
if (a && a.reserveSpace) {
|
1420
|
+
if (a === axis) {
|
1421
|
+
found = true;
|
1422
|
+
} else if (a.options.position === pos) {
|
1423
|
+
if (found) {
|
1424
|
+
outermost = false;
|
1425
|
+
} else {
|
1426
|
+
innermost = false;
|
1427
|
+
}
|
1428
|
+
}
|
1429
|
+
if (!found) {
|
1430
|
+
first = false;
|
1431
|
+
}
|
1432
|
+
}
|
1393
1433
|
});
|
1394
|
-
if ($.inArray(axis, samePosition) == samePosition.length - 1)
|
1395
|
-
axisMargin = 0; // outermost
|
1396
1434
|
|
1397
|
-
//
|
1398
|
-
if (tickLength == null) {
|
1399
|
-
var sameDirection = $.grep(all, function (a) {
|
1400
|
-
return a && a.reserveSpace;
|
1401
|
-
});
|
1435
|
+
// The outermost axis on each side has no margin
|
1402
1436
|
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1437
|
+
if (outermost) {
|
1438
|
+
axisMargin = 0;
|
1439
|
+
}
|
1440
|
+
|
1441
|
+
// The ticks for the first axis in each direction stretch across
|
1442
|
+
|
1443
|
+
if (tickLength == null) {
|
1444
|
+
tickLength = first ? "full" : 5;
|
1408
1445
|
}
|
1409
1446
|
|
1410
1447
|
if (!isNaN(+tickLength))
|
1411
1448
|
padding += +tickLength;
|
1412
1449
|
|
1413
|
-
|
1414
|
-
if (axis.direction == "x") {
|
1450
|
+
if (isXAxis) {
|
1415
1451
|
lh += padding;
|
1416
1452
|
|
1417
1453
|
if (pos == "bottom") {
|
@@ -1461,7 +1497,7 @@ Licensed under the MIT license.
|
|
1461
1497
|
// inside the canvas and isn't clipped off
|
1462
1498
|
|
1463
1499
|
var minMargin = options.grid.minBorderMargin,
|
1464
|
-
|
1500
|
+
axis, i;
|
1465
1501
|
|
1466
1502
|
// check stuff from the plot (FIXME: this should just read
|
1467
1503
|
// a value from the series, otherwise it's impossible to
|
@@ -1472,21 +1508,37 @@ Licensed under the MIT license.
|
|
1472
1508
|
minMargin = Math.max(minMargin, 2 * (series[i].points.radius + series[i].points.lineWidth/2));
|
1473
1509
|
}
|
1474
1510
|
|
1475
|
-
|
1511
|
+
var margins = {
|
1512
|
+
left: minMargin,
|
1513
|
+
right: minMargin,
|
1514
|
+
top: minMargin,
|
1515
|
+
bottom: minMargin
|
1516
|
+
};
|
1476
1517
|
|
1477
1518
|
// check axis labels, note we don't check the actual
|
1478
1519
|
// labels but instead use the overall width/height to not
|
1479
1520
|
// jump as much around with replots
|
1480
1521
|
$.each(allAxes(), function (_, axis) {
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1522
|
+
if (axis.reserveSpace && axis.ticks && axis.ticks.length) {
|
1523
|
+
var lastTick = axis.ticks[axis.ticks.length - 1];
|
1524
|
+
if (axis.direction === "x") {
|
1525
|
+
margins.left = Math.max(margins.left, axis.labelWidth / 2);
|
1526
|
+
if (lastTick.v <= axis.max) {
|
1527
|
+
margins.right = Math.max(margins.right, axis.labelWidth / 2);
|
1528
|
+
}
|
1529
|
+
} else {
|
1530
|
+
margins.bottom = Math.max(margins.bottom, axis.labelHeight / 2);
|
1531
|
+
if (lastTick.v <= axis.max) {
|
1532
|
+
margins.top = Math.max(margins.top, axis.labelHeight / 2);
|
1533
|
+
}
|
1534
|
+
}
|
1535
|
+
}
|
1484
1536
|
});
|
1485
1537
|
|
1486
|
-
plotOffset.left = Math.max(margins.
|
1487
|
-
plotOffset.right = Math.max(margins.
|
1488
|
-
plotOffset.top = Math.max(margins.
|
1489
|
-
plotOffset.bottom = Math.max(margins.
|
1538
|
+
plotOffset.left = Math.ceil(Math.max(margins.left, plotOffset.left));
|
1539
|
+
plotOffset.right = Math.ceil(Math.max(margins.right, plotOffset.right));
|
1540
|
+
plotOffset.top = Math.ceil(Math.max(margins.top, plotOffset.top));
|
1541
|
+
plotOffset.bottom = Math.ceil(Math.max(margins.bottom, plotOffset.bottom));
|
1490
1542
|
}
|
1491
1543
|
|
1492
1544
|
function setupGrid() {
|
@@ -2099,17 +2151,21 @@ Licensed under the MIT license.
|
|
2099
2151
|
function drawAxisLabels() {
|
2100
2152
|
|
2101
2153
|
$.each(allAxes(), function (_, axis) {
|
2102
|
-
if (!axis.show || axis.ticks.length == 0)
|
2103
|
-
return;
|
2104
|
-
|
2105
2154
|
var box = axis.box,
|
2106
2155
|
legacyStyles = axis.direction + "Axis " + axis.direction + axis.n + "Axis",
|
2107
2156
|
layer = "flot-" + axis.direction + "-axis flot-" + axis.direction + axis.n + "-axis " + legacyStyles,
|
2108
2157
|
font = axis.options.font || "flot-tick-label tickLabel",
|
2109
2158
|
tick, x, y, halign, valign;
|
2110
2159
|
|
2160
|
+
// Remove text before checking for axis.show and ticks.length;
|
2161
|
+
// otherwise plugins, like flot-tickrotor, that draw their own
|
2162
|
+
// tick labels will end up with both theirs and the defaults.
|
2163
|
+
|
2111
2164
|
surface.removeText(layer);
|
2112
2165
|
|
2166
|
+
if (!axis.show || axis.ticks.length == 0)
|
2167
|
+
return;
|
2168
|
+
|
2113
2169
|
for (var i = 0; i < axis.ticks.length; ++i) {
|
2114
2170
|
|
2115
2171
|
tick = axis.ticks[i];
|
@@ -2438,9 +2494,9 @@ Licensed under the MIT license.
|
|
2438
2494
|
radius = series.points.radius,
|
2439
2495
|
symbol = series.points.symbol;
|
2440
2496
|
|
2441
|
-
// If the user sets the line width to 0, we change it to a very
|
2497
|
+
// If the user sets the line width to 0, we change it to a very
|
2442
2498
|
// small value. A line width of 0 seems to force the default of 1.
|
2443
|
-
// Doing the conditional here allows the shadow setting to still be
|
2499
|
+
// Doing the conditional here allows the shadow setting to still be
|
2444
2500
|
// optional even with a lineWidth of 0.
|
2445
2501
|
|
2446
2502
|
if( lw == 0 )
|
@@ -2467,7 +2523,7 @@ Licensed under the MIT license.
|
|
2467
2523
|
ctx.restore();
|
2468
2524
|
}
|
2469
2525
|
|
2470
|
-
function drawBar(x, y, b, barLeft, barRight,
|
2526
|
+
function drawBar(x, y, b, barLeft, barRight, fillStyleCallback, axisx, axisy, c, horizontal, lineWidth) {
|
2471
2527
|
var left, right, bottom, top,
|
2472
2528
|
drawLeft, drawRight, drawTop, drawBottom,
|
2473
2529
|
tmp;
|
@@ -2542,13 +2598,8 @@ Licensed under the MIT license.
|
|
2542
2598
|
|
2543
2599
|
// fill the bar
|
2544
2600
|
if (fillStyleCallback) {
|
2545
|
-
c.beginPath();
|
2546
|
-
c.moveTo(left, bottom);
|
2547
|
-
c.lineTo(left, top);
|
2548
|
-
c.lineTo(right, top);
|
2549
|
-
c.lineTo(right, bottom);
|
2550
2601
|
c.fillStyle = fillStyleCallback(bottom, top);
|
2551
|
-
c.
|
2602
|
+
c.fillRect(left, top, right - left, bottom - top)
|
2552
2603
|
}
|
2553
2604
|
|
2554
2605
|
// draw outline
|
@@ -2556,35 +2607,35 @@ Licensed under the MIT license.
|
|
2556
2607
|
c.beginPath();
|
2557
2608
|
|
2558
2609
|
// FIXME: inline moveTo is buggy with excanvas
|
2559
|
-
c.moveTo(left, bottom
|
2610
|
+
c.moveTo(left, bottom);
|
2560
2611
|
if (drawLeft)
|
2561
|
-
c.lineTo(left, top
|
2612
|
+
c.lineTo(left, top);
|
2562
2613
|
else
|
2563
|
-
c.moveTo(left, top
|
2614
|
+
c.moveTo(left, top);
|
2564
2615
|
if (drawTop)
|
2565
|
-
c.lineTo(right, top
|
2616
|
+
c.lineTo(right, top);
|
2566
2617
|
else
|
2567
|
-
c.moveTo(right, top
|
2618
|
+
c.moveTo(right, top);
|
2568
2619
|
if (drawRight)
|
2569
|
-
c.lineTo(right, bottom
|
2620
|
+
c.lineTo(right, bottom);
|
2570
2621
|
else
|
2571
|
-
c.moveTo(right, bottom
|
2622
|
+
c.moveTo(right, bottom);
|
2572
2623
|
if (drawBottom)
|
2573
|
-
c.lineTo(left, bottom
|
2624
|
+
c.lineTo(left, bottom);
|
2574
2625
|
else
|
2575
|
-
c.moveTo(left, bottom
|
2626
|
+
c.moveTo(left, bottom);
|
2576
2627
|
c.stroke();
|
2577
2628
|
}
|
2578
2629
|
}
|
2579
2630
|
|
2580
2631
|
function drawSeriesBars(series) {
|
2581
|
-
function plotBars(datapoints, barLeft, barRight,
|
2632
|
+
function plotBars(datapoints, barLeft, barRight, fillStyleCallback, axisx, axisy) {
|
2582
2633
|
var points = datapoints.points, ps = datapoints.pointsize;
|
2583
2634
|
|
2584
2635
|
for (var i = 0; i < points.length; i += ps) {
|
2585
2636
|
if (points[i] == null)
|
2586
2637
|
continue;
|
2587
|
-
drawBar(points[i], points[i + 1], points[i + 2], barLeft, barRight,
|
2638
|
+
drawBar(points[i], points[i + 1], points[i + 2], barLeft, barRight, fillStyleCallback, axisx, axisy, ctx, series.bars.horizontal, series.bars.lineWidth);
|
2588
2639
|
}
|
2589
2640
|
}
|
2590
2641
|
|
@@ -2604,15 +2655,12 @@ Licensed under the MIT license.
|
|
2604
2655
|
case "right":
|
2605
2656
|
barLeft = -series.bars.barWidth;
|
2606
2657
|
break;
|
2607
|
-
case "center":
|
2608
|
-
barLeft = -series.bars.barWidth / 2;
|
2609
|
-
break;
|
2610
2658
|
default:
|
2611
|
-
|
2659
|
+
barLeft = -series.bars.barWidth / 2;
|
2612
2660
|
}
|
2613
2661
|
|
2614
2662
|
var fillStyleCallback = series.bars.fill ? function (bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;
|
2615
|
-
plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth,
|
2663
|
+
plotBars(series.datapoints, barLeft, barLeft + series.bars.barWidth, fillStyleCallback, series.xaxis, series.yaxis);
|
2616
2664
|
ctx.restore();
|
2617
2665
|
}
|
2618
2666
|
|
@@ -2632,10 +2680,15 @@ Licensed under the MIT license.
|
|
2632
2680
|
|
2633
2681
|
function insertLegend() {
|
2634
2682
|
|
2635
|
-
|
2683
|
+
if (options.legend.container != null) {
|
2684
|
+
$(options.legend.container).html("");
|
2685
|
+
} else {
|
2686
|
+
placeholder.find(".legend").remove();
|
2687
|
+
}
|
2636
2688
|
|
2637
|
-
if (!options.legend.show)
|
2689
|
+
if (!options.legend.show) {
|
2638
2690
|
return;
|
2691
|
+
}
|
2639
2692
|
|
2640
2693
|
var fragments = [], entries = [], rowStarted = false,
|
2641
2694
|
lf = options.legend.labelFormatter, s, label;
|
@@ -2796,8 +2849,21 @@ Licensed under the MIT license.
|
|
2796
2849
|
}
|
2797
2850
|
|
2798
2851
|
if (s.bars.show && !item) { // no other point can be nearby
|
2799
|
-
|
2800
|
-
|
2852
|
+
|
2853
|
+
var barLeft, barRight;
|
2854
|
+
|
2855
|
+
switch (s.bars.align) {
|
2856
|
+
case "left":
|
2857
|
+
barLeft = 0;
|
2858
|
+
break;
|
2859
|
+
case "right":
|
2860
|
+
barLeft = -s.bars.barWidth;
|
2861
|
+
break;
|
2862
|
+
default:
|
2863
|
+
barLeft = -s.bars.barWidth / 2;
|
2864
|
+
}
|
2865
|
+
|
2866
|
+
barRight = barLeft + s.bars.barWidth;
|
2801
2867
|
|
2802
2868
|
for (j = 0; j < points.length; j += ps) {
|
2803
2869
|
var x = points[j], y = points[j + 1], b = points[j + 2];
|
@@ -2995,13 +3061,24 @@ Licensed under the MIT license.
|
|
2995
3061
|
function drawBarHighlight(series, point) {
|
2996
3062
|
var highlightColor = (typeof series.highlightColor === "string") ? series.highlightColor : $.color.parse(series.color).scale('a', 0.5).toString(),
|
2997
3063
|
fillStyle = highlightColor,
|
2998
|
-
barLeft
|
3064
|
+
barLeft;
|
3065
|
+
|
3066
|
+
switch (series.bars.align) {
|
3067
|
+
case "left":
|
3068
|
+
barLeft = 0;
|
3069
|
+
break;
|
3070
|
+
case "right":
|
3071
|
+
barLeft = -series.bars.barWidth;
|
3072
|
+
break;
|
3073
|
+
default:
|
3074
|
+
barLeft = -series.bars.barWidth / 2;
|
3075
|
+
}
|
2999
3076
|
|
3000
3077
|
octx.lineWidth = series.bars.lineWidth;
|
3001
3078
|
octx.strokeStyle = highlightColor;
|
3002
3079
|
|
3003
3080
|
drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,
|
3004
|
-
|
3081
|
+
function () { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
|
3005
3082
|
}
|
3006
3083
|
|
3007
3084
|
function getColorOrGradient(spec, bottom, top, defaultColor) {
|
@@ -3040,7 +3117,7 @@ Licensed under the MIT license.
|
|
3040
3117
|
return plot;
|
3041
3118
|
};
|
3042
3119
|
|
3043
|
-
$.plot.version = "0.8.
|
3120
|
+
$.plot.version = "0.8.2";
|
3044
3121
|
|
3045
3122
|
$.plot.plugins = [];
|
3046
3123
|
|