mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add code to flot that plots any datapoints which to not have neighbors
as 0.5 radius points - fixes https://github.com/grafana/grafana/issues/13605
This commit is contained in:
42
public/vendor/flot/jquery.flot.js
vendored
42
public/vendor/flot/jquery.flot.js
vendored
@@ -2271,9 +2271,51 @@ Licensed under the MIT license.
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function drawOrphanedPoints(series) {
|
||||||
|
/* Filters series data for points with no neighbors before or after
|
||||||
|
* and plots single 0.5 radius points for them so that they are displayed.
|
||||||
|
*/
|
||||||
|
var abandonedPoints = [];
|
||||||
|
var beforeX = null;
|
||||||
|
var afterX = null;
|
||||||
|
var datapoints = series.datapoints;
|
||||||
|
// find any points with no neighbors before or after
|
||||||
|
var emptyPoints = [];
|
||||||
|
for (var j = 0; j < datapoints.pointsize - 2; j++) {
|
||||||
|
emptyPoints.push(0);
|
||||||
|
}
|
||||||
|
for (var i = 0; i < datapoints.points.length; i += datapoints.pointsize) {
|
||||||
|
var x = datapoints.points[i], y = datapoints.points[i + 1];
|
||||||
|
if (i === datapoints.points.length - datapoints.pointsize) {
|
||||||
|
afterX = null;
|
||||||
|
} else {
|
||||||
|
afterX = datapoints.points[i + datapoints.pointsize];
|
||||||
|
}
|
||||||
|
if (x !== null && y !== null && beforeX === null && afterX === null) {
|
||||||
|
abandonedPoints.push(x);
|
||||||
|
abandonedPoints.push(y);
|
||||||
|
abandonedPoints.push.apply(abandonedPoints, emptyPoints);
|
||||||
|
}
|
||||||
|
beforeX = x;
|
||||||
|
|
||||||
|
}
|
||||||
|
var olddatapoints = datapoints.points
|
||||||
|
datapoints.points = abandonedPoints;
|
||||||
|
|
||||||
|
series.points.radius = series.lines.lineWidth/2;
|
||||||
|
// plot the orphan points with a radius of lineWidth/2
|
||||||
|
drawSeriesPoints(series);
|
||||||
|
// reset old info
|
||||||
|
datapoints.points = olddatapoints;
|
||||||
|
}
|
||||||
|
|
||||||
function drawSeries(series) {
|
function drawSeries(series) {
|
||||||
if (series.lines.show)
|
if (series.lines.show)
|
||||||
drawSeriesLines(series);
|
drawSeriesLines(series);
|
||||||
|
if (!series.points.show && !series.bars.show) {
|
||||||
|
// not necessary if user wants points displayed for everything
|
||||||
|
drawOrphanedPoints(series);
|
||||||
|
}
|
||||||
if (series.bars.show)
|
if (series.bars.show)
|
||||||
drawSeriesBars(series);
|
drawSeriesBars(series);
|
||||||
if (series.points.show)
|
if (series.points.show)
|
||||||
|
|||||||
Reference in New Issue
Block a user