Merge pull request #1 from simPRO-Software/bugfix/thomas-AOT-3767-flot

Bugfix/thomas aot 3767 flot
pull/3/head
tdsimpro 5 years ago committed by GitHub
commit 3c637c1437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1593,14 +1593,14 @@ Licensed under the MIT license.
var delta;
switch (s.bars.align) {
case "left":
delta = 0;
break;
case "right":
delta = -s.bars.barWidth;
break;
default:
delta = -s.bars.barWidth / 2;
case "left":
delta = 0;
break;
case "right":
delta = -s.bars.barWidth;
break;
default:
delta = -s.bars.barWidth / 2;
}
if (s.bars.horizontal) {
@ -1634,8 +1634,8 @@ Licensed under the MIT license.
// padding messes up the positioning
placeholder.css("padding", 0)
.children().filter(function() {
return !$(this).hasClass("flot-overlay") && !$(this).hasClass("flot-base");
}).remove();
return !$(this).hasClass("flot-overlay") && !$(this).hasClass("flot-base");
}).remove();
if (placeholder.css("position") === "static") {
@ -2271,6 +2271,7 @@ Licensed under the MIT license.
if (grid.show && grid.aboveData) {
drawGrid();
}
drawSecondMarkings();
surface.render();
@ -2326,6 +2327,52 @@ Licensed under the MIT license.
ctx.restore();
}
function drawSecondMarkings() {
var i, axes, bw, bc;
ctx.save();
ctx.translate(plotOffset.left, plotOffset.top);
var markingLayer = "flot-markings";
surface.removeText(markingLayer);
// process markings
var markingsAboveGraph = [],
markings = options.grid.markings;
if (markings) {
if ($.isFunction(markings)) {
axes = plot.getAxes();
// xmin etc. is backwards compatibility, to be
// removed in the future
axes.xmin = axes.xaxis.min;
axes.xmax = axes.xaxis.max;
axes.ymin = axes.yaxis.min;
axes.ymax = axes.yaxis.max;
markings = markings(axes);
}
for (i = 0; i < markings.length; ++i) {
var m = markings[i];
if (m.aboveGraph) {
markingsAboveGraph.push(m);
}
}
}
// draw the ticks
axes = allAxes();
bw = options.grid.borderWidth;
drawMarkings(markingsAboveGraph, markingLayer);
ctx.restore();
}
function drawGrid() {
var i, axes, bw, bc;
@ -2359,7 +2406,7 @@ Licensed under the MIT license.
if (m.aboveGrid) {
markingsAboveGrid.push(m);
} else {
} else if (!m.aboveGraph) {
markingsUnderGrid.push(m);
}
}
@ -2621,23 +2668,23 @@ Licensed under the MIT license.
if (!!m.textAlign) {
switch (m.textAlign.toLowerCase()) {
case "right":
xPos = xrange.to + plotOffset.left;
break;
case "center":
xPos = (xrange.from + plotOffset.left + xrange.to + plotOffset.left) / 2;
break;
case "right":
xPos = xrange.to + plotOffset.left;
break;
case "center":
xPos = (xrange.from + plotOffset.left + xrange.to + plotOffset.left) / 2;
break;
}
}
if (!!m.textBaseline) {
switch (m.textBaseline.toLowerCase()) {
case "bottom":
yPos = (yrange.from + plotOffset.top);
break;
case "middle":
yPos = (yrange.from + plotOffset.top + yrange.to + plotOffset.top) / 2;
break;
case "bottom":
yPos = (yrange.from + plotOffset.top);
break;
case "middle":
yPos = (yrange.from + plotOffset.top + yrange.to + plotOffset.top) / 2;
break;
}
}
@ -3070,18 +3117,18 @@ Licensed under the MIT license.
ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)";
plotPoints(series.datapoints, radius, null, w + w / 2, true,
series.xaxis, series.yaxis, symbol);
series.xaxis, series.yaxis, symbol);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
plotPoints(series.datapoints, radius, null, w / 2, true,
series.xaxis, series.yaxis, symbol);
series.xaxis, series.yaxis, symbol);
}
ctx.lineWidth = lw;
ctx.strokeStyle = series.points.strokeColor || series.color;
plotPoints(series.datapoints, radius,
getFillStyle(series.points, series.color), 0, false,
series.xaxis, series.yaxis, symbol);
getFillStyle(series.points, series.color), 0, false,
series.xaxis, series.yaxis, symbol);
ctx.restore();
}
@ -3216,14 +3263,14 @@ Licensed under the MIT license.
var barLeft;
switch (series.bars.align) {
case "left":
barLeft = 0;
break;
case "right":
barLeft = -series.bars.barWidth;
break;
default:
barLeft = -series.bars.barWidth / 2;
case "left":
barLeft = 0;
break;
case "right":
barLeft = -series.bars.barWidth;
break;
default:
barLeft = -series.bars.barWidth / 2;
}
var fillStyleCallback = series.bars.fill ? function(bottom, top) { return getFillStyle(series.bars, series.color, bottom, top); } : null;
@ -3314,16 +3361,16 @@ Licensed under the MIT license.
}
var colorbox = $("<div></div>").css({
"width": "4px",
"height": 0,
"border": "5px solid " + entry.color,
"overflow": "hidden"
}),
borderbox = $("<div></div>").css({
"border": "1px solid " + options.legend.labelBoxBorderColor,
"padding": "1px"
});
"width": "4px",
"height": 0,
"border": "5px solid " + entry.color,
"overflow": "hidden"
}),
borderbox = $("<div></div>").css({
"border": "1px solid " + options.legend.labelBoxBorderColor,
"padding": "1px"
});
rowBuffer.append(
$("<td></td>").addClass("legendColorBox").append(borderbox.append(colorbox)),
@ -3456,14 +3503,14 @@ Licensed under the MIT license.
var barLeft, barRight;
switch (s.bars.align) {
case "left":
barLeft = 0;
break;
case "right":
barLeft = -s.bars.barWidth;
break;
default:
barLeft = -s.bars.barWidth / 2;
case "left":
barLeft = 0;
break;
case "right":
barLeft = -s.bars.barWidth;
break;
default:
barLeft = -s.bars.barWidth / 2;
}
barRight = barLeft + s.bars.barWidth;
@ -3479,9 +3526,9 @@ Licensed under the MIT license.
// for a bar graph, the cursor must be inside the bar
if (series[i].bars.horizontal ?
(mx <= Math.max(b, x) && mx >= Math.min(b, x) &&
my >= y + barLeft && my <= y + barRight) :
my >= y + barLeft && my <= y + barRight) :
(mx >= x + barLeft && mx <= x + barRight &&
my >= Math.min(b, y) && my <= Math.max(b, y))) {
my >= Math.min(b, y) && my <= Math.max(b, y))) {
item = [i, j / ps];
}
}
@ -3494,9 +3541,9 @@ Licensed under the MIT license.
ps = series[i].datapoints.pointsize;
return { datapoint: series[i].datapoints.points.slice(j * ps, (j + 1) * ps),
dataIndex: j,
series: series[i],
seriesIndex: i };
dataIndex: j,
series: series[i],
seriesIndex: i };
}
return null;
@ -3505,20 +3552,20 @@ Licensed under the MIT license.
function onMouseMove(e) {
if (options.grid.hoverable) {
triggerClickHoverEvent("plothover", e,
function(s) { return s.hoverable !== false; });
function(s) { return s.hoverable !== false; });
}
}
function onMouseLeave(e) {
if (options.grid.hoverable) {
triggerClickHoverEvent("plothover", e,
function() { return false; });
function() { return false; });
}
}
function onClick(e) {
triggerClickHoverEvent("plotclick", e,
function(s) { return s.clickable !== false; });
function(s) { return s.clickable !== false; });
}
/**
@ -3529,7 +3576,7 @@ Licensed under the MIT license.
var offset = eventHolder.offset(),
canvasX = event.pageX - offset.left - plotOffset.left,
canvasY = event.pageY - offset.top - plotOffset.top,
pos = canvasToAxisCoords({ left: canvasX, top: canvasY });
pos = canvasToAxisCoords({ left: canvasX, top: canvasY });
pos.pageX = event.pageX;
pos.pageY = event.pageY;
@ -3694,21 +3741,21 @@ Licensed under the MIT license.
barLeft;
switch (series.bars.align) {
case "left":
barLeft = 0;
break;
case "right":
barLeft = -series.bars.barWidth;
break;
default:
barLeft = -series.bars.barWidth / 2;
case "left":
barLeft = 0;
break;
case "right":
barLeft = -series.bars.barWidth;
break;
default:
barLeft = -series.bars.barWidth / 2;
}
octx.lineWidth = series.bars.lineWidth;
octx.strokeStyle = highlightColor;
drawBar(point[0], point[1], point[2] || 0, barLeft, barLeft + series.bars.barWidth,
function() { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
function() { return fillStyle; }, series.xaxis, series.yaxis, octx, series.bars.horizontal, series.bars.lineWidth);
}
function getColorOrGradient(spec, bottom, top, defaultColor) {

Loading…
Cancel
Save