@netdata/charts
Version:
Netdata frontend SDK and chart utilities
23 lines (21 loc) • 757 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = exports["default"] = function _default() {
return function (plotter) {
var ctx = plotter.drawingContext;
var points = plotter.points;
var y_bottom = plotter.dygraph.toDomYCoord(0);
ctx.fillStyle = plotter.color;
var min_sep = points[1].canvasx - points[0].canvasx;
var bar_width = Math.floor(2.0 / 3 * min_sep);
// Do the actual plotting.
points.forEach(function (p) {
var center_x = p.canvasx;
ctx.fillRect(center_x - bar_width / 2, p.canvasy, bar_width, y_bottom - p.canvasy);
ctx.strokeRect(center_x - bar_width / 2, p.canvasy, bar_width, y_bottom - p.canvasy);
});
};
};