thomas-AOT-4029 add extra parameters to show alarm on graph

pull/3/head
thomas.duval 5 years ago
parent ec819693cc
commit 3dcdcbd7ca

@ -3067,11 +3067,12 @@ Licensed under the MIT license.
} }
function drawSeriesPoints(series) { function drawSeriesPoints(series) {
function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol) { function plotPoints(datapoints, radius, fillStyle, offset, shadow, axisx, axisy, symbol, extraData = null) {
var points = datapoints.points, ps = datapoints.pointsize; var points = datapoints.points, ps = datapoints.pointsize;
for (var i = 0; i < points.length; i += ps) { for (var i = 0; i < points.length; i += ps) {
var x = points[i], y = points[i + 1]; var x = points[i], y = points[i + 1];
var value = x;
if (x == null || x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max) { if (x == null || x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max) {
continue; continue;
} }
@ -3081,16 +3082,17 @@ Licensed under the MIT license.
y = axisy.p2c(y) + offset; y = axisy.p2c(y) + offset;
if (symbol === "circle") { if (symbol === "circle") {
ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false); ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false);
} else {
symbol(ctx, x, y, radius, shadow, datapoints, series);
}
ctx.closePath(); ctx.closePath();
if (fillStyle) { if (fillStyle) {
ctx.fillStyle = fillStyle; ctx.fillStyle = fillStyle;
ctx.fill(); ctx.fill();
} }
ctx.stroke(); ctx.stroke();
} else {
symbol(ctx, x, y, radius, shadow, extraData, value);
ctx.fillStyle = "#FF0000";
ctx.fill();
}
} }
} }
@ -3100,7 +3102,8 @@ Licensed under the MIT license.
var lw = series.points.lineWidth, var lw = series.points.lineWidth,
sw = series.shadowSize, sw = series.shadowSize,
radius = series.points.radius, radius = series.points.radius,
symbol = series.points.symbol; symbol = series.points.symbol,
extraData = series.points.extraData;
// If the user sets the line width to 0, we change it to a very // If the user sets the line width to 0, we change it to a very
// small value. A line width of 0 seems to force the default of 1. // small value. A line width of 0 seems to force the default of 1.
@ -3117,18 +3120,18 @@ Licensed under the MIT license.
ctx.lineWidth = w; ctx.lineWidth = w;
ctx.strokeStyle = "rgba(0,0,0,0.1)"; ctx.strokeStyle = "rgba(0,0,0,0.1)";
plotPoints(series.datapoints, radius, null, w + w / 2, true, plotPoints(series.datapoints, radius, null, w + w / 2, true,
series.xaxis, series.yaxis, symbol); series.xaxis, series.yaxis, symbol, extraData);
ctx.strokeStyle = "rgba(0,0,0,0.2)"; ctx.strokeStyle = "rgba(0,0,0,0.2)";
plotPoints(series.datapoints, radius, null, w / 2, true, plotPoints(series.datapoints, radius, null, w / 2, true,
series.xaxis, series.yaxis, symbol); series.xaxis, series.yaxis, symbol, extraData);
} }
ctx.lineWidth = lw; ctx.lineWidth = lw;
ctx.strokeStyle = series.points.strokeColor || series.color; ctx.strokeStyle = series.points.strokeColor || series.color;
plotPoints(series.datapoints, radius, plotPoints(series.datapoints, radius,
getFillStyle(series.points, series.color), 0, false, getFillStyle(series.points, series.color), 0, false,
series.xaxis, series.yaxis, symbol); series.xaxis, series.yaxis, symbol, extraData);
ctx.restore(); ctx.restore();
} }
@ -3710,7 +3713,7 @@ Licensed under the MIT license.
if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max) { if (x < axisx.min || x > axisx.max || y < axisy.min || y > axisy.max) {
return; return;
} }
var value = x;
var pointRadius, radius; var pointRadius, radius;
if (series.points.show) { if (series.points.show) {
@ -3729,7 +3732,7 @@ Licensed under the MIT license.
if (series.points.symbol === "circle") { if (series.points.symbol === "circle") {
octx.arc(x, y, radius, 0, 2 * Math.PI, false); octx.arc(x, y, radius, 0, 2 * Math.PI, false);
} else { } else {
series.points.symbol(octx, x, y, radius, false); series.points.symbol(octx, x, y, radius, false, series.points.extraData, value);
} }
octx.closePath(); octx.closePath();
octx.stroke(); octx.stroke();

Loading…
Cancel
Save